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

[fix] null value for base tag prevents render #192

Merged
merged 3 commits into from
Nov 16, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Added unit test for innerHTML undefined
  • Loading branch information
cwelch5 committed Nov 16, 2016
commit 355afebe39cca7ef14b4bb78f24e2643e5af8f11
19 changes: 18 additions & 1 deletion src/test/HelmetTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ describe("Helmet", () => {
.that.equals(`<script src="foo.js" async="" ${HELMET_ATTRIBUTE}="true"></script>`);
});

it("won't render tag when primary attribute is null", () => {
it("won't render tag when primary attribute (src) is null", () => {
ReactDOM.render(
<Helmet
script={[
Expand All @@ -1207,6 +1207,23 @@ describe("Helmet", () => {
const existingTags = Array.prototype.slice.call(tagNodes);
expect(existingTags).to.be.empty;
});

it("won't render tag when primary attribute (innerHTML) is null", () => {
ReactDOM.render(
<Helmet
script={[
{
innerHTML: undefined
}
]}
/>,
container
);

const tagNodes = headElement.querySelectorAll(`script[${HELMET_ATTRIBUTE}]`);
const existingTags = Array.prototype.slice.call(tagNodes);
expect(existingTags).to.be.empty;
});
});

describe("noscript tags", () => {
Expand Down