diff -u b/core/modules/system/tests/src/Functional/Form/CheckboxTest.php b/core/modules/system/tests/src/Functional/Form/CheckboxTest.php --- b/core/modules/system/tests/src/Functional/Form/CheckboxTest.php +++ b/core/modules/system/tests/src/Functional/Form/CheckboxTest.php @@ -100,17 +100,10 @@ $name = (string) $checkbox->getAttribute('name'); $this->assertSame($checked, $name == 'checkbox_off[0]' || $name == 'checkbox_zero_default[0]' || $name == 'checkbox_string_zero_default[0]', new FormattableMarkup('Checkbox %name correctly checked', ['%name' => $name])); } - } - /** - * Tests that checkbox has no aria required attribute. - */ - public function testFormCheckboxHasNoAriaRequiredAtt() { + // Ensure that checkbox has no aria required attribute. $this->drupalGet('/form-test/checkbox'); - $checkbox = $this->cssSelect('input[type=checkbox]'); - $this->assertNotEmpty($checkbox); - $element = $checkbox[0]->getAttribute('aria-required'); - $this->assertEmpty($element); + $this->assertEmpty($this->assertSession()->elementExists('css', 'input[type=checkbox][required]')->getAttribute('aria-required')); } }