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><input id="text1" type="text" min=0 max=10 value=50><input id="checkbox1" type="checkbox"><input id="radio1" type="radio">';
7 debug('==> :out-of-range doesn\'t match to an INPUT without a value:');
8 shouldBeNull('document.querySelector("input[type=number]:out-of-range")');
11 debug('==> :out-of-range should match to an INPUT with an out-of-range value:');
12 parentDiv.firstChild.value = '50';
13 shouldBe('document.querySelector("input[type=number]:out-of-range").id', '"number1"');
14 shouldBe('document.querySelectorAll(":out-of-range").length', '1');
17 debug('==> When the value becomes in-range dynamically, we do not find the control anymore:');
18 document.getElementById("number1").value = 5;
20 shouldBe('document.querySelector("input[type=number]:out-of-range")', 'null');
21 shouldBe('document.querySelectorAll(":out-of-range").length', '0');