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 |
| 11 <html> |
| 12 <head> |
| 13 <title>paper-button-behavior</title> |
| 14 |
| 15 <script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
| 16 <script src="../../web-component-tester/browser.js"></script> |
| 17 <script src="../../test-fixture/test-fixture-mocha.js"></script> |
| 18 <script src="../../iron-test-helpers/mock-interactions.js"></script> |
| 19 |
| 20 <link rel="import" href="../../polymer/polymer.html"> |
| 21 <link rel="import" href="../../test-fixture/test-fixture.html"> |
| 22 <link rel="import" href="test-button.html"> |
| 23 </head> |
| 24 <body> |
| 25 |
| 26 <test-fixture id="basic"> |
| 27 <template> |
| 28 <test-button></test-button> |
| 29 </template> |
| 30 </test-fixture> |
| 31 |
| 32 <test-fixture id="raised"> |
| 33 <template> |
| 34 <test-button raised toggles></test-button> |
| 35 </template> |
| 36 </test-fixture> |
| 37 |
| 38 <script> |
| 39 suite('basic', function() { |
| 40 var button; |
| 41 |
| 42 suite('when raised is false', function() { |
| 43 setup(function() { |
| 44 button = fixture('basic'); |
| 45 }); |
| 46 |
| 47 test('normal (no states)', function() { |
| 48 assert.equal(button._elevation, 0); |
| 49 }); |
| 50 |
| 51 test('set disabled property', function() { |
| 52 button.disabled = true; |
| 53 assert.equal(button._elevation, 0); |
| 54 }); |
| 55 |
| 56 test('activated by tap', function(done) { |
| 57 MockInteractions.downAndUp(button, function() { |
| 58 try { |
| 59 assert.equal(button._elevation, 0); |
| 60 done(); |
| 61 } catch (e) { |
| 62 done(e); |
| 63 } |
| 64 }); |
| 65 }); |
| 66 |
| 67 test('receives focused', function() { |
| 68 MockInteractions.focus(button); |
| 69 assert.equal(button._elevation, 0); |
| 70 }) |
| 71 }); |
| 72 |
| 73 suite('when raised is true', function() { |
| 74 setup(function() { |
| 75 button = fixture('raised'); |
| 76 }); |
| 77 |
| 78 test('normal (no states)', function() { |
| 79 assert.equal(button._elevation, 1); |
| 80 }); |
| 81 |
| 82 test('set disabled property', function() { |
| 83 button.disabled = true; |
| 84 assert.equal(button._elevation, 0); |
| 85 }); |
| 86 |
| 87 test('activated by tap', function(done) { |
| 88 MockInteractions.downAndUp(button, function() { |
| 89 try { |
| 90 assert.equal(button._elevation, 2); |
| 91 done(); |
| 92 } catch (e) { |
| 93 done(e); |
| 94 } |
| 95 }); |
| 96 }); |
| 97 |
| 98 test('receives focused', function() { |
| 99 MockInteractions.focus(button); |
| 100 assert.equal(button._elevation, 3); |
| 101 }) |
| 102 }); |
| 103 |
| 104 }); |
| 105 </script> |
| 106 |
| 107 </body> |
| 108 </html> |
OLD | NEW |