| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 // Tests for 'back-click' event firing when the back button | 75 // Tests for 'back-click' event firing when the back button |
| 76 // is clicked. | 76 // is clicked. |
| 77 test('back button click', function(done) { | 77 test('back button click', function(done) { |
| 78 header.addEventListener('back-click', function() { | 78 header.addEventListener('back-click', function() { |
| 79 done(); | 79 done(); |
| 80 }); | 80 }); |
| 81 MockInteractions.tap(header.$['back-button']); | 81 MockInteractions.tap(header.$['back-button']); |
| 82 }); | 82 }); |
| 83 | 83 |
| 84 // Tests for 'arrow-drop-click' event firing when the arrow drop button | 84 // Tests for 'header-or-arrow-click' event firing when the arrow drop |
| 85 // is clicked. | 85 // button is clicked on the CAST_MODE_LIST view. |
| 86 test('arrow drop icon click', function(done) { | 86 test('arrow drop icon click', function(done) { |
| 87 header.addEventListener('arrow-drop-click', function() { | 87 header.view = media_router.MediaRouterView.CAST_MODE_LIST; |
| 88 header.addEventListener('header-or-arrow-click', function() { |
| 88 done(); | 89 done(); |
| 89 }); | 90 }); |
| 90 MockInteractions.tap(header.$['arrow-drop-icon']); | 91 MockInteractions.tap(header.$['arrow-drop-icon']); |
| 91 }); | 92 }); |
| 92 | 93 |
| 94 // Tests for 'header-or-arrow-click' event firing when the arrow drop |
| 95 // button is clicked on the SINK_LIST view. |
| 96 test('arrow drop icon click', function(done) { |
| 97 header.view = media_router.MediaRouterView.SINK_LIST; |
| 98 header.addEventListener('header-or-arrow-click', function() { |
| 99 done(); |
| 100 }); |
| 101 MockInteractions.tap(header.$['arrow-drop-icon']); |
| 102 }); |
| 103 |
| 104 // Tests for 'header-or-arrow-click' event firing when the header text is |
| 105 // clicked on the CAST_MODE_LIST view. |
| 106 test('header text click on cast mode list view', function(done) { |
| 107 header.view = media_router.MediaRouterView.CAST_MODE_LIST; |
| 108 header.addEventListener('header-or-arrow-click', function() { |
| 109 done(); |
| 110 }); |
| 111 MockInteractions.tap(header.$['header-text']); |
| 112 }); |
| 113 |
| 114 // Tests for 'header-or-arrow-click' event firing when the header text is |
| 115 // clicked on the SINK_LIST view. |
| 116 test('header text click on sink list view', function(done) { |
| 117 header.view = media_router.MediaRouterView.SINK_LIST; |
| 118 header.addEventListener('header-or-arrow-click', function() { |
| 119 done(); |
| 120 }); |
| 121 MockInteractions.tap(header.$['header-text']); |
| 122 }); |
| 123 |
| 124 // Tests for no event firing when the header text is clicked on certain |
| 125 // views. |
| 126 test('header text click without event firing', function(done) { |
| 127 header.addEventListener('header-or-arrow-click', function() { |
| 128 assertNotReached(); |
| 129 }); |
| 130 |
| 131 header.view = media_router.MediaRouterView.FILTER; |
| 132 MockInteractions.tap(header.$['header-text']); |
| 133 header.view = media_router.MediaRouterView.ISSUE; |
| 134 MockInteractions.tap(header.$['header-text']); |
| 135 header.view = media_router.MediaRouterView.ROUTE_DETAILS; |
| 136 MockInteractions.tap(header.$['header-text']); |
| 137 done(); |
| 138 }); |
| 139 |
| 93 // Tests the |computeArrowDropIcon_| function. | 140 // Tests the |computeArrowDropIcon_| function. |
| 94 test('compute arrow drop icon', function() { | 141 test('compute arrow drop icon', function() { |
| 95 assertEquals('arrow-drop-up', | 142 assertEquals('arrow-drop-up', |
| 96 header.computeArrowDropIcon_( | 143 header.computeArrowDropIcon_( |
| 97 media_router.MediaRouterView.CAST_MODE_LIST)); | 144 media_router.MediaRouterView.CAST_MODE_LIST)); |
| 98 assertEquals('arrow-drop-down', | 145 assertEquals('arrow-drop-down', |
| 99 header.computeArrowDropIcon_( | 146 header.computeArrowDropIcon_( |
| 100 media_router.MediaRouterView.FILTER)); | 147 media_router.MediaRouterView.FILTER)); |
| 101 assertEquals('arrow-drop-down', | 148 assertEquals('arrow-drop-down', |
| 102 header.computeArrowDropIcon_( | 149 header.computeArrowDropIcon_( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 'close-button', | 181 'close-button', |
| 135 'header-text']); | 182 'header-text']); |
| 136 }); | 183 }); |
| 137 }); | 184 }); |
| 138 } | 185 } |
| 139 | 186 |
| 140 return { | 187 return { |
| 141 registerTests: registerTests, | 188 registerTests: registerTests, |
| 142 }; | 189 }; |
| 143 }); | 190 }); |
| OLD | NEW |