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
Fix Node.append
throwing Illegal invocation
#2730
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @danielroe,
Thank you for your contribution to the testcafe-hammerhead
module.
Could you please add tests for the fixed case here
test('Element.prototype.append', function () { |
Also, check the node.append(null)
scenario.
I would love to but suspect you mean @danieltroger 😉 |
It should be fine, no? In that case
If the tests are easy to run I maybe can do it. I wanted to open DevExpress/testcafe#6719 but didn't because I couldn't figure out how to run the right tests and not 300 irrelevant ones. How can I run that specific test? |
This will raise an unhandled exception due to the
You don't need to write tests in the
To run tests you need to execute 2 gulp tasks: gulp build and gulp gulp test-client . After that, in your terminal, you will see the URL that you must open in a browser. Then you need to run client QUnit tests.
|
Ah, fair point. Doing
Ok thanks I'll try it out |
Usually, we use the
You changes breaks the existing use case. Please fix this. |
It seems like the issue is that the function which I changed is used in both Changing this would require quite some digging and learning the undocumented inner workings of testcafe. I'd appreciate if you could take care of it. I've already debugged, identified and solved the issue for my case and just thought I'd share so that you don't have to do the work again when the next person opens an issue about it. |
Purpose
Fix our tests failing while the javascript code works outside of hammerhead
Example stack trace:
This happens when calling
Element.append
with a number or object as arguments. This gets serialized to text in JS but hammerhead assumes it's a node because a check wrongly assumes everything that's not a string is a node.Approach
Change the check to assume everything that's not
instanceof Node
is not a node.References
https://developer.mozilla.org/en-US/docs/Web/API/Element/append
Valid code:
div.append(123)
,div.append({hi: "test"});
<- this fails the checkPre-Merge TODO