ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
SlateTest Class Reference

Tests for the Slate. More...

+ Inheritance diagram for SlateTest:
+ Collaboration diagram for SlateTest:

Public Member Functions

 setUp ()
 
 testConstruction ()
 
 testWithEngaged (Slate $slate)
 testConstruction More...
 
 testWithAriaRole (Slate $slate)
 testConstruction More...
 
 testWithAriaRoleIncorrect (Slate $slate)
 testConstruction More...
 
 testSignals (Slate $slate)
 testConstruction More...
 
 testDifferentSignals (array $signals)
 testSignals More...
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML ($html)
 A more radical version of normalizeHTML. More...
 

Detailed Description

Tests for the Slate.

Definition at line 32 of file SlateTest.php.

Member Function Documentation

◆ setUp()

SlateTest::setUp ( )

Definition at line 34 of file SlateTest.php.

34  : void
35  {
36  $this->sig_gen = new I\SignalGenerator();
37  $this->button_factory = new I\Button\Factory($this->sig_gen);
38  $this->icon_factory = new I\Symbol\Icon\Factory();
39  }

◆ testConstruction()

SlateTest::testConstruction ( )

Definition at line 41 of file SlateTest.php.

References ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\$name.

42  {
43  $name = 'name';
44  $icon = $this->icon_factory->custom('', '');
45  $slate = new TestGenericSlate($this->sig_gen, $name, $icon);
46 
47  $this->assertInstanceOf(
48  "ILIAS\\UI\\Component\\MainControls\\Slate\\Slate",
49  $slate
50  );
51  $this->assertEquals($name, $slate->getName());
52  $this->assertEquals($icon, $slate->getSymbol());
53  $this->assertFalse($slate->getEngaged());
54  return $slate;
55  }
A generic Slate.
Definition: SlateTest.php:17
if($format !==null) $name
Definition: metadata.php:230

◆ testDifferentSignals()

SlateTest::testDifferentSignals ( array  $signals)

testSignals

Definition at line 111 of file SlateTest.php.

112  {
113  $this->assertEquals(
114  $signals,
115  array_unique($signals)
116  );
117  }

◆ testSignals()

SlateTest::testSignals ( Slate  $slate)

testConstruction

Definition at line 95 of file SlateTest.php.

References ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\getEngageSignal(), ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\getReplaceSignal(), and ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\getToggleSignal().

96  {
97  $signals = [
98  $slate->getToggleSignal(),
99  $slate->getEngageSignal(),
100  $slate->getReplaceSignal()
101  ];
102  foreach ($signals as $signal) {
103  $this->assertInstanceOf(Signal::class, $signal);
104  }
105  return $signals;
106  }
getReplaceSignal()
Signal to replace the contents of the slate.
Definition: Slate.php:165
getEngageSignal()
Signal that engages the slate when triggered.
Definition: Slate.php:134
getToggleSignal()
Signal that toggles the slate when triggered.
Definition: Slate.php:126
+ Here is the call graph for this function:

◆ testWithAriaRole()

SlateTest::testWithAriaRole ( Slate  $slate)

testConstruction

Definition at line 69 of file SlateTest.php.

References Vendor\Package\$e, ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\getAriaRole(), and ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\withAriaRole().

70  {
71  try {
72  $slate = $slate->withAriaRole(Slate::MENU);
73  $this->assertEquals("menu", $slate->getAriaRole());
74  } catch (\InvalidArgumentException $e) {
75  $this->assertFalse("This should not happen");
76  }
77  }
getAriaRole()
Get the ARIA role on the slate.
Definition: Slate.php:229
withAriaRole(string $aria_role)
Get a slate like this, but with an additional ARIA role.
Definition: Slate.php:211
+ Here is the call graph for this function:

◆ testWithAriaRoleIncorrect()

SlateTest::testWithAriaRoleIncorrect ( Slate  $slate)

testConstruction

Definition at line 82 of file SlateTest.php.

References Vendor\Package\$e, and ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\withAriaRole().

83  {
84  try {
85  $slate = $slate->withAriaRole("loremipsum");
86  $this->assertFalse("This should not happen");
87  } catch (\InvalidArgumentException $e) {
88  $this->assertTrue(true);
89  }
90  }
withAriaRole(string $aria_role)
Get a slate like this, but with an additional ARIA role.
Definition: Slate.php:211
+ Here is the call graph for this function:

◆ testWithEngaged()

SlateTest::testWithEngaged ( Slate  $slate)

testConstruction

Definition at line 60 of file SlateTest.php.

References ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\getEngaged(), and ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\withEngaged().

61  {
62  $slate = $slate->withEngaged(true);
63  $this->assertTrue($slate->getEngaged());
64  }
getEngaged()
Should the slate be rendered as engaged?
Definition: Slate.php:152
withEngaged(bool $state)
Configures the slate to be rendered as engaged (or not).
Definition: Slate.php:142
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: