-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Configure JSDOM to load script tags injected into the dom by get…
…Scripts
- Loading branch information
1 parent
b34c8bf
commit 41c0b20
Showing
3 changed files
with
11 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,8 @@ | ||
|
||
|
||
import $ from 'jquery' | ||
global.$ = $ | ||
global.jQuery = $ | ||
|
||
const langFiles = require('formbuilder-languages') | ||
global.FB_EN_US = langFiles['en-US'] | ||
|
||
const xhrMockClass = () => ({ | ||
open : jest.fn(), //(method, url) => {console.log(method + ':' + url)}, | ||
send : jest.fn().mockImplementation(function(){ this.onload() }), | ||
setRequestHeader: jest.fn(), | ||
abort: jest.fn(), | ||
addEventListener: jest.fn(), | ||
dispatchEvent: jest.fn(), | ||
error: jest.fn(), | ||
getAllResponseHeaders: jest.fn(), | ||
getResponseHeader: jest.fn(), | ||
//load: jest.fn(), | ||
loadend: jest.fn(), | ||
loadstart: jest.fn(), | ||
onreadystatechange: jest.fn(), | ||
progress: jest.fn(), | ||
readyState: jest.fn(), | ||
removeEventListener: jest.fn(), | ||
response: jest.fn(), | ||
responseText: jest.fn(), | ||
responseType: jest.fn(), | ||
responseURL: jest.fn(), | ||
responseXML: jest.fn(), | ||
status: jest.fn(), | ||
statusText: jest.fn(), | ||
timeout: jest.fn(), | ||
upload: jest.fn(), | ||
withCredentials: jest.fn(), | ||
}) | ||
|
||
window.XMLHttpRequest = jest.fn().mockImplementation(xhrMockClass) | ||
global.FB_EN_US = langFiles['en-US'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters