OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 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 | 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 | 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 | 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 | 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 | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
9 --> | 9 --> |
10 <html> | 10 <html> |
(...skipping 23 matching lines...) Expand all Loading... |
34 </test-fixture> | 34 </test-fixture> |
35 | 35 |
36 <script> | 36 <script> |
37 suite('active-state', function() { | 37 suite('active-state', function() { |
38 var activeTarget; | 38 var activeTarget; |
39 | 39 |
40 setup(function() { | 40 setup(function() { |
41 activeTarget = fixture('TrivialActiveState'); | 41 activeTarget = fixture('TrivialActiveState'); |
42 }); | 42 }); |
43 | 43 |
44 suite('non-primary pointer input source', function() { | |
45 test('does not cause state to change', function() { | |
46 var rightClickMouseEvent = new CustomEvent('mousedown'); | |
47 rightClickMouseEvent.buttons = 2; | |
48 activeTarget.dispatchEvent(rightClickMouseEvent); | |
49 expect(activeTarget.pressed).to.be.equal(false); | |
50 }); | |
51 }); | |
52 | |
53 suite('active state with toggles attribute', function() { | 44 suite('active state with toggles attribute', function() { |
54 setup(function() { | 45 setup(function() { |
55 activeTarget = fixture('ToggleActiveState'); | 46 activeTarget = fixture('ToggleActiveState'); |
56 }); | 47 }); |
57 | 48 |
| 49 suite('when down', function() { |
| 50 test('is pressed', function() { |
| 51 MockInteractions.down(activeTarget); |
| 52 expect(activeTarget.hasAttribute('pressed')).to.be.eql(true); |
| 53 }); |
| 54 }); |
| 55 |
58 suite('when clicked', function() { | 56 suite('when clicked', function() { |
59 test('is activated', function(done) { | 57 test('is activated', function(done) { |
60 MockInteractions.downAndUp(activeTarget, function() { | 58 MockInteractions.downAndUp(activeTarget, function() { |
61 try { | 59 try { |
62 expect(activeTarget.hasAttribute('active')).to.be.eql(true); | 60 expect(activeTarget.hasAttribute('active')).to.be.eql(true); |
63 expect(activeTarget.hasAttribute('aria-pressed')).to.be.eql(true
); | 61 expect(activeTarget.hasAttribute('aria-pressed')).to.be.eql(true
); |
64 expect(activeTarget.getAttribute('aria-pressed')).to.be.eql('tru
e'); | 62 expect(activeTarget.getAttribute('aria-pressed')).to.be.eql('tru
e'); |
65 done(); | 63 done(); |
66 } catch (e) { | 64 } catch (e) { |
67 done(e); | 65 done(e); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 189 } |
192 }); | 190 }); |
193 | 191 |
194 MockInteractions.pressEnter(activeTarget); | 192 MockInteractions.pressEnter(activeTarget); |
195 }); | 193 }); |
196 }); | 194 }); |
197 }); | 195 }); |
198 </script> | 196 </script> |
199 </body> | 197 </body> |
200 </html> | 198 </html> |
OLD | NEW |