OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 <style> | 5 <style> |
6 :invalid { | 6 :invalid { |
7 background-color: #ff0000; | 7 background-color: #ff0000; |
8 } | 8 } |
9 </style> | 9 </style> |
10 </head> | 10 </head> |
(...skipping 28 matching lines...) Expand all Loading... |
39 shouldNotBe('colorOf(number)', 'invalidStyleColor'); | 39 shouldNotBe('colorOf(number)', 'invalidStyleColor'); |
40 shouldBeFalse('number.validity.badInput'); | 40 shouldBeFalse('number.validity.badInput'); |
41 shouldBeEqualToString('number.value', '-1'); | 41 shouldBeEqualToString('number.value', '-1'); |
42 | 42 |
43 debug("Type 'a' additionally. The element becomes badInput again."); | 43 debug("Type 'a' additionally. The element becomes badInput again."); |
44 document.execCommand('InsertText', false, 'a'); | 44 document.execCommand('InsertText', false, 'a'); |
45 shouldBe('colorOf(number)', 'invalidStyleColor'); | 45 shouldBe('colorOf(number)', 'invalidStyleColor'); |
46 shouldBeTrue('number.validity.badInput'); | 46 shouldBeTrue('number.validity.badInput'); |
47 shouldBeEqualToString('number.value', ''); | 47 shouldBeEqualToString('number.value', ''); |
48 | 48 |
49 debug("The element looses focus. The element state should not be changed."); | 49 debug("The element losts focus. The element state should not be changed."); |
50 document.getElementById('another').focus(); | 50 document.getElementById('another').focus(); |
51 shouldBe('colorOf(number)', 'invalidStyleColor'); | 51 shouldBe('colorOf(number)', 'invalidStyleColor'); |
52 shouldBeTrue('number.validity.badInput'); | 52 shouldBeTrue('number.validity.badInput'); |
53 // Visible value is '-1a'. | 53 // Visible value is '-1a'. |
54 number.focus(); | 54 number.focus(); |
55 document.execCommand('SelectAll'); | 55 document.execCommand('SelectAll'); |
56 shouldBeEqualToString('document.getSelection().toString()', '-1a'); | 56 shouldBeEqualToString('document.getSelection().toString()', '-1a'); |
57 shouldBeEqualToString('number.value', ''); | 57 shouldBeEqualToString('number.value', ''); |
58 | 58 |
59 debug("The element looses renderer. The element state should not be changed."); | 59 debug("The element losts a renderer. The element state should not be changed."); |
60 shouldBeTrue('number.style.display = "none"; number.validity.badInput'); | 60 shouldBeTrue('number.style.display = "none"; number.validity.badInput'); |
61 | 61 |
62 number.style.display = 'inline-block'; | 62 number.style.display = 'inline-block'; |
63 number.focus(); | 63 number.focus(); |
64 debug('A bad input should be cleared by value="".'); | 64 debug('A bad input should be cleared by value="".'); |
65 shouldBeEqualToString('number.value = ""; document.execCommand("SelectAll"); doc
ument.getSelection().toString()', ''); | 65 shouldBeEqualToString('number.value = ""; document.execCommand("SelectAll"); doc
ument.getSelection().toString()', ''); |
66 | 66 |
67 debug('badInput and checkValidty() should be updated by value= "some valid numbe
r"'); | |
68 number.focus(); | |
69 debug('Type some text (invalid input)'); | |
70 document.execCommand('InsertText', false, 'g'); | |
71 shouldBeTrue('number.validity.badInput'); | |
72 shouldBeFalse('number.checkValidity()'); | |
73 debug('Now set a valid value'); | |
74 number.value = '1'; | |
75 shouldBeFalse('number.validity.badInput'); | |
76 shouldBeTrue('number.checkValidity()'); | |
77 | |
78 document.getElementById('parent').innerHTML = ''; | 67 document.getElementById('parent').innerHTML = ''; |
79 </script> | 68 </script> |
80 </body> | 69 </body> |
81 </html> | 70 </html> |
OLD | NEW |