test_input_number_placeholder_shown.html (867B)
1 <!doctype html> 2 <title>Test for :placeholder-shown on input elements and invalid values.</title> 3 <script src="/tests/SimpleTest/SimpleTest.js"></script> 4 <script src="/tests/SimpleTest/EventUtils.js"></script> 5 <style> 6 input { 7 border: 1px solid purple; 8 } 9 input:placeholder-shown { 10 border-color: blue; 11 } 12 </style> 13 <input type="number" placeholder="foo"> 14 <script> 15 SimpleTest.waitForExplicitFinish(); 16 SimpleTest.waitForFocus(function() { 17 test(); 18 SimpleTest.finish(); 19 }); 20 21 function test() { 22 let input = document.querySelector('input'); 23 input.focus(); 24 is(getComputedStyle(input).borderLeftColor, "rgb(0, 0, 255)", 25 ":placeholder-shown should apply") 26 sendString("x"); 27 isnot(getComputedStyle(input).borderLeftColor, "rgb(0, 0, 255)", 28 ":placeholder-shown should not apply, even though the value is invalid") 29 } 30 </script>