Skip to content

Commit

Permalink
test: Add test for fix
Browse files Browse the repository at this point in the history
  • Loading branch information
karfau committed Sep 1, 2021
1 parent db7dce6 commit 39d90ba
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/parse/__snapshots__/parse-element.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ Object {
}
`;

exports[`XML Node Parse simple attributes should be able to have \`__prototype__\` attribute 1`] = `
Object {
"actual": "<xml __prototype__=\\"\\"/>",
}
`;

exports[`XML Node Parse simple attributes should be able to have \`constructor\` attribute 1`] = `
Object {
"actual": "<xml constructor=\\"\\"/>",
}
`;

exports[`XML Node Parse simple attributes unclosed root tag will be closed 1`] = `
Object {
"actual": "<xml a=\\"1\\" b=\\"2/\\"/>",
Expand Down
20 changes: 20 additions & 0 deletions test/parse/parse-element.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,26 @@ describe('XML Node Parse', () => {

expect({ actual, ...errors }).toMatchSnapshot()
})

it("should be able to have `constructor` attribute", () => {
const { errors, parser } = getTestParser()

const actual = parser
.parseFromString('<xml constructor=""/>', 'text/xml')
.toString()

expect({ actual, ...errors }).toMatchSnapshot()
});

it("should be able to have `__prototype__` attribute", () => {
const { errors, parser } = getTestParser()

const actual = parser
.parseFromString('<xml __prototype__=""/>', 'text/xml')
.toString()

expect({ actual, ...errors }).toMatchSnapshot()
});
})

describe('namespaced attributes', () => {
Expand Down

0 comments on commit 39d90ba

Please sign in to comment.