@@ -122,14 +122,44 @@ describe('Switch', () => {
122
122
} ) ;
123
123
it ( 'Wrapper touch' , ( ) => {
124
124
specSwitch = new Switch ( { } , '#specSwitch' ) ;
125
- const start : MouseEvent = document . createEvent ( 'MouseEvent' ) ;
126
- start . initEvent ( 'touchstart' , true , true ) ;
125
+ const start : TouchEvent = new TouchEvent ( 'touchstart' , {
126
+ touches : [
127
+ new Touch ( { identifier : 1 , target : document . documentElement } ) ,
128
+ ] ,
129
+ targetTouches : [
130
+ new Touch ( { identifier : 1 , target : document . documentElement } ) ,
131
+ ] ,
132
+ changedTouches : [
133
+ new Touch ( { identifier : 1 , target : document . documentElement } ) ,
134
+ ] ,
135
+ bubbles : true , cancelable : true , composed : true ,
136
+ } ) ;
127
137
element . parentElement . dispatchEvent ( start ) ;
128
- const move : MouseEvent = document . createEvent ( 'MouseEvent' ) ;
129
- move . initEvent ( 'touchmove' , true , true ) ;
138
+ const move : TouchEvent = new TouchEvent ( 'touchmove' , {
139
+ touches : [
140
+ new Touch ( { identifier : 1 , target : document . documentElement } ) ,
141
+ ] ,
142
+ targetTouches : [
143
+ new Touch ( { identifier : 1 , target : document . documentElement } ) ,
144
+ ] ,
145
+ changedTouches : [
146
+ new Touch ( { identifier : 1 , target : document . documentElement } ) ,
147
+ ] ,
148
+ bubbles : true , cancelable : true , composed : true ,
149
+ } ) ;
130
150
element . parentElement . dispatchEvent ( move ) ;
131
- const end : MouseEvent = document . createEvent ( 'MouseEvent' ) ;
132
- end . initEvent ( 'touchend' , true , true ) ;
151
+ const end : TouchEvent = new TouchEvent ( 'touchend' , {
152
+ touches : [
153
+ new Touch ( { identifier : 1 , target : document . documentElement } ) ,
154
+ ] ,
155
+ targetTouches : [
156
+ new Touch ( { identifier : 1 , target : document . documentElement } ) ,
157
+ ] ,
158
+ changedTouches : [
159
+ new Touch ( { identifier : 1 , target : document . documentElement } ) ,
160
+ ] ,
161
+ bubbles : true , cancelable : true , composed : true ,
162
+ } ) ;
133
163
element . parentElement . dispatchEvent ( end ) ;
134
164
expect ( element . parentElement . children [ 1 ] . classList . contains ( 'e-switch-active' ) ) . toEqual ( true ) ;
135
165
const up : MouseEvent = document . createEvent ( 'MouseEvent' ) ;
0 commit comments