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

Unified Diff: chrome/test/data/webui/cr_elements/cr_dialog_test.js

Issue 2727663006: MD WebUI: change how initial focus works in <dialog>s now that they know about shadow DOM (Closed)
Patch Set: fix tests Created 3 years, 10 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
« no previous file with comments | « no previous file | ui/webui/resources/cr_elements/cr_dialog/cr_dialog.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/cr_elements/cr_dialog_test.js
diff --git a/chrome/test/data/webui/cr_elements/cr_dialog_test.js b/chrome/test/data/webui/cr_elements/cr_dialog_test.js
index fa617c543d471d8521e8107352035dd3501bd0a0..5f9c1b1fa3be8f5c9797990b7e55b255bc72d60d 100644
--- a/chrome/test/data/webui/cr_elements/cr_dialog_test.js
+++ b/chrome/test/data/webui/cr_elements/cr_dialog_test.js
@@ -14,13 +14,16 @@ suite('cr-dialog', function() {
<div class="body"><button>button</button></div>
</dialog>`;
- assertFalse(document.activeElement.matches('div.title'));
- assertFalse(document.activeElement.matches('button'));
+ var dialog = document.body.querySelector('dialog');
+ var button = document.body.querySelector('button');
- document.body.querySelector('dialog').showModal();
+ assertNotEquals(dialog, document.activeElement);
+ assertNotEquals(button, document.activeElement);
- expectTrue(document.activeElement.matches('div.title'));
- expectFalse(document.activeElement.matches('button'));
+ dialog.showModal();
+
+ expectEquals(dialog, document.activeElement);
+ expectNotEquals(button, document.activeElement);
});
test('focuses [autofocus] instead of title when present', function() {
@@ -30,12 +33,15 @@ suite('cr-dialog', function() {
<div class="body"><button autofocus>button</button></div>
</dialog>`;
- assertFalse(document.activeElement.matches('button'));
- assertFalse(document.activeElement.matches('div.title'));
+ var dialog = document.body.querySelector('dialog');
+ var button = document.body.querySelector('button');
+
+ assertNotEquals(dialog, document.activeElement);
+ assertNotEquals(button, document.activeElement);
- document.body.querySelector('dialog').showModal();
+ dialog.showModal();
- expectTrue(document.activeElement.matches('button'));
- expectFalse(document.activeElement.matches('div.title'));
+ expectNotEquals(dialog, document.activeElement);
+ expectEquals(button, document.activeElement);
});
});
« no previous file with comments | « no previous file | ui/webui/resources/cr_elements/cr_dialog/cr_dialog.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698