Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: LayoutTests/fast/forms/radio/radio-live-validation-style.html

Issue 9805002: Revert 105710 - Introduce RadioButtonGroup class to keep track of the group members and required st… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../js/resources/js-test-pre.js"></script>
5 <style>
6 :invalid { background: rgb(255, 0, 0); }
7 :valid { background: rgb(0, 0, 255); }
8 </style>
9 </head>
10 <body>
11 <script>
12 description('Check if :valid/:invalid CSS pseudo selectors are lively applied');
13
14 function $(id) {
15 return document.getElementById(id);
16 }
17
18 function backgroundOf(element) {
19 return document.defaultView.getComputedStyle(element, null).getPropertyValue ('background-color');
20 }
21
22 var invalidColor = 'rgb(255, 0, 0)';
23 var validColor = 'rgb(0, 0, 255)';
24
25 var parent = document.createElement('div');
26 document.body.appendChild(parent);
27
28 debug('Removing a checked radio button from a required radio button group by a D OM tree mutation:');
29 parent.innerHTML = '<input type=radio name=group1 required id=radio1>' +
30 '<input type=radio name=group1 checked id=radio2>';
31 shouldBe('backgroundOf($("radio1"))', 'validColor');
32 shouldBe('parent.removeChild($("radio2")); backgroundOf($("radio1"))', 'invalidC olor');
33 debug('');
34
35 debug('Removing a checked radio button from a required radio button group by nam e attribute change:');
36 parent.innerHTML = '<input type=radio name=group1 required id=radio1>' +
37 '<input type=radio name=group1 checked id=radio2>';
38 shouldBe('$("radio2").name = "group2"; backgroundOf($("radio1"))', 'invalidColor ');
39 debug('');
40
41 debug('Removing a checked radio button from a required radio button group by typ e change:');
42 parent.innerHTML = '<input type=radio name=group1 required id=radio1>' +
43 '<input type=radio name=group1 checked id=radio2>';
44 shouldBe('$("radio2").type = "text"; backgroundOf($("radio1"))', 'invalidColor') ;
45 debug('');
46
47 debug('Make a radio button group required by required attribute change:');
48 parent.innerHTML = '<input type=radio name=group1 id=radio1>' +
49 '<input type=radio name=group1 id=radio2>';
50 shouldBe('backgroundOf($("radio1"))', 'validColor');
51 shouldBe('backgroundOf($("radio2"))', 'validColor');
52 shouldBe('$("radio1").required = true; backgroundOf($("radio1"))', 'invalidColor ');
53 shouldBe('backgroundOf($("radio2"))', 'invalidColor');
54 debug('');
55
56 debug('Make a radio button group not required by required attribute change:');
57 parent.innerHTML = '<input type=radio required name=group1 id=radio1>' +
58 '<input type=radio name=group1 id=radio2>';
59 shouldBe('backgroundOf($("radio1"))', 'invalidColor');
60 shouldBe('backgroundOf($("radio2"))', 'invalidColor');
61 shouldBe('$("radio1").required = false; backgroundOf($("radio1"))', 'validColor' );
62 shouldBe('backgroundOf($("radio2"))', 'validColor');
63 debug('');
64
65
66 debug('Removing one of multiple required attributes:');
67 parent.innerHTML = '<input type=radio required name=group1 id=radio1>' +
68 '<input type=radio required name=group1 id=radio2>';
69 shouldBe('backgroundOf($("radio1"))', 'invalidColor');
70 shouldBe('backgroundOf($("radio2"))', 'invalidColor');
71 shouldBe('$("radio1").required = false; backgroundOf($("radio1"))', 'invalidColo r');
72 shouldBe('backgroundOf($("radio2"))', 'invalidColor');
73 debug('');
74
75 debug('Adding a radio button with the required attribute to a radio button group :');
76 parent.innerHTML = '<input type=radio name=group1 id=radio1>';
77 shouldBe('backgroundOf($("radio1"))', 'validColor');
78 var requiredRadioButton = document.createElement('input');
79 requiredRadioButton.type = 'radio';
80 requiredRadioButton.name = 'group1';
81 requiredRadioButton.required = true;
82 shouldBe('parent.appendChild(requiredRadioButton); backgroundOf($("radio1"))', ' invalidColor');
83 shouldBe('backgroundOf(requiredRadioButton)', 'invalidColor');
84 debug('');
85
86 debug('Removing a radio button with the required attribute from a radio button g roup:');
87 shouldBe('parent.removeChild(requiredRadioButton); backgroundOf($("radio1"))', ' validColor');
88 debug('');
89
90 parent.innerHTML = '';
91 </script>
92 <script src="../../js/resources/js-test-post.js"></script>
93 </body>
94 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698