OLD | NEW |
1 Web Animations Test Suite | 1 Web Animations Test Suite |
2 ========================= | 2 ========================= |
3 | 3 |
4 Specification: https://w3c.github.io/web-animations/ | 4 Specification: https://w3c.github.io/web-animations/ |
5 | 5 |
6 | 6 |
7 Guidelines for writing tests | 7 Guidelines for writing tests |
8 ---------------------------- | 8 ---------------------------- |
9 | 9 |
10 * Try to follow the spec outline where possible. | 10 * Try to follow the spec outline where possible. |
11 | 11 |
12 For example, if you want to test setting the start time, you might be | 12 For example, if you want to test setting the start time, you might be |
13 tempted to put all the tests in: | 13 tempted to put all the tests in: |
14 | 14 |
15 > `/web-animations/Animation/startTime.html` | 15 > `/web-animations/interfaces/Animation/startTime.html` |
16 | 16 |
17 However, in the spec most of the logic is in the “Set the animation | 17 However, in the spec most of the logic is in the “Set the animation |
18 start time“ procedure in the “Timing model” section. | 18 start time“ procedure in the “Timing model” section. |
19 | 19 |
20 Instead, try something like: | 20 Instead, try something like: |
21 | 21 |
22 > * `/web-animations/timing-model/animation/set-the-animation-start-time.h
tml`<br> | 22 > * `/web-animations/timing-model/animations/set-the-animation-start-time.
html`<br> |
23 > Tests all the branches and inputs to the procedure as defined in the | 23 > Tests all the branches and inputs to the procedure as defined in the |
24 > spec (using the `Animation.startTime` API). | 24 > spec (using the `Animation.startTime` API). |
25 > * `/web-animations/Animation/startTime.html`<br> | 25 > * `/web-animations/interfaces/Animation/startTime.html`<br> |
26 > Tests API-layer specific issues like mapping unresolved values to | 26 > Tests API-layer specific issues like mapping unresolved values to |
27 > null, etc. | 27 > null, etc. |
28 | 28 |
29 On that note, two levels of subdirectories is enough even if the spec has | 29 On that note, two levels of subdirectories is enough even if the spec has |
30 deeper nesting. | 30 deeper nesting. |
31 | 31 |
32 Note that most of the existing tests in the suite _don't_ do this well yet. | 32 Note that most of the existing tests in the suite _don't_ do this well yet. |
33 That's the direction we're heading, however. | 33 That's the direction we're heading, however. |
34 | 34 |
35 * Test the spec. | 35 * Test the spec. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 Remember, even if we do need to make all tests take, say 200s each, text | 98 Remember, even if we do need to make all tests take, say 200s each, text |
99 editors are very good at search and replace. | 99 editors are very good at search and replace. |
100 | 100 |
101 * Use the `assert_times_equal` assertion for comparing calculated times. | 101 * Use the `assert_times_equal` assertion for comparing calculated times. |
102 It tests times are equal using the precision recommended in the spec whilst | 102 It tests times are equal using the precision recommended in the spec whilst |
103 allowing implementations to override the function to meet their own | 103 allowing implementations to override the function to meet their own |
104 precision requirements. | 104 precision requirements. |
105 | 105 |
106 * There are quite a few bad tests in the repository. We're learning as | 106 * There are quite a few bad tests in the repository. We're learning as |
107 we go. Don't just copy them blindly—please fix them! | 107 we go. Don't just copy them blindly—please fix them! |
OLD | NEW |