-
Notifications
You must be signed in to change notification settings - Fork 174
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
EventTarget.prototype.addEventListener is not overridden #1902
Comments
Hello, @bbonczek. |
The issue seems to be connected to the function patchEventTargetMethods(obj, patchOptions)
...
// proto: EventTarget {addEventListener: ƒ, removeEventListener: ƒ, dispatchEvent: ƒ, __zone_symbol__addEventListener: ƒ, __zone_symbol__removeEventListener: ƒ, …}
proto[ADD_EVENT_LISTENER] = makeAddListener(nativeAddEventListener, ADD_EVENT_LISTENER_SOURCE, customSchedule, customCancel, returnTarget); The test below is based on Chrome's native behavior: if (!browserUtils.isIE11) {
test('patch EventTarget methods on the client side (GH-1902)', function () {
var savedMeth = window.EventTarget.prototype.addEventListener;
var xhr = new XMLHttpRequest();
var patchedMeth = function () {
return 'patched';
};
strictEqual(window.addEventListener, window.EventTarget.prototype.addEventListener);
strictEqual(window.document.addEventListener, window.EventTarget.prototype.addEventListener);
strictEqual(window.document.body.addEventListener, window.EventTarget.prototype.addEventListener);
strictEqual(Object.getPrototypeOf(xhr).addEventListener, window.EventTarget.prototype.addEventListener);
window.EventTarget.prototype.addEventListener = patchedMeth;
strictEqual(window.addEventListener, patchedMeth);
strictEqual(window.document.addEventListener, patchedMeth);
strictEqual(window.document.body.addEventListener, patchedMeth);
strictEqual(Object.getPrototypeOf(xhr).addEventListener, patchedMeth);
window.EventTarget.prototype.addEventListener = savedMeth;
});
} We will consider fixing this issue in future sprints. |
Same problem on this site with Angular. |
…1902) (#2203) * Fix 'EventTarget.prototype.addEventListener is not overridden' (close #1902) * rewrite "template literals" as string concatenation * Refactror: _getNativeAddEventListener, _getNativeRemoveEventListener * Fix the "SVGElement.dispatchEvent should be overriden" test * eventTargetDispatchEvent, native XHR * xhr event methods, refactor * Add the `dispatchEvent` test case * Fix review 1 * Combine IE and non-IE cases * Naming, requested changes * Requested changes, naming * Requested changes * Fix comment
Wait for DevExpress/testcafe#4614 |
This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow. |
What is your Test Scenario?
I'd like to test, whether screen size is bigger then 800px;
What is the Current behavior?
It works properly in regular browser (chrome without testcafe), but it does not when running testcafe test.
What is the Expected behavior?
My code should run consistently both in testcafe and in regular browser
What is your web application and your TestCafe test code?
https://github.com/bbonczek/testcafe-change-detection-issue
Steps to Reproduce:
You need to compare this app in regular browser and in testcafe browser. Clone repository and run
npm run install
Next thing you want to do is run application in normal browser. You can do it by running
npm run start
and navigating to localhost:4200
try to resize window, to change it's height - you should see value switching beetween true and false:
You can see mp4 version here: https://ezgif.com/video-to-gif/ezgif-2-271f5333a3b8.mp4
Now let's try to do the same, but in testcafe test. Don't stop dev server. Open other console and run
npm run testcafe
Test will go into debug just after page loads. Click
![not working case in testcafe chrome browser](https://user-images.githubusercontent.com/11254976/51381379-499f8e00-1b14-11e9-80a2-0526e876961a.gif)
Unlock Page
and try resizing again- this time nothing will happen:mp4 version is here:
https://ezgif.com/video-to-gif/ezgif-2-37d0daf5224f.mp4
Your Environment details:
The text was updated successfully, but these errors were encountered: