OLD | NEW |
1 # iron-test-helpers | 1 # iron-test-helpers |
2 | 2 |
3 Utility classes to make testing easier. | 3 Utility classes to make testing easier. |
4 | 4 |
5 ## Mock Interactions | 5 ## Mock Interactions |
6 | 6 |
7 This is a set of methods to simulate mouse or keyboard interaction with an eleme
nt. Include `mock-interactions.js` and then use them like so: | 7 This is a set of methods to simulate mouse or keyboard interaction with an eleme
nt. Include `mock-interactions.js` and then use them like so: |
8 | 8 |
9 ```javascript | 9 ```javascript |
10 test('can be triggered with space', function(done) { | 10 test('can be triggered with space', function(done) { |
11 button.addEventListener('keydown', function() { | 11 button.addEventListener('keydown', function() { |
12 done(); | 12 done(); |
13 }); | 13 }); |
14 MockInteractions.pressSpace(button); | 14 MockInteractions.pressSpace(button); |
15 }); | 15 }); |
16 | 16 |
17 test('can be clicked', function(done) { | 17 test('can be clicked', function(done) { |
18 button.addEventListener('click', function() { | 18 button.addEventListener('click', function() { |
19 done(); | 19 done(); |
20 }); | 20 }); |
21 MockInteractions.down(button); | 21 MockInteractions.tap(button); |
22 }); | 22 }); |
23 ``` | 23 ``` |
OLD | NEW |