scratch – Blame information for rev 134
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
134 | office | 1 | Testing |
2 | ======= |
||
3 | |||
4 | The tests have been set up to run with a simulated DOM created with JSDOM. |
||
5 | Mouse and keyboard events are simulated using jQuery and jquery-simulate-ext plugin. |
||
6 | |||
7 | We looked into several other alternatives like Zombie.js and Karma, but |
||
8 | for our use case, they did not seem to offer many advantages over a JSDOM. |
||
9 | The main reason behind this is that neither of those options provide a |
||
10 | built-in or better way to simulate mouse and keyboard events. |
||
11 | |||
12 | A step up from the current test solution would be to create Selenium or PtahnomJS |
||
13 | tests so that we do not have to simulate mouse and keyboard, but could actually |
||
14 | control the browser. This will be on the roadmap in the future. |
||
15 | |||
16 | For now - simply do `npm test`. |
||
17 | |||
18 | ### Writing tests |
||
19 | |||
20 | Take care to follow the style of existing tests. All tests that require DOM |
||
21 | manipulation and/or involve simulating user interaction, should go under |
||
22 | integration tests. Testing tokenfield methods should go under unit tests. |