Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / week-multiple-fields / week-multiple-fields-readonly-subfield.html
blob5d8c09d2d01ecefbc4af810d788bfb15f62554da
1 <!DOCTYPE html>
2 <body>
3 <script src="../../../resources/js-test.js"></script>
4 <script>
5 function createWeekInput(min, max, value) {
6 var input = document.createElement('input');
7 input.type = 'week';
8 if (min)
9 input.min = min;
10 if (max)
11 input.max = max;
12 if (value)
13 input.value = value;
14 return input;
17 // FIXME: Rename this function and the test file.
18 function isReadOnlyField(input, pseudo) {
19 var node = internals.youngestShadowRoot(input).querySelector('*[pseudo="' + pseudo + '"]');
20 if (!node)
21 testFailed('Requested node is missing.');
22 return node && node.hasAttribute('disabled');
25 var pseudoWeek = '-webkit-datetime-edit-week-field';
26 var pseudoYear = '-webkit-datetime-edit-year-field';
28 description('Sub-fields in input[type=week] should be read-only in some cases. This requires window.internals.');
29 debug('createWeekInput argument order: min, max, value');
30 debug('');
32 debug('Year field:');
33 shouldBeFalse('isReadOnlyField(createWeekInput("", "", ""), pseudoYear)');
34 shouldBeFalse('isReadOnlyField(createWeekInput("2012-W50", "", ""), pseudoYear)');
35 shouldBeFalse('isReadOnlyField(createWeekInput("", "2012-W50", ""), pseudoYear)');
36 shouldBeFalse('isReadOnlyField(createWeekInput("", "", "2012-W50"), pseudoYear)');
37 shouldBeTrue('isReadOnlyField(createWeekInput("2012-W01", "2012-W50", ""), pseudoYear)');
38 shouldBeFalse('isReadOnlyField(createWeekInput("2012-W01", "2013-W50", ""), pseudoYear)');
39 shouldBeTrue('isReadOnlyField(createWeekInput("2012-W01", "2012-W50", "2012-W05"), pseudoYear)');
40 shouldBeFalse('isReadOnlyField(createWeekInput("2012-W01", "2012-W50", "2013-W01"), pseudoYear)');
42 debug('Week field:');
43 debug('We should not make all the fields readonly by min/max, so week field is always editable.');
44 shouldBeFalse('isReadOnlyField(createWeekInput("", "", ""), pseudoWeek)');
45 shouldBeFalse('isReadOnlyField(createWeekInput("2012-W50", "", ""), pseudoWeek)');
46 shouldBeFalse('isReadOnlyField(createWeekInput("", "2012-W50", ""), pseudoWeek)');
47 shouldBeFalse('isReadOnlyField(createWeekInput("", "", "2012-W50"), pseudoWeek)');
48 shouldBeFalse('isReadOnlyField(createWeekInput("2012-W50", "2012-W50", ""), pseudoWeek)');
49 shouldBeFalse('isReadOnlyField(createWeekInput("2012-W49", "2013-W50", ""), pseudoWeek)');
50 shouldBeFalse('isReadOnlyField(createWeekInput("2012-W50", "2013-W50", ""), pseudoWeek)');
51 shouldBeFalse('isReadOnlyField(createWeekInput("2012-W50", "2012-W50", "2012-W50"), pseudoWeek)');
52 shouldBeFalse('isReadOnlyField(createWeekInput("2012-W50", "2012-W50", "2012-W49"), pseudoWeek)');
54 </script>
55 </body>