| 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-button basic 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 <script src="../../iron-test-helpers/mock-interactions.js"></script> |
| 21 |
| 22 <link rel="import" href="../paper-button.html"> |
| 23 <link rel="import" href="../../test-fixture/test-fixture.html"> |
| 24 |
| 25 </head> |
| 26 <body> |
| 27 |
| 28 <test-fixture id="TrivialButton"> |
| 29 <template> |
| 30 <paper-button>Button</paper-button> |
| 31 </template> |
| 32 </test-fixture> |
| 33 |
| 34 <script> |
| 35 suite('<paper-button>', function() { |
| 36 var button; |
| 37 |
| 38 setup(function() { |
| 39 button = fixture('TrivialButton'); |
| 40 }); |
| 41 |
| 42 test('can be raised imperatively', function(done) { |
| 43 button.raised = true; |
| 44 |
| 45 expect(button.hasAttribute('raised')).to.be.eql(true); |
| 46 |
| 47 Polymer.Base.async(function() { |
| 48 try { |
| 49 expect(button._elevation).to.be.eql(1); |
| 50 done(); |
| 51 } catch (e) { |
| 52 done(e); |
| 53 } |
| 54 }, 1); |
| 55 }); |
| 56 |
| 57 test('has aria role "button"', function() { |
| 58 expect(button.getAttribute('role')).to.be.eql('button'); |
| 59 }); |
| 60 |
| 61 test('can be disabled imperatively', function() { |
| 62 button.disabled = true; |
| 63 expect(button.getAttribute('aria-disabled')).to.be.eql('true'); |
| 64 expect(button.hasAttribute('disabled')).to.be.eql(true); |
| 65 }); |
| 66 |
| 67 test('can be triggered with space', function(done) { |
| 68 button.addEventListener('click', function() { |
| 69 done(); |
| 70 }); |
| 71 MockInteractions.pressSpace(button); |
| 72 }); |
| 73 |
| 74 test('can be triggered with enter', function(done) { |
| 75 button.addEventListener('click', function() { |
| 76 done(); |
| 77 }); |
| 78 MockInteractions.pressEnter(button); |
| 79 }); |
| 80 }); |
| 81 </script> |
| 82 </body> |
| 83 </html> |
| OLD | NEW |