File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 11import test from "ava" ;
2+ import { JSDOM } from "jsdom" ;
23import { init } from "../../../src/django_unicorn/static/unicorn/js/unicorn.js" ;
4+ import { components } from "../../../src/django_unicorn/static/unicorn/js/store.js" ;
5+
6+ test . beforeEach ( ( ) => {
7+ const dom = new JSDOM ( "<!doctype html><html><body></body></html>" ) ;
8+ global . document = dom . window . document ;
9+ global . window = dom . window ;
10+ global . MutationObserver = dom . window . MutationObserver ;
11+ global . Node = dom . window . Node ;
12+ global . NodeFilter = dom . window . NodeFilter ;
13+
14+ for ( const key in components ) {
15+ delete components [ key ] ;
16+ }
17+ } ) ;
18+
19+ test . afterEach ( ( ) => {
20+ delete global . document ;
21+ delete global . window ;
22+ delete global . MutationObserver ;
23+ delete global . Node ;
24+ delete global . NodeFilter ;
25+ } ) ;
326
427test ( "init unicorn" , ( t ) => {
528 const actual = init ( "unicorn/" , "X-Unicorn" , "unicorn" , { NAME : "morphdom" } ) ;
You can’t perform that action at this time.
0 commit comments