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

findTargetElement does not accept SVGElement #75

Closed
adriancooney opened this issue Apr 10, 2018 · 2 comments
Closed

findTargetElement does not accept SVGElement #75

adriancooney opened this issue Apr 10, 2018 · 2 comments
Labels

Comments

@adriancooney
Copy link
Contributor

adriancooney commented Apr 10, 2018

If I pass an SVGElement into assert.dom(<svg element>) and try to run any assertions, it fails because it requires a HTMLElement explicitly. Maybe move up the inheritance chain in the instanceof check to Element rather than HTMLElement?

let svgElement = document.querySelector("svg"); // Element retrieved manually because too complicated for selector
assert.dom(svgElement).hasAttribute("width", "100");

Throws:

TypeError: Unexpected Parameter: [object SVGGElement]
--
  | at DOMAssertions.findTargetElement (http://localhost:7357/assets/test-support.js:22780:15)
  | at DOMAssertions.hasAttribute (http://localhost:7357/assets/test-support.js:22285:26)
  | at Object._callee21$ (http://localhost:7357/assets/tests.js:140150:76)
  | at tryCatch (http://localhost:7357/assets/vendor.js:10983:40)
  | at Generator.invoke [as _invoke] (http://localhost:7357/assets/vendor.js:11274:22)
  | at Generator.prototype.(anonymous function) [as next] (http://localhost:7357/assets/vendor.js:11035:21)
  | at step (http://localhost:7357/assets/tests.js:139513:32)
  | at http://localhost:7357/assets/tests.js:139524:15
  | at <anonymous>
@Turbo87
Copy link
Collaborator

Turbo87 commented Apr 10, 2018

Maybe move up the inheritance chain in the instanceof check to Element rather than HTMLElement?

yeah that sounds like a good solution. can you open a pull request?

@adriancooney
Copy link
Contributor Author

Thanks for the reply @Turbo87. Sure! Just threw one together here: #76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants