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 <meta charset="UTF-8"> 14 <title>paper-fab a11y tests</title> 15 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> 16 17 <script src="../../webcomponentsjs/webcomponents-lite.js"></script> 18 <script src="../../web-component-tester/browser.js"></script> 19 20 <link rel="import" href="../../iron-icons/iron-icons.html"> 21 <link rel="import" href="../paper-fab.html"> 22 23</head> 24<body> 25 26 <test-fixture id="A11yFabs"> 27 <template> 28 <paper-fab id="fab1" icon="add"></paper-fab> 29 <paper-fab id="fab2" icon="add" disabled></paper-fab> 30 <paper-fab id="fab3" icon="add" aria-label="custom"></paper-fab> 31 </template> 32 </test-fixture> 33 34 <script> 35 36 var f1; 37 var f2; 38 var f3; 39 40 setup(function() { 41 var fabs = fixture('A11yFabs'); 42 43 f1 = fabs[0]; 44 f2 = fabs[1]; 45 f3 = fabs[2]; 46 }); 47 48 test('aria role is a button', function() { 49 assert.strictEqual(f1.getAttribute('role'), 'button'); 50 }); 51 52 test('aria-disabled is set', function() { 53 assert.ok(f2.hasAttribute('aria-disabled')); 54 f2.removeAttribute('disabled'); 55 assert.strictEqual(f2.getAttribute('aria-disabled'), 'false'); 56 }); 57 58 test('user-defined aria-label is preserved', function() { 59 assert.strictEqual(f3.getAttribute('aria-label'), 'custom'); 60 f3.icon = 'arrow-forward'; 61 assert.strictEqual(f3.getAttribute('aria-label'), 'custom'); 62 }); 63 64 </script> 65 66</body> 67</html> 68