4 <script src=
"../../../resources/js-test.js"></script>
5 <script src=
"../resources/common.js"></script>
9 description('Checks incomplete datetime formats are rejected.');
11 var input
= document
.createElement('input');
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
22 input
.value
= '1999-07-31';
24 debug('Valid format');
25 setDateTimeFormat("dd-MM-yyyy");
26 shouldBeEqualToString('getUserAgentShadowTextContent(input)', '31-07-1999');
28 debug("Invalid format, fallback to yyyy-MM-dd");
29 setDateTimeFormat('yyyy-MM');
30 shouldBeEqualToString('getUserAgentShadowTextContent(input)', '1999-07-31');
31 setDateTimeFormat('MM/dd');
32 shouldBeEqualToString('getUserAgentShadowTextContent(input)', '1999-07-31');
33 setDateTimeFormat('dd-yyyy');
34 shouldBeEqualToString('getUserAgentShadowTextContent(input)', '1999-07-31');