Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 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 /** @type {HTMLDialogElement} */ var dialog; | |
| 7 /** @type {HTMLElement} */ var title; | |
| 8 | |
| 9 setup(function() { | |
| 10 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.
| |
| 11 | |
| 12 title = document.createElement('div'); | |
| 13 title.classList.add('title'); | |
| 14 title.textContent = 'An Amazing Title!'; | |
| 15 | |
| 16 dialog = document.createElement('dialog', 'cr-dialog'); | |
| 17 dialog.appendChild(title); | |
| 18 document.body.appendChild(dialog); | |
| 19 }); | |
| 20 | |
| 21 test('focuses title on show', function() { | |
| 22 assertNotEquals(document.activeElement, title); | |
| 23 dialog.showModal(); | |
| 24 expectEquals(title.tabIndex, -1); | |
| 25 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.
| |
| 26 }); | |
| 27 }); | |
| OLD | NEW |