| 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 |
| 12 <html> |
| 13 <head> |
| 14 <title>paper-button-behavior</title> |
| 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="../../polymer/polymer.html"> |
| 22 <link rel="import" href="../../test-fixture/test-fixture.html"> |
| 23 <link rel="import" href="test-button.html"> |
| 24 </head> |
| 25 <body> |
| 26 |
| 27 <test-fixture id="basic"> |
| 28 <template> |
| 29 <test-button></test-button> |
| 30 </template> |
| 31 </test-fixture> |
| 32 |
| 33 <script> |
| 34 suite('basic', function() { |
| 35 var button; |
| 36 |
| 37 setup(function() { |
| 38 button = fixture('basic'); |
| 39 }); |
| 40 |
| 41 test('normal (no states)', function() { |
| 42 assert.equal(button._elevation, 1); |
| 43 }); |
| 44 |
| 45 test('set disabled property', function() { |
| 46 button.disabled = true; |
| 47 assert.equal(button._elevation, 0); |
| 48 }); |
| 49 |
| 50 test('pressed and released', function() { |
| 51 MockInteractions.down(button); |
| 52 assert.equal(button._elevation, 4); |
| 53 MockInteractions.up(button); |
| 54 assert.equal(button._elevation, 1); |
| 55 }); |
| 56 |
| 57 suite('a button with toggles', function() { |
| 58 setup(function() { |
| 59 button.toggles = true; |
| 60 }); |
| 61 |
| 62 test('activated by tap', function(done) { |
| 63 MockInteractions.downAndUp(button, function() { |
| 64 try { |
| 65 assert.equal(button._elevation, 4); |
| 66 done(); |
| 67 } catch (e) { |
| 68 done(e); |
| 69 } |
| 70 }); |
| 71 }); |
| 72 }); |
| 73 |
| 74 test('receives focused', function() { |
| 75 MockInteractions.focus(button); |
| 76 assert.equal(button._elevation, 3); |
| 77 }); |
| 78 }); |
| 79 </script> |
| 80 |
| 81 </body> |
| 82 </html> |
| OLD | NEW |