Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / datetimelocal-multiple-fields / datetimelocal-multiple-fields-fallback-format.html
blob383434d05f2c01ae971d3fb7748ce9a035e83876
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 <script src="../resources/common.js"></script>
6 </head>
7 <body>
8 <script>
9 description('Checks incomplete datetime formats are rejected.');
11 var input = document.createElement('input');
12 input.type = 'datetime-local';
13 document.body.appendChild(input);
15 function setDateTimeFormat(pattern) {
16 var value = input.value;
17 getElementByPseudoId(internals.youngestShadowRoot(input), '-webkit-datetime-edit').setAttribute('pattern', pattern);
18 input.value = ''; // Updates the element for new format
19 input.value = value;
22 input.value = '1999-07-31T23:59';
24 debug('Valid format');
25 setDateTimeFormat("yyyy-MM-dd hh:mm a");
26 shouldBeEqualToString('getUserAgentShadowTextContent(input)', '1999-07-31 11:59 PM');
28 debug("Invalid format, fallback to yyyy-MM-dd'T'HH:mm");
29 setDateTimeFormat('yyyy-MM-dd');
30 shouldBeEqualToString('getUserAgentShadowTextContent(input)', '1999-07-31T23:59');
31 setDateTimeFormat('HH:mm');
32 shouldBeEqualToString('getUserAgentShadowTextContent(input)', '1999-07-31T23:59');
33 setDateTimeFormat("yyyy-MM-dd'T'hh:mm");
34 shouldBeEqualToString('getUserAgentShadowTextContent(input)', '1999-07-31T23:59');
36 </script>
37 </body>
38 </html>