OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> |
| 3 <title>Fieldset disabled</title> |
| 4 <link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org"> |
| 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-fieldset-elem
ent"> |
| 6 <script src="../../../../../../resources/testharness.js"></script> |
| 7 <script src="../../../../../../resources/testharnessreport.js"></script> |
| 8 <div id="log"></div> |
| 9 <form> |
| 10 <fieldset id=fs disabled> |
| 11 <legend> |
| 12 <input type=checkbox id=clubc_l1> |
| 13 <input type=radio id=clubr_l1> |
| 14 <input type=text id=clubt_l1> |
| 15 </legend> |
| 16 <legend><input type=checkbox id=club_l2></legend> |
| 17 <p><label>Name on card: <input id=clubname required></label></p> |
| 18 <p><label>Card number: <input id=clubnum required pattern="[-0-9]+"></label>
</p> |
| 19 </fieldset> |
| 20 <fieldset id=fs2 disabled> |
| 21 <p><legend><input type=checkbox id=club2></legend></p> |
| 22 <p><label>Name on card: <input id=clubname2 required></label></p> |
| 23 <p><label>Card number: <input id=clubnum2 required pattern="[-0-9]+"></label
></p> |
| 24 </fieldset> |
| 25 <fieldset id=fs3 disabled> |
| 26 <fieldset> |
| 27 <legend><input type=checkbox id=club3></legend> |
| 28 </fieldset> |
| 29 <p><label>Name on card: <input id=clubname3 required></label></p> |
| 30 <p><label>Card number: <input id=clubnum3 required pattern="[-0-9]+"></label
></p> |
| 31 </fieldset> |
| 32 <fieldset id=fs4 disabled> |
| 33 <legend> |
| 34 <fieldset><input type=checkbox id=club4></fieldset> |
| 35 </legend> |
| 36 <p><label>Name on card: <input id=clubname4 required></label></p> |
| 37 <p><label>Card number: <input id=clubnum4 required pattern="[-0-9]+"></label
></p> |
| 38 </fieldset> |
| 39 </form> |
| 40 <script> |
| 41 test(function () { |
| 42 assert_true(document.getElementById('fs').disabled, "The fieldset is disable
d"); |
| 43 assert_false(document.getElementById('clubname').willValidate, "fieldset is
disabled so is input 'clubname'"); |
| 44 assert_false(document.getElementById('clubnum').willValidate, "fieldset is d
isabled so is input 'clubnum'"); |
| 45 assert_true(document.getElementById('clubc_l1').willValidate, "input 'clubc_
l1' is descendant of the first legend child of the fieldset. It should not be di
sabled"); |
| 46 assert_true(document.getElementById('clubr_l1').willValidate, "input 'clubr_
l1' is descendant of the first legend child of the fieldset. It should not be di
sabled"); |
| 47 assert_true(document.getElementById('clubt_l1').willValidate, "input 'clubt_
l1' is descendant of the first legend child of the fieldset. It should not be di
sabled"); |
| 48 assert_false(document.getElementById('club_l2').willValidate, "input 'club_l
2' is a descendant of the second legend child of the fieldset. It should be disa
bled"); |
| 49 }, "The disabled attribute, when specified, causes all the form control descen
dants of the fieldset element, excluding those that are descendants of the field
set element's first legend element child, if any, to be disabled."); |
| 50 |
| 51 test(function () { |
| 52 assert_true(document.getElementById('fs2').disabled, "The fieldset is disabl
ed"); |
| 53 assert_false(document.getElementById('clubname2').willValidate, "fieldset is
disabled so is input 'clubname2'"); |
| 54 assert_false(document.getElementById('clubnum2').willValidate, "fieldset is
disabled so is input 'clubnum2'"); |
| 55 assert_false(document.getElementById('club2').willValidate, "the first legen
d is not a child of the disbled fieldset: input 'club2' is disabled"); |
| 56 }, "The first 'legend' element is not a child of the disabled fieldset: Its de
scendants should be disabled."); |
| 57 |
| 58 test(function () { |
| 59 assert_true(document.getElementById('fs3').disabled, "The fieldset is disabl
ed"); |
| 60 assert_false(document.getElementById('clubname3').willValidate, "fieldset is
disabled so is input 'clubname3'"); |
| 61 assert_false(document.getElementById('clubnum3').willValidate, "fieldset is
disabled so is input 'clubnum3'"); |
| 62 assert_false(document.getElementById('club3').willValidate, "the first legen
d is not a child of the disbled fieldset: input 'club3' is disabled"); |
| 63 }, "The <legend> element is not a child of the disabled fieldset: Its descenda
nts should be disabled."); |
| 64 |
| 65 test(function () { |
| 66 assert_true(document.getElementById('fs4').disabled, "The fieldset is disabl
ed"); |
| 67 assert_false(document.getElementById('clubname4').willValidate, "fieldset is
disabled so is input 'clubname4'"); |
| 68 assert_false(document.getElementById('clubnum4').willValidate, "fieldset is
disabled so is input 'clubnum4'"); |
| 69 assert_true(document.getElementById('club4').willValidate, "the first legend
a child of the disbled fieldset: input 'club4' is disabled"); |
| 70 }, "The <legend> element is child of the disabled fieldset: Its descendants sh
ould be disabled."); |
| 71 </script> |
OLD | NEW |