OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <!-- |
| 3 @license |
| 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 |
| 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 |
| 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 |
| 10 --> |
| 11 <html> |
| 12 <head> |
| 13 <meta charset="UTF-8"> |
| 14 <title>paper-card 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 <script src="../../test-fixture/test-fixture-mocha.js"></script> |
| 20 |
| 21 <link rel="import" href="../../test-fixture/test-fixture.html"> |
| 22 <link rel="import" href="../paper-card.html"> |
| 23 |
| 24 <style> |
| 25 paper-card { |
| 26 width: 400px; |
| 27 } |
| 28 </style> |
| 29 |
| 30 </head> |
| 31 <body> |
| 32 <test-fixture id="basic"> |
| 33 <template> |
| 34 <paper-card heading="header"> |
| 35 <div class="card-content"><p>Sample content</p></div> |
| 36 </paper-card> |
| 37 </template> |
| 38 </test-fixture> |
| 39 |
| 40 <script> |
| 41 suite('a11y', function() { |
| 42 var f; |
| 43 setup(function () { |
| 44 f = fixture('basic'); |
| 45 }); |
| 46 |
| 47 test('aria-label set on card', function() { |
| 48 assert.strictEqual(f.getAttribute('aria-label'), f.heading); |
| 49 }); |
| 50 |
| 51 test('aria-label can be updated', function() { |
| 52 assert.strictEqual(f.getAttribute('aria-label'), f.heading); |
| 53 f.heading = 'batman'; |
| 54 assert.strictEqual(f.getAttribute('aria-label'), 'batman'); |
| 55 }); |
| 56 }); |
| 57 suite('header image', function() { |
| 58 var f, img; |
| 59 setup(function () { |
| 60 f = fixture('basic'); |
| 61 img = f.querySelector('iron-image'); |
| 62 }); |
| 63 |
| 64 test('is iron-image', function(){ |
| 65 expect(img).to.be.ok; |
| 66 }); |
| 67 |
| 68 test('width properly setup', function() { |
| 69 assert.strictEqual(img.offsetWidth, 0); |
| 70 f.image = 'some-img-url'; |
| 71 assert.strictEqual(img.src, f.image); |
| 72 assert.strictEqual(img.offsetWidth, f.offsetWidth); |
| 73 }); |
| 74 |
| 75 test('preload properly setup', function() { |
| 76 assert.strictEqual(img.preload, f.preloadImage); |
| 77 f.preloadImage = !f.preloadImage; |
| 78 assert.strictEqual(img.preload, f.preloadImage); |
| 79 }); |
| 80 |
| 81 test('fade properly setup', function() { |
| 82 assert.strictEqual(img.fade, f.fadeImage); |
| 83 f.fadeImage = !f.fadeImage; |
| 84 assert.strictEqual(img.fade, f.fadeImage); |
| 85 }); |
| 86 }); |
| 87 </script> |
| 88 |
| 89 </body> |
| 90 </html> |
OLD | NEW |