Skip to content

Commit

Permalink
fix(deps): bump html-dom-parser from 5.0.10 to 5.0.11 (#1623)
Browse files Browse the repository at this point in the history
Fixes #864
Closes #1617
  • Loading branch information
dependabot[bot] authored Dec 4, 2024
1 parent 86d571d commit f11fa35
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 10 deletions.
57 changes: 57 additions & 0 deletions __tests__/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`HTMLReactParser parses HTML with newlines 1`] = `
[
"
",
<br />,
]
`;

exports[`HTMLReactParser parses HTML with newlines 2`] = `
[
<br />,
"
",
]
`;

exports[`HTMLReactParser parses HTML with newlines 3`] = `
[
"
",
<br />,
"
",
]
`;

exports[`HTMLReactParser parses HTML with newlines 4`] = `
<p>
foo
bar
</p>
`;

exports[`HTMLReactParser parses HTML with newlines 5`] = `
[
<p>
foo
</p>,
"
bar",
]
`;

exports[`HTMLReactParser parses HTML with newlines 6`] = `
[
"foo",
<p>
bar
</p>,
"
",
]
`;
25 changes: 21 additions & 4 deletions __tests__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,30 @@ describe('HTMLReactParser', () => {
},
);

it('parses "" to []', () => {
it('parses empty string to empty array', () => {
expect(parse('')).toEqual([]);
});

it("returns string if it's not HTML", () => {
const string = 'text';
expect(parse(string)).toBe(string);
it.each(['a', 'text'])('parses string', (text) => {
expect(parse(text)).toBe(text);
});

it.each(['\n', '\r', '\n\r', 'foo\nbar', 'foo\rbar', 'foo\n\rbar\r'])(
'parses string with newlines %p',
(text) => {
expect(parse(text)).toBe(text);
},
);

it.each([
'\n<br>',
'<br>\r',
'\n<br>\r',
'<p>foo\nbar\r</p>',
'<p>foo</p>\rbar',
'foo<p>\n\rbar</p>\r',
])('parses HTML with newlines', (html) => {
expect(parse(html)).toMatchSnapshot();
});

it('parses single HTML element', () => {
Expand Down
9 changes: 4 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
],
"dependencies": {
"domhandler": "5.0.3",
"html-dom-parser": "5.0.10",
"html-dom-parser": "5.0.11",
"react-property": "2.0.2",
"style-to-js": "1.1.16"
},
Expand Down

0 comments on commit f11fa35

Please sign in to comment.