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