-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
54866e1
commit 9f11b8c
Showing
6 changed files
with
56 additions
and
13 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
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Happy DOM options. | ||
*/ | ||
export interface HappyDOMOptions { | ||
width?: number | ||
height?: number | ||
url?: string | ||
settings?: { | ||
disableJavaScriptEvaluation?: boolean | ||
disableJavaScriptFileLoading?: boolean | ||
disableCSSFileLoading?: boolean | ||
disableIframePageLoading?: boolean | ||
disableComputedStyleRendering?: boolean | ||
enableFileSystemHttpRequests?: boolean | ||
device?: { | ||
prefersColorScheme?: string | ||
mediaType?: string | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* @vitest-environment happy-dom | ||
* @vitest-environment-options { "url": "http://my-website:5435", "settings": { "disableCSSFileLoading": true } } | ||
*/ | ||
|
||
/* eslint-disable vars-on-top */ | ||
|
||
import { expect, it } from 'vitest' | ||
|
||
declare global { | ||
// eslint-disable-next-line no-var | ||
var happyDOM: any | ||
} | ||
|
||
it('custom URL is changed to my-website:5435', () => { | ||
expect(location.href).toBe('http://my-website:5435/') | ||
}) | ||
|
||
it('accepts custom environment options', () => { | ||
// default is false | ||
expect(window.happyDOM.settings.disableCSSFileLoading).toBe(true) | ||
}) |
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