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

addEventListener is missing in XHRRequest mock #7

Open
skiraikou opened this issue Sep 7, 2018 · 3 comments · May be fixed by #23
Open

addEventListener is missing in XHRRequest mock #7

skiraikou opened this issue Sep 7, 2018 · 3 comments · May be fixed by #23

Comments

@skiraikou
Copy link

We were trying to use it in ng6 app test
But got error regarding missing addEventListener method

i was able to fix it using

addEventListener: function(callback) {
        this.object.addEventListener(callback);
    }
@chauey
Copy link

chauey commented Jul 12, 2019

This might be what I'm looking for to get past the error with Angular about
"ERROR TypeError: xhr.addEventListener is not a function"

Will try it out, thx!

@joenguyenalogent
Copy link

something like this in installCypressHooks.js at line 329 inside FakeXMLHttpRequest.prototype?

addEventListener: function(type, callback) {
this.object.addEventListener(type, callback);
},

removeEventListener: function(type, callback) {
this.object.removeEventListener(type, callback);
}

@ivanpadavan
Copy link

ivanpadavan commented Mar 2, 2020

installCypressHooks.js 330 add
this['on' + type] = callback;
to make it work in angular app
#23

@ivanpadavan ivanpadavan linked a pull request Mar 2, 2020 that will close this issue
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 a pull request may close this issue.

4 participants