OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> |
| 3 <title>HTML Test: labelable elements</title> |
| 4 <link rel="author" title="Intel" href="http://www.intel.com/"> |
| 5 <script src="../../../../../../resources/testharness.js"></script> |
| 6 <script src="../../../../../../resources/testharnessreport.js"></script> |
| 7 <div id="log"></div> |
| 8 <form style="display:none"> |
| 9 <output id="testoutput"></output> |
| 10 <label id="lbl0" for="testoutput"></label> |
| 11 <progress id="testprogress"></progress> |
| 12 <label id="lbl1" for="testprogress"></label> |
| 13 <select id="testselect"></select> |
| 14 <label id="lbl2" for="testselect"></label> |
| 15 <textarea id="testarea"></textarea> |
| 16 <label id="lbl3" for="testarea"></label> |
| 17 <button id="testButton"></button> |
| 18 <label id="lbl4" for="testButton"></label> |
| 19 <input type="hidden" id="testHidden"> |
| 20 <label id="lbl5" for="testHidden"></label> |
| 21 <input type="radio" id="testRadio"> |
| 22 <label id="lbl6" for="testRadio"></label> |
| 23 <keygen id="testkeygen"> |
| 24 <label id="lbl7" for="testkeygen"></label> |
| 25 <meter id="testmeter"></meter> |
| 26 <label id="lbl8" for="testmeter"></label> |
| 27 |
| 28 <fieldset id="testfieldset"></fieldset> |
| 29 <label id="lbl9" for="testfieldset"></label> |
| 30 <label id="testlabel"></label> |
| 31 <label id="lbl10" for="testlabel"></label> |
| 32 <object id="testobject"></object> |
| 33 <label id="lbl11" for="testobject"></label> |
| 34 <img id="testimg"> |
| 35 <label id="lbl12" for="testimg"></label> |
| 36 </form> |
| 37 |
| 38 <script> |
| 39 |
| 40 test(function() { |
| 41 assert_equals(document.getElementById("lbl0").control.id, "testoutput", "An ou
tput element should be labelable."); |
| 42 }, "Check if the output element is a labelable element"); |
| 43 |
| 44 test(function() { |
| 45 assert_equals(document.getElementById("lbl1").control.id, "testprogress", "A p
rogress element should be labelable."); |
| 46 }, "Check if the progress element is a labelable element"); |
| 47 |
| 48 test(function() { |
| 49 assert_equals(document.getElementById("lbl2").control.id, "testselect", "A sel
ect element should be labelable."); |
| 50 }, "Check if the select element is a labelable element"); |
| 51 |
| 52 test(function() { |
| 53 assert_equals(document.getElementById("lbl3").control.id, "testarea", "A texta
rea element should be labelable."); |
| 54 }, "Check if the textarea element is a labelable form-element"); |
| 55 |
| 56 test(function() { |
| 57 assert_equals(document.getElementById("lbl4").control.id, "testButton", "A but
ton element should be labelable."); |
| 58 }, "Check if the button element is a labelable element"); |
| 59 |
| 60 test(function() { |
| 61 assert_equals(document.getElementById("lbl5").control, null, "An input element
in hidden state should not be labelable."); |
| 62 }, "Check if the hidden input element is not a labelable element."); |
| 63 |
| 64 test(function() { |
| 65 assert_equals(document.getElementById("lbl6").control.id, "testRadio", "An inp
ut element in radio state should be labelable."); |
| 66 }, "Check if the input element in radio state is a labelable element"); |
| 67 |
| 68 test(function() { |
| 69 assert_equals(document.getElementById("lbl7").control.id, "testkeygen", "A key
gen element should be labelable."); |
| 70 }, "Check if the keygen element is a labelable element"); |
| 71 |
| 72 test(function() { |
| 73 assert_equals(document.getElementById("lbl8").control.id, "testmeter", "A mete
r element should be labelable."); |
| 74 }, "Check if the meter element is a labelable element"); |
| 75 |
| 76 test(function() { |
| 77 assert_not_equals(document.getElementById("lbl9").control, document.getElement
ById("testfieldset")); |
| 78 assert_equals(document.getElementById("lbl9").control, null, "A fieldset eleme
nt should not be labelable."); |
| 79 }, "Check if the fieldset element is not a labelable element"); |
| 80 |
| 81 test(function() { |
| 82 assert_not_equals(document.getElementById("lbl9").control, document.getElement
ById("testlabel")); |
| 83 assert_equals(document.getElementById("lbl10").control, null, "A label element
should not be labelable."); |
| 84 }, "Check if the label element is not a labelable element"); |
| 85 |
| 86 test(function() { |
| 87 assert_not_equals(document.getElementById("lbl9").control, document.getElement
ById("testobject")); |
| 88 assert_equals(document.getElementById("lbl11").control, null, "An object eleme
nt should not be labelable."); |
| 89 }, "Check if the object element is not a labelable element"); |
| 90 |
| 91 test(function() { |
| 92 assert_not_equals(document.getElementById("lbl9").control, document.getElement
ById("testimg")); |
| 93 assert_equals(document.getElementById("lbl12").control, null, "An img element
should not be labelable."); |
| 94 }, "Check if the img element is not a labelable element"); |
| 95 |
| 96 </script> |
OLD | NEW |