@@ -28,19 +28,17 @@ describe('Animation test controller', () => {
28
28
before ( ( ) => {
29
29
const style = document . createElement ( 'style' ) ;
30
30
style . textContent = `
31
- .animate {
31
+ .animate,
32
+ .animate-after::after,
33
+ .animate-before::before,
34
+ .animate-backdrop::backdrop {
32
35
animation: 1000ms foo infinite;
33
36
}
34
37
35
- .delayed {
36
- animation-delay: 125ms;
37
- }
38
-
39
- .animate-before::before {
40
- animation: 1000ms foo infinite;
41
- }
42
-
43
- .delayed-before::before {
38
+ .delayed,
39
+ .delayed-after::after,
40
+ .delayed-before::before,
41
+ .delayed-backdrop::backdrop {
44
42
animation-delay: 125ms;
45
43
}
46
44
@@ -68,7 +66,7 @@ describe('Animation test controller', () => {
68
66
} ) ;
69
67
70
68
describe ( 'document' , ( ) => {
71
- it ( 'should stop animations on existing Elements' , ( ) => {
69
+ it ( 'should pause animations on existing Elements' , ( ) => {
72
70
const el = document . createElement ( 'div' ) ;
73
71
el . className = 'animate' ;
74
72
@@ -78,7 +76,7 @@ describe('Animation test controller', () => {
78
76
expect ( getComputedStyle ( el ) . animationPlayState ) . to . equal ( 'paused' ) ;
79
77
} ) ;
80
78
81
- it ( 'should stop animations on newly added Elements' , ( ) => {
79
+ it ( 'should pause animations on newly added Elements' , ( ) => {
82
80
const el = document . createElement ( 'div' ) ;
83
81
el . className = 'animate' ;
84
82
@@ -88,14 +86,34 @@ describe('Animation test controller', () => {
88
86
expect ( getComputedStyle ( el ) . animationPlayState ) . to . equal ( 'paused' ) ;
89
87
} ) ;
90
88
91
- it ( 'should stop animations on psuedo elements' , ( ) => {
89
+ it ( 'should pause animations on pseudo after' , ( ) => {
90
+ const el = document . createElement ( 'div' ) ;
91
+ el . className = 'animate-after' ;
92
+
93
+ setupAnimations ( ) ;
94
+ container . appendChild ( el ) ;
95
+
96
+ expect ( getComputedStyle ( el , '::after' ) . animationPlayState ) . to . equal ( 'paused' ) ;
97
+ } ) ;
98
+
99
+ it ( 'should pause animations on pseudo before' , ( ) => {
92
100
const el = document . createElement ( 'div' ) ;
93
101
el . className = 'animate-before' ;
94
102
95
103
setupAnimations ( ) ;
96
104
container . appendChild ( el ) ;
97
105
98
- expect ( getComputedStyle ( el , ':before' ) . animationPlayState ) . to . equal ( 'paused' ) ;
106
+ expect ( getComputedStyle ( el , '::before' ) . animationPlayState ) . to . equal ( 'paused' ) ;
107
+ } ) ;
108
+
109
+ it ( 'should pause animations on pseudo backdrop' , ( ) => {
110
+ const el = document . createElement ( 'div' ) ;
111
+ el . className = 'animate-backdrop' ;
112
+
113
+ setupAnimations ( ) ;
114
+ container . appendChild ( el ) ;
115
+
116
+ expect ( getComputedStyle ( el , '::backdrop' ) . animationPlayState ) . to . equal ( 'paused' ) ;
99
117
} ) ;
100
118
101
119
it ( 'should resume animations' , ( ) => {
@@ -131,18 +149,64 @@ describe('Animation test controller', () => {
131
149
expect ( getComputedStyle ( el ) . animationDelay ) . to . equal ( '0.025s' ) ;
132
150
} ) ;
133
151
134
- it ( 'should offset a delayed animation on a psuedo element' , ( ) => {
152
+ it ( 'should offset a delayed animation on a pseudo after' , ( ) => {
153
+ const el = document . createElement ( 'div' ) ;
154
+ el . className = 'animate-after delayed-after' ;
155
+
156
+ container . appendChild ( el ) ;
157
+ setupAnimations ( ) ;
158
+
159
+ offset ( 100 ) ;
160
+ expect ( getComputedStyle ( el , '::after' ) . animationDelay ) . to . equal ( '0.025s' ) ;
161
+ } ) ;
162
+
163
+ it ( 'should offset a delayed animation on a pseudo before' , ( ) => {
135
164
const el = document . createElement ( 'div' ) ;
136
165
el . className = 'animate-before delayed-before' ;
137
166
138
167
container . appendChild ( el ) ;
139
168
setupAnimations ( ) ;
140
169
141
170
offset ( 100 ) ;
142
- expect ( getComputedStyle ( el , ':before' ) . animationDelay ) . to . equal ( '0.025s' ) ;
171
+ expect ( getComputedStyle ( el , '::before' ) . animationDelay ) . to . equal ( '0.025s' ) ;
172
+ } ) ;
173
+
174
+ it ( 'should offset a delayed animation on a pseudo backdrop' , ( ) => {
175
+ const el = document . createElement ( 'div' ) ;
176
+ el . className = 'animate-backdrop delayed-backdrop' ;
177
+
178
+ container . appendChild ( el ) ;
179
+ setupAnimations ( ) ;
180
+
181
+ offset ( 100 ) ;
182
+ expect ( getComputedStyle ( el , '::backdrop' ) . animationDelay ) . to . equal ( '0.025s' ) ;
143
183
} ) ;
144
184
145
185
it ( 'should offset multiple times' , ( ) => {
186
+ const el = document . createElement ( 'div' ) ;
187
+ el . className = 'animate delayed' ;
188
+
189
+ container . appendChild ( el ) ;
190
+ setupAnimations ( ) ;
191
+
192
+ offset ( 100 ) ;
193
+ offset ( 300 ) ;
194
+ expect ( getComputedStyle ( el ) . animationDelay ) . to . equal ( '-0.175s' ) ;
195
+ } ) ;
196
+
197
+ it ( 'should offset multiple times on pseudo after' , ( ) => {
198
+ const el = document . createElement ( 'div' ) ;
199
+ el . className = 'animate-after delayed-after' ;
200
+
201
+ container . appendChild ( el ) ;
202
+ setupAnimations ( ) ;
203
+
204
+ offset ( 100 ) ;
205
+ offset ( 300 ) ;
206
+ expect ( getComputedStyle ( el , '::after' ) . animationDelay ) . to . equal ( '-0.175s' ) ;
207
+ } ) ;
208
+
209
+ it ( 'should offset multiple times on pseudo before' , ( ) => {
146
210
const el = document . createElement ( 'div' ) ;
147
211
el . className = 'animate-before delayed-before' ;
148
212
@@ -151,7 +215,19 @@ describe('Animation test controller', () => {
151
215
152
216
offset ( 100 ) ;
153
217
offset ( 300 ) ;
154
- expect ( getComputedStyle ( el ) . animationDelay ) . to . equal ( '-0.3s' ) ;
218
+ expect ( getComputedStyle ( el , '::before' ) . animationDelay ) . to . equal ( '-0.175s' ) ;
219
+ } ) ;
220
+
221
+ it ( 'should offset multiple times on pseudo backdrop' , ( ) => {
222
+ const el = document . createElement ( 'div' ) ;
223
+ el . className = 'animate-backdrop delayed-backdrop' ;
224
+
225
+ container . appendChild ( el ) ;
226
+ setupAnimations ( ) ;
227
+
228
+ offset ( 100 ) ;
229
+ offset ( 300 ) ;
230
+ expect ( getComputedStyle ( el , '::backdrop' ) . animationDelay ) . to . equal ( '-0.175s' ) ;
155
231
} ) ;
156
232
} ) ;
157
233
@@ -160,7 +236,7 @@ describe('Animation test controller', () => {
160
236
return ;
161
237
}
162
238
163
- it ( 'should stop animations on existing Elements' , ( ) => {
239
+ it ( 'should pause animations on existing Elements' , ( ) => {
164
240
const outer = document . createElement ( 'div' ) ;
165
241
const sr = outer . attachShadow ( { mode : 'closed' } ) ;
166
242
const el = document . createElement ( 'div' ) ;
@@ -173,7 +249,7 @@ describe('Animation test controller', () => {
173
249
expect ( getComputedStyle ( el ) . animationPlayState ) . to . equal ( 'paused' ) ;
174
250
} ) ;
175
251
176
- it ( 'should stop animations on newly added Elements' , ( ) => {
252
+ it ( 'should pause animations on newly added Elements' , ( ) => {
177
253
const outer = document . createElement ( 'div' ) ;
178
254
const sr = outer . attachShadow ( { mode : 'closed' } ) ;
179
255
const el = document . createElement ( 'div' ) ;
0 commit comments