1 description('Tests that we find controls if they have a range limitation and are out-of-range.');
3 var parentDiv = document.createElement('div');
4 document.body.appendChild(parentDiv);
5 parentDiv.innerHTML = '<input id="number1" type="number" min=0 max=10 value=50><input id="date1" type="date" min="2010-12-28" max="2010-12-30" value="2011-01-01"><input id="text1" type="text" min=0 max=10 value=50><input id="checkbox1" type="checkbox"><input id="radio1" type="radio">';
7 shouldBe('document.querySelector("input[type=number]:out-of-range").id', '"number1"');
8 shouldBe('document.querySelector("input[type=date]:out-of-range").id', '"date1"');
9 shouldBe('document.querySelectorAll(":out-of-range").length', '2');
12 debug("When the value becomes in-range dynamically, we do not find the control anymore");
13 document.getElementById("number1").value = 5;
14 document.getElementById("date1").value = "2010-12-28";
16 shouldBe('document.querySelector("input[type=number]:out-of-range")', 'null');
17 shouldBe('document.querySelector("input[type=date]:out-of-range")', 'null');
18 shouldBe('document.querySelectorAll(":out-of-range").length', '0');