-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
maint: Maintain own test setup config.
Don't extend from @patternslib/patternslib for setting up tests. The config files are not included in the npm package distributions anymore.
- Loading branch information
Showing
2 changed files
with
22 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Extra test setup. | ||
|
||
import jquery from "jquery"; | ||
global.$ = global.jQuery = jquery; | ||
|
||
jquery.expr.pseudos.visible = function () { | ||
// Fix jQuery ":visible" selector always returns false in JSDOM. | ||
// https://github.com/jsdom/jsdom/issues/1048#issuecomment-401599392 | ||
return true; | ||
}; | ||
|
||
// Do not output error messages | ||
import logging from "@patternslib/patternslib/core/logging"; | ||
logging.setLevel(50); | ||
// level: FATAL | ||
|
||
// patch dom.is_visible to not rely on jest-unavailable offsetWidth/Height | ||
import dom from "@patternslib/patternslib/core/dom"; | ||
dom.is_visible = (el) => { | ||
return !el.hidden && el.style.display !== "none"; | ||
}; |