Comments (6)
So jQuery is accessing window.window
here, which the mock has replaced with another Proxy. This seems to be not allowed for read-only and non-configurable properties, hence the TypeError. So this can be seen as a bug here, and should be fixed! Thanks for reporting!
Separately, when would I use setupWindowMock vs reset before a test?
I would recommend to always use setupWindowMock
, as long as you use the new testing APIs with support for hooks
!
from ember-window-mock.
Don't think this is related to test setup, but rather something in the mocked window itself goes wrong. Can you please post how your app code uses this addon? In the stack trace above it seems this is the place where you own code does something:
at Class.init (http://localhost:7357/assets/webapp.js:64113:7)
from ember-window-mock.
@simonihmig Thanks! Unfortunately ember tests don't provide clickable stack traces, so I had to scroll to line 64113 of my webapp.js
to find the line. This was the problematic instance:
$(window).on('beforeunload', () => {
this.event('leavepage', { _external: true });
});
Not using the mock here fixed the test. Do you know why this would be an issue?
from ember-window-mock.
Separately, when would I use setupWindowMock
vs reset
before a test?
from ember-window-mock.
@simonihmig any plans to solve this? Or this is a bug in jQuery in your opinion?
from ember-window-mock.
Fixed in #452, confirmed in #454
from ember-window-mock.
Related Issues (20)
- _emberWindowMock.default.location.href is not a function HOT 1
- Tries to create new Proxy of null HOT 2
- IE 11 support HOT 9
- Issue mocking Notification HOT 4
- How to test window.open() HOT 1
- Fails to use with replace HOT 4
- `window.document` cannot be mocked / replaced HOT 4
- Support Embroider
- An in-range update of ember-resolver is breaking the build 🚨 HOT 2
- An in-range update of eslint-plugin-ember is breaking the build 🚨 HOT 2
- Support `window.history` HOT 1
- How do you mock the parent or top properties? HOT 2
- Handle nested setupWindowMock tests HOT 1
- Reported embroider incompatibility
- Impossible to trigger jQuery events on imported window object after v0.6.0 HOT 2
- starting in v0.7.0, setting window.onerror results in TypeError: Illegal invocation HOT 3
- Dependency Dashboard
- Can no longer stub window methods using sinon HOT 1
- Doc: Suggest beforeEach for all tests with QUnit global hooks?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-window-mock.