forked from material-components/material-components-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update lolex to the latest version 🚀 (material-components#3507)
This updates lolex to 3.0.0, which now covers rAF as well, so createMockRaf has been removed. `clock.runToFrame()` replaces `mockRaf.flush()`, and `clock.countTimers()` replaces `mockRaf.pendingFrames.length`. This also creates a centralized `test/unit/helpers/clock` module to avoid any missed cleanup of mocked timeout/rAF functions. Instead of using lolex directly in unit tests, import the clock module's `install` function and call that. It creates a lolex instance and stores it within the module, and there is a "global" afterEach set up to uninstall it if it exists, after every test in every suite. (cherry picked from commit 7c60849)
- Loading branch information
1 parent
65d34d4
commit fedd1c1
Showing
42 changed files
with
984 additions
and
1,466 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
import lolex from 'lolex'; | ||
|
||
let instance; | ||
|
||
function install() { | ||
if (instance) { | ||
console.log('A clock instance already exists! Uninstalling it first...'); | ||
instance.uninstall(); | ||
} | ||
instance = lolex.install(); | ||
return instance; | ||
} | ||
|
||
function uninstall() { | ||
if (instance) { | ||
instance.uninstall(); | ||
instance = undefined; | ||
} | ||
} | ||
|
||
export {install, uninstall}; |
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.