OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <!-- |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> |
| 10 <html> |
| 11 <head> |
| 12 <meta charset="UTF-8"> |
| 13 <title>paper-button basic tests</title> |
| 14 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-
scale=1.0"> |
| 15 |
| 16 <script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
| 17 <script src="../../web-component-tester/browser.js"></script> |
| 18 <script src="../../test-fixture/test-fixture-mocha.js"></script> |
| 19 <script src="../../iron-test-helpers/mock-interactions.js"></script> |
| 20 |
| 21 <link rel="import" href="../paper-button.html"> |
| 22 <link rel="import" href="../../test-fixture/test-fixture.html"> |
| 23 |
| 24 </head> |
| 25 <body> |
| 26 |
| 27 <test-fixture id="TrivialButton"> |
| 28 <template> |
| 29 <paper-button>Button</paper-button> |
| 30 </template> |
| 31 </test-fixture> |
| 32 |
| 33 <script> |
| 34 suite('<paper-button>', function() { |
| 35 var button; |
| 36 |
| 37 setup(function() { |
| 38 button = fixture('TrivialButton'); |
| 39 }); |
| 40 |
| 41 test('can be raised imperatively', function(done) { |
| 42 button.raised = true; |
| 43 |
| 44 expect(button.hasAttribute('raised')).to.be.eql(true); |
| 45 |
| 46 Polymer.Base.async(function() { |
| 47 try { |
| 48 expect(button._elevation).to.be.eql(1); |
| 49 done(); |
| 50 } catch (e) { |
| 51 done(e); |
| 52 } |
| 53 }, 1); |
| 54 }); |
| 55 |
| 56 test('has aria role "button"', function() { |
| 57 expect(button.getAttribute('role')).to.be.eql('button'); |
| 58 }); |
| 59 |
| 60 test('can be disabled imperatively', function() { |
| 61 button.disabled = true; |
| 62 expect(button.getAttribute('aria-disabled')).to.be.eql('true'); |
| 63 expect(button.hasAttribute('disabled')).to.be.eql(true); |
| 64 }); |
| 65 |
| 66 test('can be triggered with space', function(done) { |
| 67 button.addEventListener('click', function() { |
| 68 done(); |
| 69 }); |
| 70 MockInteractions.pressSpace(button); |
| 71 }); |
| 72 |
| 73 test('can be triggered with enter', function(done) { |
| 74 button.addEventListener('click', function() { |
| 75 done(); |
| 76 }); |
| 77 MockInteractions.pressEnter(button); |
| 78 }); |
| 79 }); |
| 80 </script> |
| 81 </body> |
| 82 </html> |
OLD | NEW |