Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow mocking of 'window' #1011

Closed
wants to merge 2 commits into from
Closed

Allow mocking of 'window' #1011

wants to merge 2 commits into from

Conversation

tjenkinson
Copy link
Contributor

@tjenkinson tjenkinson commented May 31, 2016

refs #1003

Now that I've done this I'm wondering if it might actually make more sense not to have the "base\mocks" module and expect the developer to mock the global window variable when they run their tests instead?@clappr/core ?

This PR allows

var Clappr = require("clappr");
Clappr.mocks.window = myFakeWindow;

var player = new Clappr.Player() //etc

And document with "mocks.window.document", navigator with
"mocks.window.navigator".

Refs #1003
@@ -195,23 +196,31 @@ export function isNumber(value) {
}

export function currentScriptUrl() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to figure out how to do this before this. It needs to be called in the same tick as the script being loaded, but can't be called before the developer has a chance to set their window :/

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 69.72% when pulling 6966729 on feat-mock-window into 8be7b95 on master.

@tjenkinson
Copy link
Contributor Author

Think it makes more sense just to mock the browser completely than add this.

@tjenkinson tjenkinson closed this Jun 5, 2016
@tjenkinson tjenkinson deleted the feat-mock-window branch July 2, 2016 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants