Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / date-multiple-fields / date-multiple-fields-readonly-subfield.html
blobbe4118a69df6b9f91fc4046a6291ac439c5f72f3
1 <!DOCTYPE html>
2 <body>
3 <script src="../../../resources/js-test.js"></script>
4 <script>
5 function createDateInput(min, max, value) {
6 var input = document.createElement('input');
7 input.type = 'date';
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 pseudoDay = '-webkit-datetime-edit-day-field';
26 var pseudoMonth = '-webkit-datetime-edit-month-field';
27 var pseudoYear = '-webkit-datetime-edit-year-field';
29 description('Sub-fields in input[type=date] should be read-only in some cases. This requires window.internals.');
30 debug('createDateInput argument order: min, max, value');
31 debug('');
33 debug('Year field:');
34 shouldBeFalse('isReadOnlyField(createDateInput("", "", ""), pseudoYear)');
35 shouldBeFalse('isReadOnlyField(createDateInput("2012-12-17", "", ""), pseudoYear)');
36 shouldBeFalse('isReadOnlyField(createDateInput("", "2012-12-17", ""), pseudoYear)');
37 shouldBeFalse('isReadOnlyField(createDateInput("", "", "2012-12-17"), pseudoYear)');
38 shouldBeTrue('isReadOnlyField(createDateInput("2012-01-01", "2012-12-31", ""), pseudoYear)');
39 shouldBeFalse('isReadOnlyField(createDateInput("2012-01-01", "2013-12-31", ""), pseudoYear)');
40 shouldBeTrue('isReadOnlyField(createDateInput("2012-01-01", "2012-12-31", "2012-05-30"), pseudoYear)');
41 shouldBeFalse('isReadOnlyField(createDateInput("2012-01-01", "2012-12-31", "2013-01-01"), pseudoYear)');
43 debug('Month field:');
44 shouldBeFalse('isReadOnlyField(createDateInput("", "", ""), pseudoMonth)');
45 shouldBeFalse('isReadOnlyField(createDateInput("2012-12-17", "", ""), pseudoMonth)');
46 shouldBeFalse('isReadOnlyField(createDateInput("", "2012-12-17", ""), pseudoMonth)');
47 shouldBeFalse('isReadOnlyField(createDateInput("", "", "2012-12-17"), pseudoMonth)');
48 shouldBeTrue('isReadOnlyField(createDateInput("2012-12-01", "2012-12-31", ""), pseudoMonth)');
49 shouldBeFalse('isReadOnlyField(createDateInput("2012-11-01", "2013-12-31", ""), pseudoMonth)');
50 shouldBeFalse('isReadOnlyField(createDateInput("2012-12-01", "2013-12-31", ""), pseudoMonth)');
51 shouldBeTrue('isReadOnlyField(createDateInput("2012-12-01", "2012-12-31", "2012-12-15"), pseudoMonth)');
52 shouldBeFalse('isReadOnlyField(createDateInput("2012-12-01", "2012-12-31", "2012-11-30"), pseudoMonth)');
54 debug('Day field:');
55 debug('We should not make all the fields readonly by min/max, so day field is always editable.');
56 shouldBeFalse('isReadOnlyField(createDateInput("", "", ""), pseudoDay)');
57 shouldBeFalse('isReadOnlyField(createDateInput("2012-12-17", "", ""), pseudoDay)');
58 shouldBeFalse('isReadOnlyField(createDateInput("", "2012-12-17", ""), pseudoDay)');
59 shouldBeFalse('isReadOnlyField(createDateInput("", "", "2012-12-17"), pseudoDay)');
60 shouldBeFalse('isReadOnlyField(createDateInput("2012-12-17", "2012-12-17", ""), pseudoDay)');
61 shouldBeFalse('isReadOnlyField(createDateInput("2012-12-17", "2013-12-18", ""), pseudoDay)');
62 shouldBeFalse('isReadOnlyField(createDateInput("2012-11-17", "2012-12-17", ""), pseudoDay)');
63 shouldBeFalse('isReadOnlyField(createDateInput("2012-12-17", "2013-12-17", ""), pseudoDay)');
64 shouldBeFalse('isReadOnlyField(createDateInput("2012-12-17", "2012-12-17", "2012-12-17"), pseudoDay)');
65 shouldBeFalse('isReadOnlyField(createDateInput("2012-12-17", "2012-12-17", "2012-12-18"), pseudoDay)');
67 </script>
68 </body>