11'use strict' ;
22
3- const tryCatch = require ( 'try-catch' ) ;
3+ require ( 'css-modules-require-hook/preset' ) ;
4+
5+ const { tryCatch} = require ( 'try-catch' ) ;
46
5- const stub = require ( '@cloudcmd/stub' ) ;
67const mockRequire = require ( 'mock-require' ) ;
78
8- require ( 'css-modules-require-hook/preset' ) ;
9+ const autoGlobals = require ( 'auto-globals' ) ;
10+ const { test : tape , stub} = require ( 'supertape' ) ;
911
1012const {
1113 open,
@@ -14,22 +16,15 @@ const {
1416 _onMainClick,
1517} = require ( './modal' ) ;
1618
17- const autoGlobals = require ( 'auto-globals' ) ;
18- const tape = require ( 'supertape' ) ;
19-
2019const { create} = autoGlobals ;
2120
22- const {
23- reRequire,
24- stopAll,
25- } = mockRequire ;
21+ const { reRequire, stopAll} = mockRequire ;
2622
2723const test = autoGlobals ( tape ) ;
2824
2925test ( 'modal: open: main exist' , ( t ) => {
3026 const el = { } ;
31- const query = stub ( )
32- . returns ( el ) ;
27+ const query = stub ( ) . returns ( el ) ;
3328
3429 mockRequire ( './query' , query ) ;
3530
@@ -64,7 +59,7 @@ test('modal: open: beforeShow', (t) => {
6459
6560 stopAll ( ) ;
6661
67- t . ok ( beforeShow . calledWith ( ) , 'should call querySelector' ) ;
62+ t . calledWithNoArgs ( beforeShow , 'should call querySelector' ) ;
6863 t . end ( ) ;
6964} ) ;
7065
@@ -134,6 +129,7 @@ test('modal: open: images', (t) => {
134129 } ] ;
135130
136131 const afterShow = stub ( ) ;
132+
137133 open ( images , {
138134 afterShow,
139135 } ) ;
@@ -154,7 +150,7 @@ test('modal: open: images', (t) => {
154150
155151 stopAll ( ) ;
156152
157- t . ok ( parseImages . calledWith ( el , inner , options ) , 'should call querySelector' ) ;
153+ t . calledWith ( parseImages , [ el , inner , options ] , 'should call querySelector' ) ;
158154 t . end ( ) ;
159155} ) ;
160156
@@ -178,16 +174,13 @@ test('modal: onMainClick: no main', (t) => {
178174
179175 _onMainClick ( overlayClick , e ) ;
180176
181- t . notOk ( overlayClick . called , 'should not call overlayClick' ) ;
177+ t . notCalled ( overlayClick , 'should not call overlayClick' ) ;
182178 t . end ( ) ;
183179} ) ;
184180
185181test ( 'modal: close: removeChild' , ( t , { document} ) => {
186182 const el = { } ;
187- const {
188- querySelector,
189- body,
190- } = document ;
183+ const { querySelector, body} = document ;
191184
192185 querySelector . returns ( el ) ;
193186 close ( ) ;
@@ -198,10 +191,7 @@ test('modal: close: removeChild', (t, {document}) => {
198191
199192test ( 'modal: close: removeChild: event' , ( t , { document} ) => {
200193 const el = { } ;
201- const {
202- querySelector,
203- body,
204- } = document ;
194+ const { querySelector, body} = document ;
205195
206196 querySelector . returns ( el ) ;
207197 close ( ) ;
@@ -223,7 +213,7 @@ test('modal: close: beforeClose', (t, {document}) => {
223213
224214 close ( ) ;
225215
226- t . ok ( beforeClose . calledWith ( ) , 'should call beforeClose' ) ;
216+ t . calledWithNoArgs ( beforeClose , 'should call beforeClose' ) ;
227217 t . end ( ) ;
228218} ) ;
229219
@@ -240,7 +230,7 @@ test('modal: close: afterClose', (t, {document}) => {
240230
241231 close ( ) ;
242232
243- t . ok ( afterClose . calledWith ( ) , 'should call afterClose' ) ;
233+ t . calledWithNoArgs ( afterClose , 'should call afterClose' ) ;
244234 t . end ( ) ;
245235} ) ;
246236
@@ -253,7 +243,6 @@ test('modal: close: no el', (t) => {
253243
254244 close ( ) ;
255245
256- t . notOk ( beforeClose . called , 'should not call afterClose' ) ;
246+ t . notCalled ( beforeClose , 'should not call afterClose' ) ;
257247 t . end ( ) ;
258248} ) ;
259-
0 commit comments