| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <!-- | 2 <!-- |
| 3 @license | 3 @license |
| 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 5 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 5 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 8 Code distributed by Google as part of the polymer project is also | 8 Code distributed by Google as part of the polymer project is also |
| 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 10 --> | 10 --> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 </head> | 25 </head> |
| 26 <body> | 26 <body> |
| 27 | 27 |
| 28 <test-fixture id="PaperSpinner"> | 28 <test-fixture id="PaperSpinner"> |
| 29 <template> | 29 <template> |
| 30 <paper-spinner></paper-spinner> | 30 <paper-spinner></paper-spinner> |
| 31 </template> | 31 </template> |
| 32 </test-fixture> | 32 </test-fixture> |
| 33 | 33 |
| 34 <test-fixture id="ActivePaperSpinner"> |
| 35 <template> |
| 36 <paper-spinner active></paper-spinner> |
| 37 </template> |
| 38 </test-fixture> |
| 39 |
| 34 <script> | 40 <script> |
| 35 'use strict'; | 41 'use strict'; |
| 36 | 42 |
| 37 suite('<paper-spinner>', function() { | 43 suite('<paper-spinner>', function() { |
| 38 | 44 |
| 39 suite('an accessible paper spinner', function() { | 45 suite('an accessible paper spinner', function() { |
| 40 var spinner; | 46 var spinner; |
| 47 var activeSpinner; |
| 41 | 48 |
| 42 setup(function() { | 49 setup(function() { |
| 43 spinner = fixture('PaperSpinner'); | 50 spinner = fixture('PaperSpinner'); |
| 51 activeSpinner = fixture('ActivePaperSpinner'); |
| 44 }); | 52 }); |
| 45 | 53 |
| 46 test('adds an ARIA label when `alt` is supplied', function() { | 54 test('adds an ARIA label when `alt` is supplied', function() { |
| 47 var ALT_TEXT = 'Loading the next gif...'; | 55 var ALT_TEXT = 'Loading the next gif...'; |
| 48 | 56 |
| 49 spinner.alt = ALT_TEXT; | 57 spinner.alt = ALT_TEXT; |
| 50 expect(spinner.getAttribute('aria-label')).to.be.eql(ALT_TEXT); | 58 expect(spinner.getAttribute('aria-label')).to.be.eql(ALT_TEXT); |
| 51 }); | 59 }); |
| 52 | 60 |
| 53 test('hides from ARIA when inactive', function() { | 61 test('hides from ARIA when inactive', function() { |
| 54 spinner.active = false; | 62 spinner.active = false; |
| 55 expect(spinner.getAttribute('aria-hidden')).to.be.eql('true'); | 63 expect(spinner.getAttribute('aria-hidden')).to.be.eql('true'); |
| 56 }); | 64 }); |
| 65 |
| 66 test('toggle during cooldown', function(done) { |
| 67 activeSpinner.active = false; |
| 68 |
| 69 // Set active to true before cooldown animation completes. |
| 70 setTimeout(function() { |
| 71 activeSpinner.active = true; |
| 72 |
| 73 // Wait for cooldown animation to complete. |
| 74 setTimeout(function() { |
| 75 expect(activeSpinner.active).to.equal(true); |
| 76 done(); |
| 77 }, 500); |
| 78 }, 100); |
| 79 }); |
| 57 }); | 80 }); |
| 58 | 81 |
| 59 }); | 82 }); |
| 60 </script> | 83 </script> |
| 61 | 84 |
| 62 </body> | 85 </body> |
| 63 </html> | 86 </html> |
| OLD | NEW |