Skip to content

Commit

Permalink
fix: checking that the list of modules is an array (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed Dec 24, 2019
1 parent aa418dd commit 1138ed7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/runtime/injectStylesIntoStyleTag.js
Expand Up @@ -47,6 +47,10 @@ const getTarget = (function getTarget() {
})();

function addModulesToDom(id, list, options) {
if (Object.prototype.toString.call(list) !== '[object Array]') {
return;
}

id = options.base ? id + options.base : id;

if (!stylesInDom[id]) {
Expand Down
@@ -1,5 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`addStyle issue 447 1`] = `"<head><title>Title</title></head><body><h1>Hello world</h1></body>"`;

exports[`addStyle should throw error with incorrect "insert" option 1`] = `"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."`;

exports[`addStyle should throw error with invalid "insert" option 1`] = `"'#test><><><' is not a valid selector"`;
Expand Down
6 changes: 6 additions & 0 deletions test/runtime/injectStylesIntoStyleTag.test.js
Expand Up @@ -706,4 +706,10 @@ describe('addStyle', () => {

expect(document.documentElement.innerHTML).toMatchSnapshot();
});

it('issue 447', () => {
injectStylesIntoStyleTag(getId(), {});

expect(document.documentElement.innerHTML).toMatchSnapshot();
});
});

0 comments on commit 1138ed7

Please sign in to comment.