1<!doctype html> 2<!-- 3@license 4Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 5This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 6The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 7The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 8Code distributed by Google as part of the polymer project is also 9subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10--> 11<html> 12 <head> 13 14 <meta charset="UTF-8"> 15 <title>paper-spinner basic tests</title> 16 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> 17 18 <script src="../../webcomponentsjs/webcomponents.js"></script> 19 <script src="../../web-component-tester/browser.js"></script> 20 <script src="../../test-fixture/test-fixture-mocha.js"></script> 21 22 <link href="../../test-fixture/test-fixture.html" rel="import"> 23 <link href="../paper-spinner.html" rel="import"> 24 25 </head> 26 <body> 27 28 <test-fixture id="PaperSpinner"> 29 <template> 30 <paper-spinner></paper-spinner> 31 </template> 32 </test-fixture> 33 34 <test-fixture id="ActivePaperSpinner"> 35 <template> 36 <paper-spinner active></paper-spinner> 37 </template> 38 </test-fixture> 39 40 <script> 41 'use strict'; 42 43 suite('<paper-spinner>', function() { 44 45 suite('an accessible paper spinner', function() { 46 var spinner; 47 var activeSpinner; 48 49 setup(function() { 50 spinner = fixture('PaperSpinner'); 51 activeSpinner = fixture('ActivePaperSpinner'); 52 }); 53 54 test('adds an ARIA label when `alt` is supplied', function() { 55 var ALT_TEXT = 'Loading the next gif...'; 56 57 spinner.alt = ALT_TEXT; 58 expect(spinner.getAttribute('aria-label')).to.be.eql(ALT_TEXT); 59 }); 60 61 test('hides from ARIA when inactive', function() { 62 spinner.active = false; 63 expect(spinner.getAttribute('aria-hidden')).to.be.eql('true'); 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 }); 80 }); 81 82 }); 83 </script> 84 85 </body> 86</html> 87