Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / datetimelocal-multiple-fields / datetimelocal-multiple-fields-readonly-subfield.html
blobca86145265c9b2cd33696ca831eaa0cf34cae0b2
1 <!DOCTYPE html>
2 <body>
3 <script src="../../../resources/js-test.js"></script>
4 <script>
5 function createInput(min, max, step, value) {
6 var input = document.createElement('input');
7 input.type = 'datetime-local';
8 if (min)
9 input.min = min;
10 if (max)
11 input.max = max;
12 if (step)
13 input.step = step;
14 if (value)
15 input.value = value;
16 return input;
19 // FIXME: Rename this function and the test file.
20 function isReadOnlyField(input, pseudo) {
21 var node = internals.youngestShadowRoot(input).querySelector('*[pseudo="' + pseudo + '"]');
22 if (!node)
23 testFailed('Requested node is missing.');
24 return node && node.hasAttribute('disabled');
27 var pseudoMinute = '-webkit-datetime-edit-minute-field';
28 var pseudoHour = '-webkit-datetime-edit-hour-field';
29 var pseudoAMPM = '-webkit-datetime-edit-ampm-field';
30 var step1day = '86400';
31 var step1min = '60';
33 description('Sub-fields in input[type=datetime-local] should be read-only in some cases. This requires window.internals.');
34 debug('createInput argument order: min, max, step, value');
35 debug('');
37 debug('Hour field:');
38 shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:00", "", step1day, ""), pseudoHour)');
39 shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:00", "", step1day, ""), pseudoAMPM)');
40 shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:00", "", step1day, ""), pseudoMinute)');
42 shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T11:30"), pseudoHour)');
43 shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T11:30"), pseudoAMPM)');
44 shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T11:30"), pseudoMinute)');
46 shouldBeFalse('isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T12:30"), pseudoHour)');
47 shouldBeFalse('isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T12:30"), pseudoAMPM)');
48 shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:30", "", step1day, "2013-01-16T12:30"), pseudoMinute)');
50 shouldBeFalse('isReadOnlyField(createInput("2013-01-16T00:00", "", step1day, "2013-01-16T12:30"), pseudoHour)');
51 shouldBeFalse('isReadOnlyField(createInput("2013-01-16T00:00", "", step1day, "2013-01-16T12:30"), pseudoAMPM)');
52 shouldBeFalse('isReadOnlyField(createInput("2013-01-16T00:00", "", step1day, "2013-01-16T12:30"), pseudoMinute)');
54 shouldBeFalse('isReadOnlyField(createInput("2013-01-16T11:00", "2013-01-16T23:00", step1day, ""), pseudoHour)');
55 shouldBeFalse('isReadOnlyField(createInput("2013-01-16T11:00", "2013-01-16T23:00", step1day, ""), pseudoAMPM)');
56 shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:00", "2013-01-16T23:00", step1day, ""), pseudoMinute)');
58 shouldBeFalse('isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T23:00", step1day, "2013-01-16T11:30"), pseudoHour)');
59 shouldBeFalse('isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T23:00", step1day, "2013-01-16T11:30"), pseudoAMPM)');
60 shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T23:00", step1day, "2013-01-16T11:30"), pseudoMinute)');
62 shouldBeFalse('isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T11:59", step1day, "2013-01-16T11:30"), pseudoHour)');
63 shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T11:59", step1day, "2013-01-16T11:30"), pseudoAMPM)');
64 shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T11:59", step1day, "2013-01-16T11:30"), pseudoMinute)');
66 shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T11:59", step1min, ""), pseudoHour)');
67 shouldBeTrue('isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T11:59", step1min, ""), pseudoAMPM)');
68 shouldBeFalse('isReadOnlyField(createInput("2013-01-16T11:30", "2013-01-16T11:59", step1min, ""), pseudoMinute)');
70 debug('AM/PM field:');
71 shouldBeTrue('isReadOnlyField(createInput("2013-01-16T08:00", "2013-01-16T11:00", step1min, ""), pseudoAMPM)');
72 shouldBeFalse('isReadOnlyField(createInput("2013-01-16T08:00", "2013-01-17T11:00", step1min, ""), pseudoAMPM)');
74 </script>
75 </body>