| 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 issue-banner. */ | 5 /** @fileoverview Suite of tests for issue-banner. */ |
| 6 cr.define('issue_banner', function() { | 6 cr.define('issue_banner', function() { |
| 7 function registerTests() { | 7 function registerTests() { |
| 8 suite('IssueBanner', function() { | 8 suite('IssueBanner', function() { |
| 9 /** | 9 /** |
| 10 * Issue Banner created before each test. | 10 * Issue Banner created before each test. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 issue.secondaryActionType]), 'opt-button'); | 72 issue.secondaryActionType]), 'opt-button'); |
| 73 } | 73 } |
| 74 } else { | 74 } else { |
| 75 checkElementText('', 'title'); | 75 checkElementText('', 'title'); |
| 76 checkElementText('', 'default-button'); | 76 checkElementText('', 'default-button'); |
| 77 checkElementText('', 'opt-button'); | 77 checkElementText('', 'opt-button'); |
| 78 } | 78 } |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 // Checks whether parts of the UI is visible. | 81 // Checks whether parts of the UI is visible. |
| 82 var checkButtonVisibility = function(hasOptAction) { | 82 var checkButtonVisibility = function(optAction) { |
| 83 assertEquals(!hasOptAction, banner.$['buttons'] | 83 assertEquals(!optAction, banner.$['buttons'] |
| 84 .querySelector('paper-button').hidden); | 84 .querySelector('paper-button').hidden); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 // Import issue_banner.html before running suite. | 87 // Import issue_banner.html before running suite. |
| 88 suiteSetup(function() { | 88 suiteSetup(function() { |
| 89 return PolymerTest.importHtml( | 89 return PolymerTest.importHtml( |
| 90 'chrome://media-router/elements/issue_banner/' + | 90 'chrome://media-router/elements/issue_banner/' + |
| 91 'issue_banner.html'); | 91 'issue_banner.html'); |
| 92 }); | 92 }); |
| 93 | 93 |
| 94 // Initialize an issue-banner before each test. | 94 // Initialize an issue-banner before each test. |
| 95 setup(function(done) { | 95 setup(function(done) { |
| 96 PolymerTest.clearBody(); | 96 PolymerTest.clearBody(); |
| 97 banner = document.createElement('issue-banner'); | 97 banner = document.createElement('issue-banner'); |
| 98 document.body.appendChild(banner); | 98 document.body.appendChild(banner); |
| 99 | 99 |
| 100 // Initialize issues. | 100 // Initialize issues. |
| 101 fakeBlockingIssueOne = new media_router.Issue( | 101 fakeBlockingIssueOne = new media_router.Issue( |
| 102 'issue id 1', 'Issue Title 1', 'Issue Message 1', 0, 1, | 102 'issue id 1', 'Issue Title 1', 'Issue Message 1', 0, 1, |
| 103 'route id 1', true, 1234); | 103 'route id 1', true, 1234); |
| 104 fakeBlockingIssueTwo = new media_router.Issue( | 104 fakeBlockingIssueTwo = new media_router.Issue( |
| 105 'issue id 2', 'Issue Title 2', 'Issue Message 2', 0, null, | 105 'issue id 2', 'Issue Title 2', 'Issue Message 2', 0, undefined, |
| 106 'route id 2', true, 1234); | 106 'route id 2', true, 1234); |
| 107 fakeNonBlockingIssueOne = new media_router.Issue( | 107 fakeNonBlockingIssueOne = new media_router.Issue( |
| 108 'issue id 3', 'Issue Title 3', 'Issue Message 3', 0, 1, | 108 'issue id 3', 'Issue Title 3', 'Issue Message 3', 0, 1, |
| 109 'route id 3', false, 1234); | 109 'route id 3', false, 1234); |
| 110 fakeNonBlockingIssueTwo = new media_router.Issue( | 110 fakeNonBlockingIssueTwo = new media_router.Issue( |
| 111 'issue id 4', 'Issue Title 4', 'Issue Message 4', 0, null, | 111 'issue id 4', 'Issue Title 4', 'Issue Message 4', 0, undefined, |
| 112 'route id 4', false, 1234); | 112 'route id 4', false, 1234); |
| 113 | 113 |
| 114 // Allow for the issue banner to be created and attached. | 114 // Allow for the issue banner to be created and attached. |
| 115 setTimeout(done); | 115 setTimeout(done); |
| 116 }); | 116 }); |
| 117 | 117 |
| 118 // Tests for 'issue-action-click' event firing when a blocking issue | 118 // Tests for 'issue-action-click' event firing when a blocking issue |
| 119 // default action is clicked. | 119 // default action is clicked. |
| 120 test('blocking issue default action click', function(done) { | 120 test('blocking issue default action click', function(done) { |
| 121 banner.issue = fakeBlockingIssueOne; | 121 banner.issue = fakeBlockingIssueOne; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 banner.issue = fakeNonBlockingIssueTwo; | 198 banner.issue = fakeNonBlockingIssueTwo; |
| 199 checkButtonVisibility(fakeNonBlockingIssueTwo.secondaryActionType); | 199 checkButtonVisibility(fakeNonBlockingIssueTwo.secondaryActionType); |
| 200 }); | 200 }); |
| 201 }); | 201 }); |
| 202 } | 202 } |
| 203 | 203 |
| 204 return { | 204 return { |
| 205 registerTests: registerTests, | 205 registerTests: registerTests, |
| 206 }; | 206 }; |
| 207 }); | 207 }); |
| OLD | NEW |