| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 suite('cr-dialog', function() { | 5 suite('cr-dialog', function() { |
| 6 setup(function() { | 6 setup(function() { |
| 7 PolymerTest.clearBody(); | 7 PolymerTest.clearBody(); |
| 8 }); | 8 }); |
| 9 | 9 |
| 10 test('focuses title on show', function() { | 10 test('focuses title on show', function() { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 var button = document.body.querySelector('button'); | 37 var button = document.body.querySelector('button'); |
| 38 | 38 |
| 39 assertNotEquals(dialog, document.activeElement); | 39 assertNotEquals(dialog, document.activeElement); |
| 40 assertNotEquals(button, document.activeElement); | 40 assertNotEquals(button, document.activeElement); |
| 41 | 41 |
| 42 dialog.showModal(); | 42 dialog.showModal(); |
| 43 | 43 |
| 44 expectNotEquals(dialog, document.activeElement); | 44 expectNotEquals(dialog, document.activeElement); |
| 45 expectEquals(button, document.activeElement); | 45 expectEquals(button, document.activeElement); |
| 46 }); | 46 }); |
| 47 |
| 48 test('dialog body indicates over-scroll when appropriate', function() { |
| 49 document.body.innerHTML = ` |
| 50 <dialog is="cr-dialog" show-scroll-borders> |
| 51 <div class="title">title</div> |
| 52 <div class="body">body</div> |
| 53 </dialog>`; |
| 54 |
| 55 var dialog = document.body.querySelector('dialog'); |
| 56 var innerBody = document.body.querySelector('.body'); |
| 57 var bodyContainer = dialog.$$('.body-container'); |
| 58 assertTrue(!!bodyContainer); |
| 59 |
| 60 // Height is normally set via CSS, but mixin doesn't work with innerHTML. |
| 61 bodyContainer.style.height = '1px'; |
| 62 innerBody.style.height = '100px'; |
| 63 dialog.showModal(); |
| 64 |
| 65 return PolymerTest.flushTasks() |
| 66 .then(function() { |
| 67 assertTrue(bodyContainer.classList.contains('bottom-scrollable')); |
| 68 bodyContainer.scrollTop = 100; |
| 69 return PolymerTest.flushTasks(); |
| 70 }) |
| 71 .then(function() { |
| 72 assertFalse(bodyContainer.classList.contains('bottom-scrollable')); |
| 73 }); |
| 74 }); |
| 47 }); | 75 }); |
| OLD | NEW |