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

4.3.1 tooltip - null is not an object (evaluating 'createdDocument.body') #28695

Closed
brettwgreen opened this issue Apr 26, 2019 · 4 comments
Closed
Labels

Comments

@brettwgreen
Copy link

MacOS v10.14.3 Mojave
Jasmine Test runner

After upgrading to 4.3.1 to deal with security issue concerning tooltips, we now get this error when running our test suite:

null is not an object (evaluating 'createdDocument.body')

In our setup, which is pulling in bootstrap 4.3.1 into a rails project using boostrap gem, it reports error as happening in line 159 of boostrap.js when running jasmine tests.

Note that the User Interface using Chrome works just fine... this is strictly a test failure.

Someone reported something similar over on the rubygems wrapper:
twbs/bootstrap-rubygem#171

@XhmikosR XhmikosR added the js label Apr 27, 2019
@Johann-S
Copy link
Member

Hi @brettwgreen,

What do you use to run your unit tests with Jasmine ? PhantomJS ? Chromium ?
Because according to the error message it seems the environment where you run your unit tests doesn't support well DOMParser

@brettwgreen
Copy link
Author

It is PhantomJS.

The testing scenario feeds in partial HTML as a test fixture. I suspect, but am not sure, that because you don't have a complete HTML document but just partial HTML, that this particular bit of code that uses createdDocument.body (part of the new code that validates the tooltip HTML), chokes on one of those lines.

I've worked around it, for now, by modifying my javascript to disable tooltips when in test context since this is not the focus of the test.

@Johann-S
Copy link
Member

As I thought, it's related to PhantomJS which do not support parseFromString with type html (https://stackoverflow.com/questions/30716495/how-to-use-domparser-in-phantomjs).

You should think about adding a Polyfill or switching from PhantomJS to real browsers for your unit tests because PhantomJS is unmaintained.

@brettwgreen
Copy link
Author

Thank you for digging into it... I will consider alternatives to Phantom

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

3 participants