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

add default html to test environment #78

Merged
merged 2 commits into from
Oct 8, 2017

Conversation

patrickmichalina
Copy link
Contributor

In order to fix Angular Material tests, a default HTML shell should be used

This change fixes the following console warnings

 PASS  src/client/app/+admin/admin.component.spec.ts
  ● Console

    console.warn node_modules/@angular/material/bundles/material.umd.js:206
      Current document does not have a doctype. This may cause some Angular Material components not to behave as expected.
    console.warn node_modules/@angular/material/bundles/material.umd.js:206
      Current document does not have a doctype. This may cause some Angular Material components not to behave as expected.

screen shot 2017-10-05 at 12 33 40 pm

@@ -13,7 +13,9 @@ class JSDOMEnvironment {
// lazy require
const {JSDOM} = require('jsdom');

this.document = new JSDOM(undefined, {
const html = '<!DOCTYPE HTML><html lang="en"><head><title>Test Environment</title></head><body></body></html>'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, forgot about that! I think we only need the doctype, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that would suffice! Maybe remove the <title></title>

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new JSDOM('<!doctype html>, { should be good :)

@patrickmichalina
Copy link
Contributor Author

Ok, I updated the branch

@thymikee thymikee merged commit 1229bd8 into thymikee:master Oct 8, 2017
@thymikee
Copy link
Owner

thymikee commented Oct 8, 2017

4.0.1 published, enjoy!

sharikovvladislav added a commit to sharikovvladislav/jest-preset-angular that referenced this pull request Nov 28, 2017
* origin/master:
  Adds a warning about html transforms. (thymikee#94)
  Update README to include installation instructions. (thymikee#84)
  Add doctype to test environment (thymikee#78)
  v4.0.0
  v4.0.0 changelog
  Update changelog for master
  v4.0.0-alpha.1
  Use universal zone.js instead of node-only (thymikee#76)
  Add custom environment (thymikee#75)
  Add fakeAsync test
  v3.0.2
  Clarify AngularJS support
  More accurate moduleNameMapper regexps (thymikee#71)
  Update CHANGELOG.md
  v3.0.1
  Bump jest and ts-jest to v21 (thymikee#70)
  v3.0.0
  Tighten up module mappers; bump jest (thymikee#53)
  Add section to troubleshooting about JS files transpiling (thymikee#68)
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 this pull request may close these issues.

2 participants