Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / checkValidity-cancel.html
blob7100f10c08900cb3685c233031e8f059340c5561
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script>
10 description('Tests for checkValidity() with invalid event canceling');
12 var parent = document.createElement('div');
13 document.body.appendChild(parent);
14 parent.innerHTML = '<form><input name=i required></form>';
15 var form = parent.firstChild;
16 var input = form.firstChild;
18 debug('"invalid" event is not canceled.');
19 var invalidFired = false;
20 var nothingListener = {};
21 nothingListener.handleEvent = function(event) {
22 invalidFired = true;
24 shouldBeTrue('input.addEventListener("invalid", nothingListener, false); !input.checkValidity() && invalidFired');
25 shouldBeTrue('invalidFired = false; !form.checkValidity() && invalidFired');
26 input.removeEventListener('invalid', nothingListener, false);
28 debug('');
29 debug('"invalid" event is canceled.');
30 invalidFired = false;
31 var cancelListener = {};
32 cancelListener.handleEvent = function(event) {
33 invalidFired = true;
34 event.preventDefault();
36 // Even if 'invalid' is canceled, the input.checkValidity() result is still false.
37 shouldBeTrue('input.addEventListener("invalid", cancelListener, false); !input.checkValidity() && invalidFired');
38 // form.checkValidity() also should be false.
39 shouldBeTrue('invalidFired = false; !form.checkValidity() && invalidFired');
40 </script>
41 </body>
42 </html>