Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..801c0e8c3c1f451e864bdfaa5647e371b5566484 |
| --- /dev/null |
| +++ b/chrome/test/data/webui/cr_elements/cr_dialog_test.js |
| @@ -0,0 +1,27 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +suite('cr-dialog', function() { |
| + /** @type {HTMLDialogElement} */ var dialog; |
| + /** @type {HTMLElement} */ var title; |
| + |
| + setup(function() { |
| + PolymerTest.clearBody(); |
|
dpapad
2017/02/23 18:28:35
Nit: You could also do what we do at https://cs.ch
Dan Beam
2017/02/24 05:43:09
Done.
|
| + |
| + title = document.createElement('div'); |
| + title.classList.add('title'); |
| + title.textContent = 'An Amazing Title!'; |
| + |
| + dialog = document.createElement('dialog', 'cr-dialog'); |
| + dialog.appendChild(title); |
| + document.body.appendChild(dialog); |
| + }); |
| + |
| + test('focuses title on show', function() { |
| + assertNotEquals(document.activeElement, title); |
| + dialog.showModal(); |
| + expectEquals(title.tabIndex, -1); |
| + expectEquals(document.activeElement, title); |
|
dpapad
2017/02/23 18:28:35
Can we add one more test for a dialog that has an
Dan Beam
2017/02/24 05:43:09
Done.
|
| + }); |
| +}); |