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

Side by Side Diff: chrome/test/data/webui/cr_elements/cr_dialog_test.js

Issue 2700063002: MD Settings: focus header when dialog shows to signal to AT what's going on (Closed)
Patch Set: dpapad@ review 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
dpapad 2017/02/24 20:46:10 Nit: 2017
Dan Beam 2017/02/24 22:08:31 Acknowledged.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 suite('cr-dialog', function() {
6 setup(function() {
7 PolymerTest.clearBody();
8 });
9
10 test('focuses title on show', function() {
11 document.body.innerHTML = `
12 <dialog is="cr-dialog">
13 <div class="title">title</div>
14 <div class="body"><button>button</button></div>
15 </dialog>`;
16
17 assertFalse(document.activeElement.matches('div.title'));
18 assertFalse(document.activeElement.matches('button'));
19
20 document.body.querySelector('dialog').showModal();
21
22 expectTrue(document.activeElement.matches('div.title'));
dpapad 2017/02/24 20:46:10 I am not asking you to replace expects with assert
Dan Beam 2017/02/24 22:08:31 they're different.
23 expectFalse(document.activeElement.matches('button'));
24 });
25
26 test('focuses [autofocus] instead of title when present', function() {
27 document.body.innerHTML = `
28 <dialog is="cr-dialog">
29 <div class="title">title</div>
30 <div class="body"><button autofocus>button</button></div>
31 </dialog>`;
32
33 assertFalse(document.activeElement.matches('button'));
34 assertFalse(document.activeElement.matches('div.title'));
35
36 document.body.querySelector('dialog').showModal();
37
38 expectTrue(document.activeElement.matches('button'));
39 expectFalse(document.activeElement.matches('div.title'));
40 });
41 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698