OLD | NEW |
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('textarea'); | 10 var i = document.createElement('textarea'); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 el.value = 'abc'; | 69 el.value = 'abc'; |
70 shouldBe(elBackground, 'validColor'); | 70 shouldBe(elBackground, 'validColor'); |
71 el.value = ''; | 71 el.value = ''; |
72 shouldBe(elBackground, 'invalidColor'); | 72 shouldBe(elBackground, 'invalidColor'); |
73 | 73 |
74 debug('Change the value by key input:'); | 74 debug('Change the value by key input:'); |
75 el = makeInvalid(); | 75 el = makeInvalid(); |
76 el.focus(); | 76 el.focus(); |
77 eventSender.keyDown('a'); | 77 eventSender.keyDown('a'); |
78 shouldBe(elBackground, 'validColor'); | 78 shouldBe(elBackground, 'validColor'); |
79 eventSender.keyDown('\x08', []); | 79 eventSender.keyDown('backspace', []); |
80 shouldBe(elBackground, 'invalidColor'); | 80 shouldBe(elBackground, 'invalidColor'); |
81 | 81 |
82 // -------------------------------- | 82 // -------------------------------- |
83 // Constraints change | 83 // Constraints change |
84 // -------------------------------- | 84 // -------------------------------- |
85 debug('Change required:'); | 85 debug('Change required:'); |
86 el = makeInvalid(); | 86 el = makeInvalid(); |
87 el.required = false; | 87 el.required = false; |
88 shouldBe(elBackground, 'validColor'); | 88 shouldBe(elBackground, 'validColor'); |
89 el.required = true; | 89 el.required = true; |
90 shouldBe(elBackground, 'invalidColor'); | 90 shouldBe(elBackground, 'invalidColor'); |
91 | 91 |
92 debug('Change maxlength:'); | 92 debug('Change maxlength:'); |
93 el = makeInvalid(); | 93 el = makeInvalid(); |
94 el.value = '1234567890'; | 94 el.value = '1234567890'; |
95 shouldBe(elBackground, 'validColor'); | 95 shouldBe(elBackground, 'validColor'); |
96 // Make the value dirty by deleting the last character. | 96 // Make the value dirty by deleting the last character. |
97 el.focus(); | 97 el.focus(); |
98 el.setSelectionRange(10, 10); | 98 el.setSelectionRange(10, 10); |
99 document.execCommand('delete'); | 99 document.execCommand('delete'); |
100 el.maxLength = 5; | 100 el.maxLength = 5; |
101 shouldBe(elBackground, 'invalidColor'); | 101 shouldBe(elBackground, 'invalidColor'); |
102 el.maxLength = 10; | 102 el.maxLength = 10; |
103 shouldBe(elBackground, 'validColor'); | 103 shouldBe(elBackground, 'validColor'); |
OLD | NEW |