ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ColorPickerInputTest Class Reference
+ Inheritance diagram for ColorPickerInputTest:
+ Collaboration diagram for ColorPickerInputTest:

Public Member Functions

 setUp ()
 
 testImplementsFactoryInterface ()
 
 testRender ()
 
 testRenderDisabled ()
 
 testRenderRequired ()
 
 testRenderValue ()
 
 testValueRequired ()
 
 testNullValue ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getHelpTextRetriever ()
 
 getUploadLimitResolver ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Protected Member Functions

 buildFactory ()
 
- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Protected Attributes

DefNamesource $name_source
 

Detailed Description

Definition at line 31 of file ColorPickerInputTest.php.

Member Function Documentation

◆ buildFactory()

ColorPickerInputTest::buildFactory ( )
protected

Definition at line 40 of file ColorPickerInputTest.php.

References ILIAS_UI_TestBase\getLanguage().

Referenced by testImplementsFactoryInterface(), testNullValue(), testRender(), testRenderDisabled(), testRenderRequired(), testRenderValue(), and testValueRequired().

40  : I\Input\Field\Factory
41  {
42  $df = new Data\Factory();
43  $language = $this->getLanguage();
44  return new I\Input\Field\Factory(
45  $this->createMock(
46  \ILIAS\UI\Implementation\Component\Input\UploadLimitResolver::class
47  ),
48  new SignalGenerator(),
49  $df,
50  new Refinery($df, $language),
51  $language
52  );
53  }
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUp()

ColorPickerInputTest::setUp ( )

Definition at line 35 of file ColorPickerInputTest.php.

35  : void
36  {
37  $this->name_source = new DefNamesource();
38  }

◆ testImplementsFactoryInterface()

ColorPickerInputTest::testImplementsFactoryInterface ( )

Definition at line 55 of file ColorPickerInputTest.php.

References Vendor\Package\$f, and buildFactory().

55  : void
56  {
57  $f = $this->buildFactory();
58  $cp = $f->colorpicker("label", "byline");
59  $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $cp);
60  $this->assertInstanceOf(Field\ColorPicker::class, $cp);
61  }
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ testNullValue()

ColorPickerInputTest::testNullValue ( )

Definition at line 184 of file ColorPickerInputTest.php.

References Vendor\Package\$f, and buildFactory().

184  : void
185  {
186  $f = $this->buildFactory();
187  $colorpicker = $f->colorpicker("label", "byline");
188  $this->expectException(\InvalidArgumentException::class);
189  $colorpicker->withValue(null);
190  }
+ Here is the call graph for this function:

◆ testRender()

ColorPickerInputTest::testRender ( )

Definition at line 63 of file ColorPickerInputTest.php.

References Vendor\Package\$f, $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), buildFactory(), and ILIAS_UI_TestBase\getDefaultRenderer().

63  : void
64  {
65  $f = $this->buildFactory();
66  $label = "label";
67  $byline = "byline";
68  $name = "name_0";
69  $cp = $f->colorpicker($label, $byline)->withNameFrom($this->name_source);
70  $r = $this->getDefaultRenderer();
71  $html = $this->brutallyTrimHTML($r->render($cp));
72 
73  $expected = $this->brutallyTrimHTML('
74  <div class="form-group row">
75  <label class="control-label col-sm-4 col-md-3 col-lg-2">label</label>
76  <div class="col-sm-8 col-md-9 col-lg-10">
77  <input id="id_1" type="color" name="name_0" value=""/>
78  <div class="help-block">byline</div>
79  </div>
80  </div>
81  ');
82  $this->assertHTMLEquals($expected, $html);
83  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
$r
+ Here is the call graph for this function:

◆ testRenderDisabled()

ColorPickerInputTest::testRenderDisabled ( )

Definition at line 85 of file ColorPickerInputTest.php.

References Vendor\Package\$f, $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), buildFactory(), and ILIAS_UI_TestBase\getDefaultRenderer().

85  : void
86  {
87  $f = $this->buildFactory();
88  $label = "label";
89  $byline = "byline";
90  $name = "name_0";
91  $cp = $f->colorpicker($label, $byline)
92  ->withNameFrom($this->name_source)
93  ->withDisabled(true);
94 
95  $r = $this->getDefaultRenderer();
96  $html = $this->brutallyTrimHTML($r->render($cp));
97 
98  $expected = $this->brutallyTrimHTML('
99  <div class="form-group row">
100  <label class="control-label col-sm-4 col-md-3 col-lg-2">label</label>
101  <div class="col-sm-8 col-md-9 col-lg-10">
102  <input id="id_1" type="color" name="name_0" value=""/>
103  <div class="help-block">byline</div>
104  </div>
105  </div>
106  ');
107  $this->assertHTMLEquals($expected, $html);
108  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
$r
+ Here is the call graph for this function:

◆ testRenderRequired()

ColorPickerInputTest::testRenderRequired ( )

Definition at line 110 of file ColorPickerInputTest.php.

References Vendor\Package\$f, $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), buildFactory(), and ILIAS_UI_TestBase\getDefaultRenderer().

110  : void
111  {
112  $f = $this->buildFactory();
113  $label = "label";
114  $byline = "byline";
115  $name = "name_0";
116  $cp = $f->colorpicker($label, $byline)
117  ->withNameFrom($this->name_source)
118  ->withRequired(true);
119 
120  $r = $this->getDefaultRenderer();
121  $html = $this->brutallyTrimHTML($r->render($cp));
122 
123  $expected = $this->brutallyTrimHTML('
124  <div class="form-group row">
125  <label class="control-label col-sm-4 col-md-3 col-lg-2">label
126  <span class="asterisk">*</span></label>
127  <div class="col-sm-8 col-md-9 col-lg-10">
128  <input id="id_1" type="color" name="name_0" value=""/>
129  <div class="help-block">byline</div>
130  </div>
131  </div>
132  ');
133  $this->assertHTMLEquals($expected, $html);
134  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
$r
+ Here is the call graph for this function:

◆ testRenderValue()

ColorPickerInputTest::testRenderValue ( )

Definition at line 136 of file ColorPickerInputTest.php.

References Vendor\Package\$f, $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), buildFactory(), and ILIAS_UI_TestBase\getDefaultRenderer().

136  : void
137  {
138  $f = $this->buildFactory();
139  $label = "label";
140  $byline = "byline";
141  $value = "value_0";
142  $cp = $f->colorpicker($label, $byline)
143  ->withValue($value)
144  ->withNameFrom($this->name_source);
145 
146  $r = $this->getDefaultRenderer();
147  $html = $this->brutallyTrimHTML($r->render($cp));
148 
149  $expected = $this->brutallyTrimHTML('
150  <div class="form-group row">
151  <label class="control-label col-sm-4 col-md-3 col-lg-2">label</label>
152  <div class="col-sm-8 col-md-9 col-lg-10">
153  <input id="id_1" type="color" name="name_0" value="value_0"/>
154  <div class="help-block">byline</div>
155  </div>
156  </div>
157  ');
158  $this->assertHTMLEquals($expected, $html);
159  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
$r
+ Here is the call graph for this function:

◆ testValueRequired()

ColorPickerInputTest::testValueRequired ( )

Definition at line 161 of file ColorPickerInputTest.php.

References Vendor\Package\$f, and buildFactory().

161  : void
162  {
163  $f = $this->buildFactory();
164  $label = "label";
165  $byline = "byline";
166  $name = "name_0";
167  $cp = $f->colorpicker($label, $byline)
168  ->withNameFrom($this->name_source)
169  ->withRequired(true);
170 
171  $cp1 = $cp->withInput(new DefInputData([$name => "#FFF"]));
172  $value1 = $cp1->getContent();
173  $this->assertTrue($value1->isOk());
174 
175  $cp2 = $cp->withInput(new DefInputData([$name => "#00"]));
176  $value2 = $cp2->getContent();
177  $this->assertTrue($value2->isError());
178 
179  $cp3 = $cp->withInput(new DefInputData([$name => ""]));
180  $value2 = $cp3->getContent();
181  $this->assertTrue($value2->isError());
182  }
+ Here is the call graph for this function:

Field Documentation

◆ $name_source

DefNamesource ColorPickerInputTest::$name_source
protected

Definition at line 33 of file ColorPickerInputTest.php.


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