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 /** @fileoverview Suite of tests for zoom-levels. */ | 5 /** @fileoverview Suite of tests for zoom-levels. */ |
6 cr.define('zoom_levels', function() { | 6 cr.define('zoom_levels', function() { |
7 function registerTests() { | 7 function registerTests() { |
8 suite('ZoomLevels', function() { | 8 suite('ZoomLevels', function() { |
9 /** | 9 /** |
10 * A zoom levels category created before each test. | 10 * A zoom levels category created before each test. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 * fetch. | 68 * fetch. |
69 */ | 69 */ |
70 function getRemoveButton(listContainer, index) { | 70 function getRemoveButton(listContainer, index) { |
71 return listContainer.children[index].querySelector('paper-icon-button'); | 71 return listContainer.children[index].querySelector('paper-icon-button'); |
72 } | 72 } |
73 | 73 |
74 test('empty zoom state', function() { | 74 test('empty zoom state', function() { |
75 var list = testElement.$.list; | 75 var list = testElement.$.list; |
76 assertTrue(!!list); | 76 assertTrue(!!list); |
77 assertEquals(0, list.items.length); | 77 assertEquals(0, list.items.length); |
| 78 assertEquals( |
| 79 0, testElement.shadowRoot.querySelectorAll('.list-item').length); |
| 80 assertTrue(!!testElement.$$('#empty')); |
78 }); | 81 }); |
79 | 82 |
80 test('non-empty zoom state', function() { | 83 test('non-empty zoom state', function() { |
81 browserProxy.setZoomList(zoomList); | 84 browserProxy.setZoomList(zoomList); |
82 | 85 |
83 return initPage().then(function() { | 86 return initPage().then(function() { |
84 var list = testElement.$.list; | 87 var list = testElement.$.list; |
85 assertTrue(!!list); | 88 assertTrue(!!list); |
86 assertEquals(2, list.items.length); | 89 assertEquals(2, list.items.length); |
| 90 assertFalse(!!testElement.$$('#empty')); |
| 91 assertEquals( |
| 92 2, testElement.shadowRoot.querySelectorAll('.list-item').length); |
87 | 93 |
88 var removeButton = | 94 var removeButton = |
89 getRemoveButton(testElement.$.listContainer, 0); | 95 getRemoveButton(testElement.$.listContainer, 0); |
90 assert(!!removeButton); | 96 assert(!!removeButton); |
91 MockInteractions.tap(removeButton); | 97 MockInteractions.tap(removeButton); |
92 return browserProxy.whenCalled('removeZoomLevel'); | 98 return browserProxy.whenCalled('removeZoomLevel'); |
93 }).then(function(args) { | 99 }).then(function(args) { |
94 assertEquals("http://www.google.com", args[0]); | 100 assertEquals("http://www.google.com", args[0]); |
95 }); | 101 }); |
96 }); | 102 }); |
97 }); | 103 }); |
98 } | 104 } |
99 | 105 |
100 return { | 106 return { |
101 registerTests: registerTests, | 107 registerTests: registerTests, |
102 }; | 108 }; |
103 }); | 109 }); |
OLD | NEW |