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

Side by Side Diff: LayoutTests/fast/forms/resources/input-live-pseudo-selectors.js

Issue 236753004: Re-land "Improve support for :read-only and :read-write pseudoclasses". (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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
1 description("This test performs a check that :valid/:invalid CSS psudo selectors are lively applied."); 1 description("This test performs a check that :valid/:invalid CSS psudo selectors are lively applied.");
2 2
3 // Setup for static elements. 3 // Setup for static elements.
4 var form = document.createElement('form'); 4 var form = document.createElement('form');
5 document.body.appendChild(form); 5 document.body.appendChild(form);
6 var nonForm = document.createElement('div'); 6 var nonForm = document.createElement('div');
7 document.body.appendChild(nonForm); 7 document.body.appendChild(nonForm);
8 8
9 function makeInvalid() { 9 function makeInvalid() {
10 var i = document.createElement('input'); 10 var i = document.createElement('input');
11 i.name = 'foo'; 11 i.name = 'foo';
12 i.required = true; 12 i.required = true;
13 i.value = ''; 13 i.value = '';
14 form.appendChild(i); 14 form.appendChild(i);
15 return i; 15 return i;
16 } 16 }
17 17
18 function backgroundOf(el) { 18 function backgroundOf(el) {
19 return document.defaultView.getComputedStyle(el, null).getPropertyValue('bac kground-color'); 19 return document.defaultView.getComputedStyle(el, null).getPropertyValue('bac kground-color');
20 } 20 }
21 21
22 var elBackground = 'backgroundOf(el)'; 22 var elBackground = 'backgroundOf(el)';
23 var invalidColor = 'rgb(255, 0, 0)'; 23 var invalidColor = 'rgb(255, 0, 0)';
24 var normalColor = 'rgb(255, 255, 255)'; 24 var normalColor = 'rgb(255, 255, 255)';
25 var disabledColor = 'rgb(0, 0, 0)'; 25 var disabledColor = 'rgb(0, 0, 0)';
26 var readOnlyColor = 'rgb(0, 255, 0)' 26 var readOnlyColor = 'rgb(0, 255, 0)';
27 var validColor = 'rgb(0, 0, 255)'; 27 var validColor = 'rgb(0, 0, 255)';
28 28
29 // -------------------------------- 29 // --------------------------------
30 // willValidate change 30 // willValidate change
31 // -------------------------------- 31 // --------------------------------
32 var el = makeInvalid(); 32 var el = makeInvalid();
33 // Confirm this element is invalid. 33 // Confirm this element is invalid.
34 debug('Chheck the initial state:'); 34 debug('Chheck the initial state:');
35 shouldBe(elBackground, 'invalidColor'); 35 shouldBe(elBackground, 'invalidColor');
36 36
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 debug('Change step:'); 107 debug('Change step:');
108 el = makeInvalid(); 108 el = makeInvalid();
109 el.value = '1'; 109 el.value = '1';
110 el.type = 'number'; 110 el.type = 'number';
111 shouldBe(elBackground, 'validColor'); 111 shouldBe(elBackground, 'validColor');
112 el.step = '2'; 112 el.step = '2';
113 shouldBe(elBackground, 'invalidColor'); 113 shouldBe(elBackground, 'invalidColor');
114 el.step = '0.5'; 114 el.step = '0.5';
115 shouldBe(elBackground, 'validColor'); 115 shouldBe(elBackground, 'validColor');
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/input-live-pseudo-selectors.html ('k') | LayoutTests/fast/forms/resources/live-pseudo-selectors.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698