5 require_once(__DIR__.
"/../../../../libs/composer/vendor/autoload.php");
6 require_once(__DIR__.
"/../../Base.php");
8 use \ILIAS\UI\Component as
C;
15 return new \ILIAS\UI\Implementation\Component\Button\Factory();
19 (
"standard" =>
"btn btn-default" 20 ,
"primary" =>
"btn btn-default btn-primary" 26 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Button\\Factory", $f);
27 $this->assertInstanceOf
28 (
"ILIAS\\UI\\Component\\Button\\Standard" 29 , $f->standard(
"label",
"http://www.ilias.de")
31 $this->assertInstanceOf
32 (
"ILIAS\\UI\\Component\\Button\\Primary" 33 , $f->primary(
"label",
"http://www.ilias.de")
35 $this->assertInstanceOf
36 (
"ILIAS\\UI\\Component\\Button\\Close" 47 $f->$factory_method($this,
"http://www.ilias.de");
48 $this->assertFalse(
"This should not happen");
59 $f->$factory_method(
"label", $this);
60 $this->assertFalse(
"This should not happen");
70 $b = $f->$factory_method(
"label",
"http://www.ilias.de");
72 $this->assertEquals(
"label", $b->getLabel());
80 $b = $f->$factory_method(
"label",
"http://www.ilias.de");
82 $b2 = $b->withLabel(
"label2");
84 $this->assertEquals(
"label", $b->getLabel());
85 $this->assertEquals(
"label2", $b2->getLabel());
93 $b = $f->$factory_method(
"label",
"http://www.ilias.de");
95 $this->assertEquals(
"http://www.ilias.de", $b->getAction());
103 $b = $f->$factory_method(
"label",
"http://www.ilias.de");
105 $this->assertTrue($b->isActive());
113 $b = $f->$factory_method(
"label",
"http://www.ilias.de")
114 ->withUnavailableAction();
116 $this->assertFalse($b->isActive());
117 $this->assertEquals(
"http://www.ilias.de", $b->getAction());
124 $ln =
"http://www.ilias.de";
126 $b = $f->$factory_method(
"label", $ln);
131 $css_classes = self::$canonical_css_classes[$factory_method];
132 $expected =
"<a class=\"$css_classes\" href=\"$ln\" data-action=\"$ln\">".
135 $this->assertEquals($expected,
$html);
142 $ln =
"http://www.ilias.de";
144 $b = $f->$factory_method(
"label", $ln)
145 ->withUnavailableAction();
150 $css_classes = self::$canonical_css_classes[$factory_method];
151 $expected =
"<a class=\"$css_classes ilSubmitInactive\" data-action=\"$ln\">".
154 $this->assertEquals($expected,
$html);
164 $expected =
"<button type=\"button\" class=\"close\" data-dismiss=\"modal\">".
165 " <span aria-hidden=\"true\">×</span>".
166 " <span class=\"sr-only\">Close</span>".
168 $this->assertEquals($expected,
$html);
175 $ln =
"http://www.ilias.de";
179 $b = $f->$factory_method(
"label", $ln)
180 ->withOnLoadCode(
function($id) use (&$ids) {
187 $this->assertCount(1, $ids);
190 $css_classes = self::$canonical_css_classes[$factory_method];
191 $expected =
"<a class=\"$css_classes\" href=\"$ln\" data-action=\"$ln\" id=\"$id\">".
194 $this->assertEquals($expected,
$html);
202 ->withOnLoadCode(
function($id) use (&$ids) {
209 $this->assertCount(1, $ids);
212 $expected =
"<button type=\"button\" class=\"close\" data-dismiss=\"modal\" id=\"$id\">".
213 " <span aria-hidden=\"true\">×</span>".
214 " <span class=\"sr-only\">Close</span>".
216 $this->assertEquals($expected,
$html);
Provides common functionality for UI tests.
Create styles array
The data for the language used.