7 background-color: #
0f0;
10 [name=victim]:invalid {
11 background-color: #f00;
15 <script src=
"../../resources/js-test.js"></script>
18 <p id=
"description"></p>
20 <select name=
"victim"></select>
21 <textarea name=
"victim"></textarea>
24 <div id=
"console"></div>
27 description('This test checks if setCustomValidity causes CSS to get applied correctly.');
29 var v
= document
.getElementsByName('victim');
32 for (var i
= 0; i
< v
.length
; i
++) {
35 shouldBeFalse('test.validity.customError');
36 shouldBeEqualToString('test.validationMessage', '');
37 shouldBeEqualToString('getComputedStyle(test).backgroundColor', 'rgb(0, 255, 0)');
39 var message
= 'Custom validation message';
40 test
.setCustomValidity(message
);
41 shouldBeTrue('test.validity.customError');
42 shouldBeEqualToString('test.validationMessage', message
);
43 shouldBeEqualToString('getComputedStyle(test).backgroundColor', 'rgb(255, 0, 0)');
45 test
.setCustomValidity('');
46 shouldBeFalse('test.validity.customError');
47 shouldBeEqualToString('test.validationMessage', '');
48 shouldBeEqualToString('getComputedStyle(test).backgroundColor', 'rgb(0, 255, 0)');