ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ColorSelectTest Class Reference
+ Inheritance diagram for ColorSelectTest:
+ Collaboration diagram for ColorSelectTest:

Public Member Functions

 setUp ()
 
 testImplementsFactoryInterface ()
 
 testRender ()
 
 testCommonRendering ()
 
 testRenderValue ()
 
 testValueRequired ()
 
 testNullValue ()
 

Protected Attributes

DefNamesource $name_source
 

Detailed Description

Definition at line 32 of file ColorSelectTest.php.

Member Function Documentation

◆ setUp()

ColorSelectTest::setUp ( )

Definition at line 38 of file ColorSelectTest.php.

38 : void
39 {
40 $this->name_source = new DefNamesource();
41 }

◆ testCommonRendering()

ColorSelectTest::testCommonRendering ( )

Definition at line 68 of file ColorSelectTest.php.

68 : void
69 {
70 $f = $this->getFieldFactory();
71 $label = "label";
72 $color_select = $f->colorSelect($label, null)->withNameFrom($this->name_source);
73
74 $this->testWithError($color_select);
75 $this->testWithNoByline($color_select);
76 $this->testWithRequired($color_select);
77 $this->testWithDisabled($color_select);
78 $this->testWithAdditionalOnloadCodeRendersId($color_select);
79 }

References Vendor\Package\$f.

◆ testImplementsFactoryInterface()

ColorSelectTest::testImplementsFactoryInterface ( )

Definition at line 43 of file ColorSelectTest.php.

43 : void
44 {
45 $f = $this->getFieldFactory();
46 $cp = $f->colorSelect("label", "byline");
47 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $cp);
48 $this->assertInstanceOf(Field\ColorSelect::class, $cp);
49 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References Vendor\Package\$f.

◆ testNullValue()

ColorSelectTest::testNullValue ( )

Definition at line 124 of file ColorSelectTest.php.

124 : void
125 {
126 $f = $this->getFieldFactory();
127 $color_select = $f->colorSelect("label", "byline");
128 $this->expectException(\InvalidArgumentException::class);
129 $color_select->withValue(null);
130 }

References Vendor\Package\$f.

◆ testRender()

ColorSelectTest::testRender ( )

Definition at line 51 of file ColorSelectTest.php.

51 : void
52 {
53 $f = $this->getFieldFactory();
54 $label = "label";
55 $byline = "byline";
56 $cp = $f->colorSelect($label, $byline)->withNameFrom($this->name_source);
57
58 $expected = $this->getFormWrappedHtml(
59 'color-select-field-input',
60 $label,
61 '<input id="id_1" type="color" name="name_0" value="" class="c-field-color-select"/>',
62 $byline,
63 'id_1'
64 );
65 $this->assertEquals($expected, $this->render($cp));
66 }

References Vendor\Package\$f.

◆ testRenderValue()

ColorSelectTest::testRenderValue ( )

Definition at line 81 of file ColorSelectTest.php.

81 : void
82 {
83 $f = $this->getFieldFactory();
84 $label = "label";
85 $byline = "byline";
86 $value = "value_0";
87 $cp = $f->colorSelect($label, $byline)
88 ->withValue($value)
89 ->withNameFrom($this->name_source);
90
91 $expected = $this->getFormWrappedHtml(
92 'color-select-field-input',
93 $label,
94 '<input id="id_1" type="color" name="name_0" value="value_0" class="c-field-color-select"/>',
95 $byline,
96 'id_1'
97 );
98 $this->assertEquals($expected, $this->render($cp));
99 }

References Vendor\Package\$f.

◆ testValueRequired()

ColorSelectTest::testValueRequired ( )

Definition at line 101 of file ColorSelectTest.php.

101 : void
102 {
103 $f = $this->getFieldFactory();
104 $label = "label";
105 $byline = "byline";
106 $name = "name_0";
107 $cp = $f->colorSelect($label, $byline)
108 ->withNameFrom($this->name_source)
109 ->withRequired(true);
110
111 $cp1 = $cp->withInput(new DefInputData([$name => "#FFF"]));
112 $value1 = $cp1->getContent();
113 $this->assertTrue($value1->isOk());
114
115 $cp2 = $cp->withInput(new DefInputData([$name => "#00"]));
116 $value2 = $cp2->getContent();
117 $this->assertTrue($value2->isError());
118
119 $cp3 = $cp->withInput(new DefInputData([$name => ""]));
120 $value2 = $cp3->getContent();
121 $this->assertTrue($value2->isError());
122 }

References Vendor\Package\$f.

Field Documentation

◆ $name_source

DefNamesource ColorSelectTest::$name_source
protected

Definition at line 36 of file ColorSelectTest.php.


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