10
10
* Tests building and processing of core form elements.
11
11
*
12
12
* @group Form
13
- * @group #slow
14
13
*/
15
14
class ElementTest extends BrowserTestBase {
16
15
@@ -26,10 +25,26 @@ class ElementTest extends BrowserTestBase {
26
25
*/
27
26
protected $ defaultTheme = 'starterkit_theme ' ;
28
27
28
+ /**
29
+ * Test form elements.
30
+ */
31
+ public function testFormElements (): void {
32
+ $ this ->testPlaceHolderText ();
33
+ $ this ->testOptions ();
34
+ $ this ->testRadiosChecked ();
35
+ $ this ->testWrapperIds ();
36
+ $ this ->testButtonClasses ();
37
+ $ this ->testGroupElements ();
38
+ $ this ->testRequiredFieldsetsAndDetails ();
39
+ $ this ->testFormAutocomplete ();
40
+ $ this ->testFormElementErrors ();
41
+ $ this ->testDetailsSummaryAttributes ();
42
+ }
43
+
29
44
/**
30
45
* Tests placeholder text for elements that support placeholders.
31
46
*/
32
- public function testPlaceHolderText (): void {
47
+ protected function testPlaceHolderText (): void {
33
48
$ this ->drupalGet ('form-test/placeholder-text ' );
34
49
foreach (['textfield ' , 'tel ' , 'url ' , 'password ' , 'email ' , 'number ' , 'textarea ' ] as $ type ) {
35
50
$ field = $ this ->assertSession ()->fieldExists ("edit- $ type " );
@@ -40,7 +55,7 @@ public function testPlaceHolderText(): void {
40
55
/**
41
56
* Tests expansion of #options for #type checkboxes and radios.
42
57
*/
43
- public function testOptions (): void {
58
+ protected function testOptions (): void {
44
59
$ this ->drupalGet ('form-test/checkboxes-radios ' );
45
60
46
61
// Verify that all options appear in their defined order.
@@ -81,7 +96,7 @@ public function testOptions(): void {
81
96
/**
82
97
* Tests correct checked attribute for radios element.
83
98
*/
84
- public function testRadiosChecked (): void {
99
+ protected function testRadiosChecked (): void {
85
100
// Verify that there is only one radio option checked.
86
101
$ this ->drupalGet ('form-test/radios-checked ' );
87
102
$ this ->assertSession ()->elementsCount ('xpath ' , '//input[@name="radios" and @checked] ' , 1 );
@@ -110,7 +125,7 @@ public function testRadiosChecked(): void {
110
125
/**
111
126
* Tests wrapper ids for checkboxes and radios.
112
127
*/
113
- public function testWrapperIds (): void {
128
+ protected function testWrapperIds (): void {
114
129
$ this ->drupalGet ('form-test/checkboxes-radios ' );
115
130
116
131
// Verify that wrapper id is different from element id.
@@ -124,7 +139,7 @@ public function testWrapperIds(): void {
124
139
/**
125
140
* Tests button classes.
126
141
*/
127
- public function testButtonClasses (): void {
142
+ protected function testButtonClasses (): void {
128
143
$ this ->drupalGet ('form-test/button-class ' );
129
144
// Just contains(@class, "button") won't do because then
130
145
// "button--foo" would contain "button". Instead, check
@@ -138,7 +153,7 @@ public function testButtonClasses(): void {
138
153
/**
139
154
* Tests the #group property.
140
155
*/
141
- public function testGroupElements (): void {
156
+ protected function testGroupElements (): void {
142
157
$ this ->drupalGet ('form-test/group-details ' );
143
158
$ this ->assertSession ()->elementsCount ('xpath ' , '//div[@class="details-wrapper"]//div[@class="details-wrapper"]//label ' , 1 );
144
159
$ this ->drupalGet ('form-test/group-container ' );
@@ -154,7 +169,7 @@ public function testGroupElements(): void {
154
169
/**
155
170
* Tests the #required property on details and fieldset elements.
156
171
*/
157
- public function testRequiredFieldsetsAndDetails (): void {
172
+ protected function testRequiredFieldsetsAndDetails (): void {
158
173
$ this ->drupalGet ('form-test/group-details ' );
159
174
$ this ->assertEmpty ($ this ->cssSelect ('summary.form-required ' ));
160
175
$ this ->drupalGet ('form-test/group-details/1 ' );
@@ -168,7 +183,7 @@ public function testRequiredFieldsetsAndDetails(): void {
168
183
/**
169
184
* Tests a form with an autocomplete setting..
170
185
*/
171
- public function testFormAutocomplete (): void {
186
+ protected function testFormAutocomplete (): void {
172
187
$ this ->drupalGet ('form-test/autocomplete ' );
173
188
174
189
// Ensure that the user does not have access to the autocompletion.
@@ -190,7 +205,7 @@ public function testFormAutocomplete(): void {
190
205
/**
191
206
* Tests form element error messages.
192
207
*/
193
- public function testFormElementErrors (): void {
208
+ protected function testFormElementErrors (): void {
194
209
$ this ->drupalGet ('form_test/details-form ' );
195
210
$ this ->submitForm ([], 'Submit ' );
196
211
$ this ->assertSession ()->pageTextContains ('I am an error on the details element. ' );
@@ -199,7 +214,7 @@ public function testFormElementErrors(): void {
199
214
/**
200
215
* Tests summary attributes of details.
201
216
*/
202
- public function testDetailsSummaryAttributes (): void {
217
+ protected function testDetailsSummaryAttributes (): void {
203
218
$ this ->drupalGet ('form-test/group-details ' );
204
219
$ this ->assertSession ()->elementExists ('css ' , 'summary[data-summary-attribute="test"] ' );
205
220
}
0 commit comments