Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-canceling.html

Issue 2671603003: Move DIALOG element tests to html/dialog/. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-canceling.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-canceling.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-canceling.html
deleted file mode 100644
index cdf0168b9f4d18f8199d1805419060aac160e8d4..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-canceling.html
+++ /dev/null
@@ -1,106 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<style>
-#bottom {
- top: 100px;
- left: 100px;
- height: 300px;
- width: 300px;
- margin: 0;
- background: cyan;
-}
-
-#top {
- top: 150px;
- left: 150px;
- height: 200px;
- width: 200px;
- margin: 0;
- background: yellow;
-}
-</style>
-<script src="../../../resources/js-test.js"></script>
-</head>
-<body>
-<dialog id="bottom">
- <span></span>
- <div>You can't Escape when this textbox has focus: <input id="swallow-input" type="text"></div>
- <div>You can Escape even if this textbox has focus: <input id="normal-input" type="text"></div>
-</dialog>
-<dialog id="top">
- <span></span>
-</dialog>
-<script>
-description('Tests canceling modal dialogs using the Escape key. ' +
- 'To test manually, hit Escape once to see the topmost dialog turn green, ' +
- 'then once again to close it. Repeat for the remaining dialog.');
-
-function handleCancel(event) {
- this.style.background = 'green';
- this.querySelector('span').textContent = 'I blocked the cancel! Try again to close me.';
- event.preventDefault();
- this.removeEventListener('cancel', handleCancel);
-}
-
-function test() {
- bottomDialog = document.getElementById('bottom');
- bottomDialog.addEventListener('cancel', handleCancel);
-
- topDialog = document.getElementById('top');
- topDialog.addEventListener('cancel', handleCancel);
-
- normalInput = document.getElementById('normal-input');
- swallowInput = document.getElementById('swallow-input');
- swallowInput.addEventListener('keydown', function(event) {
- event.preventDefault();
- });
-
- bottomDialog.showModal();
- topDialog.showModal();
-
- if (!window.eventSender)
- return;
-
- debug('Top dialog event listener should prevent closing.');
- eventSender.keyDown("Escape");
- shouldBeTrue('topDialog.open');
- shouldBeTrue('bottomDialog.open');
-
- debug('Top dialog should close.');
- eventSender.keyDown("Escape");
- shouldBeFalse('topDialog.open');
- shouldBeTrue('bottomDialog.open');
-
- debug('Input should swallow Escape mechanism.');
- swallowInput.focus();
- eventSender.keyDown("Escape");
- eventSender.keyDown("Escape");
- eventSender.keyDown("Escape");
- shouldBeFalse('topDialog.open');
- shouldBeTrue('bottomDialog.open');
-
- normalInput.focus();
- debug('Bottom dialog event listener should prevent closing.');
- eventSender.keyDown("Escape");
- shouldBeFalse('topDialog.open');
- shouldBeTrue('bottomDialog.open');
-
- debug('Bottom dialog should close.');
- eventSender.keyDown("Escape");
- shouldBeFalse('topDialog.open');
- shouldBeFalse('bottomDialog.open');
-
- debug('Pressing Escape now should do nothing.');
- eventSender.keyDown("Escape");
- shouldBeFalse('topDialog.open');
- shouldBeFalse('bottomDialog.open');
-
- bottomDialog.remove();
- topDialog.remove();
-}
-
-test();
-</script>
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698