| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 media-router-header. */ | 5 /** @fileoverview Suite of tests for media-router-header. */ |
| 6 cr.define('media_router_header', function() { | 6 cr.define('media_router_header', function() { |
| 7 function registerTests() { | 7 function registerTests() { |
| 8 suite('MediaRouterHeader', function() { | 8 suite('MediaRouterHeader', function() { |
| 9 /** | 9 /** |
| 10 * Media Router Header created before each test. | 10 * Media Router Header created before each test. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 header.view = media_router.MediaRouterView.FILTER; | 141 header.view = media_router.MediaRouterView.FILTER; |
| 142 MockInteractions.tap(header.$['header-text']); | 142 MockInteractions.tap(header.$['header-text']); |
| 143 header.view = media_router.MediaRouterView.ISSUE; | 143 header.view = media_router.MediaRouterView.ISSUE; |
| 144 MockInteractions.tap(header.$['header-text']); | 144 MockInteractions.tap(header.$['header-text']); |
| 145 header.view = media_router.MediaRouterView.ROUTE_DETAILS; | 145 header.view = media_router.MediaRouterView.ROUTE_DETAILS; |
| 146 MockInteractions.tap(header.$['header-text']); | 146 MockInteractions.tap(header.$['header-text']); |
| 147 done(); | 147 done(); |
| 148 }); | 148 }); |
| 149 | 149 |
| 150 // Tests for 'header-height-changed' event firing when the header changes | 150 // Tests for 'header-height-changed' event firing when the header changes |
| 151 // if email is shown. | 151 // and the email is shown. |
| 152 test('header height changed with email shown', function(done) { | 152 test('header height changed with email shown', function(done) { |
| 153 header.addEventListener('header-height-changed', function() { | 153 header.addEventListener('header-height-changed', function() { |
| 154 assertEquals(header.headerWithEmailHeight_, header.offsetHeight); |
| 154 done(); | 155 done(); |
| 155 }); | 156 }); |
| 156 header.userEmail = 'user@example.com'; | 157 header.userEmail = 'user@example.com'; |
| 157 header.showEmail = true; | 158 header.showEmail = true; |
| 158 }); | 159 }); |
| 159 | 160 |
| 161 // Test for 'header-height-changed' event firing when the header changes |
| 162 // and the email is not shown. |
| 163 test('header height changed without email shown', function(done) { |
| 164 header.userEmail = 'user@example.com'; |
| 165 header.showEmail = true; |
| 166 setTimeout(function() { |
| 167 header.addEventListener('header-height-changed', function() { |
| 168 assertEquals(header.headerWithoutEmailHeight_, header.offsetHeight); |
| 169 done(); |
| 170 }); |
| 171 header.showEmail = false; |
| 172 }); |
| 173 }); |
| 174 |
| 160 // Tests the |computeArrowDropIcon_| function. | 175 // Tests the |computeArrowDropIcon_| function. |
| 161 test('compute arrow drop icon', function() { | 176 test('compute arrow drop icon', function() { |
| 162 assertEquals('arrow-drop-up', | 177 assertEquals('arrow-drop-up', |
| 163 header.computeArrowDropIcon_( | 178 header.computeArrowDropIcon_( |
| 164 media_router.MediaRouterView.CAST_MODE_LIST)); | 179 media_router.MediaRouterView.CAST_MODE_LIST)); |
| 165 assertEquals('arrow-drop-down', | 180 assertEquals('arrow-drop-down', |
| 166 header.computeArrowDropIcon_( | 181 header.computeArrowDropIcon_( |
| 167 media_router.MediaRouterView.FILTER)); | 182 media_router.MediaRouterView.FILTER)); |
| 168 assertEquals('arrow-drop-down', | 183 assertEquals('arrow-drop-down', |
| 169 header.computeArrowDropIcon_( | 184 header.computeArrowDropIcon_( |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 done(); | 245 done(); |
| 231 }); | 246 }); |
| 232 }); | 247 }); |
| 233 }); | 248 }); |
| 234 } | 249 } |
| 235 | 250 |
| 236 return { | 251 return { |
| 237 registerTests: registerTests, | 252 registerTests: registerTests, |
| 238 }; | 253 }; |
| 239 }); | 254 }); |
| OLD | NEW |