Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 }); | |
| OLD | NEW |