| 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 route-details. */ | 5 /** @fileoverview Suite of tests for route-details. */ |
| 6 cr.define('route_details', function() { | 6 cr.define('route_details', function() { |
| 7 function registerTests() { | 7 function registerTests() { |
| 8 suite('RouteDetails', function() { | 8 suite('RouteDetails', function() { |
| 9 /** | 9 /** |
| 10 * Route Details created before each test. | 10 * Route Details created before each test. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 'start-casting-to-route-click', function() { done(); }); | 101 'start-casting-to-route-click', function() { done(); }); |
| 102 MockInteractions.tap(details.$['start-casting-to-route-button']); | 102 MockInteractions.tap(details.$['start-casting-to-route-button']); |
| 103 }); | 103 }); |
| 104 | 104 |
| 105 // Tests the initial expected text. | 105 // Tests the initial expected text. |
| 106 test('initial text setting', function() { | 106 test('initial text setting', function() { |
| 107 // <paper-button> text is styled as upper case. | 107 // <paper-button> text is styled as upper case. |
| 108 checkSpanText(loadTimeData.getString('stopCastingButtonText') | 108 checkSpanText(loadTimeData.getString('stopCastingButtonText') |
| 109 .toUpperCase(), 'close-route-button'); | 109 .toUpperCase(), 'close-route-button'); |
| 110 checkSpanText( | 110 checkSpanText( |
| 111 loadTimeData.getString('startCastingButtonText'), | 111 loadTimeData.getString('startCastingButtonText').toUpperCase(), |
| 112 'start-casting-to-route-button'); | 112 'start-casting-to-route-button'); |
| 113 checkSpanText('', 'route-information'); | 113 checkSpanText('', 'route-information'); |
| 114 }); | 114 }); |
| 115 | 115 |
| 116 // Tests when |route| is null or set. | 116 // Tests when |route| is undefined or set. |
| 117 test('route is null or set', function() { | 117 test('route is undefined or set', function() { |
| 118 // |route| is null. | 118 // |route| is initially undefined. |
| 119 assertEquals(null, details.route); | 119 assertEquals(undefined, details.route); |
| 120 checkDefaultViewIsShown(); | 120 checkDefaultViewIsShown(); |
| 121 | 121 |
| 122 // Set |route| to be non-null. | 122 // Set |route|. |
| 123 details.route = fakeRouteOne; | 123 details.route = fakeRouteOne; |
| 124 assertEquals(fakeRouteOne, details.route); | 124 assertEquals(fakeRouteOne, details.route); |
| 125 checkSpanText(loadTimeData.getStringF('castingActivityStatus', | 125 checkSpanText(loadTimeData.getStringF('castingActivityStatus', |
| 126 fakeRouteOne.description), 'route-information'); | 126 fakeRouteOne.description), 'route-information'); |
| 127 checkDefaultViewIsShown(); | 127 checkDefaultViewIsShown(); |
| 128 checkStartCastButtonIsNotShown(); | 128 checkStartCastButtonIsNotShown(); |
| 129 | 129 |
| 130 // Set |route| to a different route. | 130 // Set |route| to a different route. |
| 131 details.route = fakeRouteTwo; | 131 details.route = fakeRouteTwo; |
| 132 assertEquals(fakeRouteTwo, details.route); | 132 assertEquals(fakeRouteTwo, details.route); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 done(); | 168 done(); |
| 169 }); | 169 }); |
| 170 }); | 170 }); |
| 171 }); | 171 }); |
| 172 } | 172 } |
| 173 | 173 |
| 174 return { | 174 return { |
| 175 registerTests: registerTests, | 175 registerTests: registerTests, |
| 176 }; | 176 }; |
| 177 }); | 177 }); |
| OLD | NEW |