".
@@ -112,6 +127,7 @@ public function test_render_content_full() {
$expected_html =
"
".
"
".
+ "
".
"
".
"
Card Title
".
" ".
@@ -120,4 +136,26 @@ public function test_render_content_full() {
$this->assertHTMLEquals($expected_html, $html);
}
+
+ public function test_render_content_with_highlight() {
+ $f = $this->getFactory();
+ $r = $this->getDefaultRenderer();
+
+ $image = $f->image()->standard("src","alt");
+
+ $c = $f->card("Card Title",$image)->withHighlight(true);
+
+ $html = $r->render($c);
+
+ $expected_html =
+ "
".
+ "
".
+ "
".
+ "
".
+ "
Card Title
".
+ " ".
+ "
";
+
+ $this->assertHTMLEquals($expected_html, $html);
+ }
}
diff --git a/tests/UI/Component/ComponentHelperTest.php b/tests/UI/Component/ComponentHelperTest.php
index 07af554d42a7..ecb54cd63168 100644
--- a/tests/UI/Component/ComponentHelperTest.php
+++ b/tests/UI/Component/ComponentHelperTest.php
@@ -16,6 +16,9 @@ public function _checkIntArg($which, $value) {
public function _checkStringArg($which, $value) {
$this->checkStringArg($which, $value);
}
+ public function _checkFloatArg($which, $value) {
+ $this->checkFloatArg($which, $value);
+ }
public function _checkArgInstanceOf($which, $value, $class) {
$this->checkArgInstanceOf($which, $value, $class);
}
@@ -69,7 +72,7 @@ public function test_check_arg_not_ok() {
public function test_check_int_arg_ok() {
try {
- $this->mock->_checkIntArg("some_arg", 1);
+ $this->mock->_checkIntArg("some_arg", 1);
}
catch (\InvalidArgumentException $e) {
$this->assertFalse("This should not happen.");
@@ -88,7 +91,7 @@ public function test_check_int_arg_not_ok() {
public function test_check_string_arg_ok() {
try {
- $this->mock->_checkStringArg("some_arg", "bar");
+ $this->mock->_checkStringArg("some_arg", "bar");
}
catch (\InvalidArgumentException $e) {
$this->assertFalse("This should not happen.");
@@ -107,7 +110,7 @@ public function test_check_string_arg_not_ok() {
public function test_check_arg_instanceof_ok() {
try {
- $this->mock->_checkArgInstanceOf("some_arg", $this->mock, ComponentMock::class);
+ $this->mock->_checkArgInstanceOf("some_arg", $this->mock, ComponentMock::class);
}
catch (\InvalidArgumentException $e) {
$this->assertFalse("This should not happen.");
@@ -128,7 +131,7 @@ public function test_check_arg_instanceof_not_ok() {
public function test_check_arg_is_element_ok() {
try {
- $this->mock->_checkArgIsElement("some_arg", "bar", array("foo", "bar"), "foobar");
+ $this->mock->_checkArgIsElement("some_arg", "bar", array("foo", "bar"), "foobar");
}
catch (\InvalidArgumentException $e) {
$this->assertFalse("This should not happen.");
@@ -137,7 +140,7 @@ public function test_check_arg_is_element_ok() {
public function test_check_string_arg_is_element_not_ok() {
try {
- $this->mock->_checkArgIsElement("some_arg", "baz", array("foo", "bar"), "foobar");
+ $this->mock->_checkArgIsElement("some_arg", "baz", array("foo", "bar"), "foobar");
$this->assertFalse("This should not happen.");
}
catch (\InvalidArgumentException $e) {
@@ -279,4 +282,23 @@ public function test_check_arg_list_not_ok_2() {
$this->assertEquals("Argument 'some_arg': $m", $e->getMessage());
}
}
+
+ public function test_check_float_arg_ok() {
+ try {
+ $this->mock->_checkFloatArg("some_arg", 1.73);
+ }
+ catch (\InvalidArgumentException $e) {
+ $this->assertFalse("This should not happen.");
+ }
+ }
+
+ public function test_check_float_arg_not_ok() {
+ try {
+ $this->mock->_checkFloatArg("some_arg", "foo");
+ $this->assertFalse("This should not happen.");
+ }
+ catch (\InvalidArgumentException $e) {
+ $this->assertEquals("Argument 'some_arg': expected float, got string 'foo'", $e->getMessage());
+ }
+ }
}
diff --git a/tests/UI/Component/Deck/DeckTest.php b/tests/UI/Component/Deck/DeckTest.php
index 42cf2cd30f5f..a6273bb3a529 100644
--- a/tests/UI/Component/Deck/DeckTest.php
+++ b/tests/UI/Component/Deck/DeckTest.php
@@ -78,17 +78,17 @@ public function test_render_content() {
$expected_html =
'
';
diff --git a/tests/UI/Component/Image/ImageTest.php b/tests/UI/Component/Image/ImageTest.php
index 0f310cba0339..f7166e7b85d0 100644
--- a/tests/UI/Component/Image/ImageTest.php
+++ b/tests/UI/Component/Image/ImageTest.php
@@ -64,6 +64,13 @@ public function test_set_alt() {
$this->assertEquals("newAlt", $i->getAlt());
}
+ public function test_set_action() {
+ $f = $this->getImageFactory();
+ $i = $f->standard("source","alt");
+ $i = $i->withAction("newAction");
+ $this->assertEquals("newAction", $i->getAction());
+ }
+
public function test_invalid_source(){
$f = $this->getImageFactory();
@@ -117,4 +124,16 @@ public function test_render_alt_escaping() {
$this->assertEquals($expected, $html);
}
+
+ public function test_render_with_action() {
+ $f = $this->getImageFactory();
+ $r = $this->getDefaultRenderer();
+ $i = $f->standard("source", "alt")->withAction("action");
+
+ $html = $this->normalizeHTML($r->render($i));
+
+ $expected = "
";
+
+ $this->assertEquals($expected, $html);
+ }
}
diff --git a/tests/UI/Component/Panel/PanelTest.php b/tests/UI/Component/Panel/PanelTest.php
index f9e7c3d0ae55..407991ea0ae8 100644
--- a/tests/UI/Component/Panel/PanelTest.php
+++ b/tests/UI/Component/Panel/PanelTest.php
@@ -139,7 +139,7 @@ public function test_render_sub() {
"
".
"