Skip to content

Commit

Permalink
test: reduce output by using getTestWrapper (#487)
Browse files Browse the repository at this point in the history
and adding snapshots for warnings

The additional output was introduced by the new tests in #485
  • Loading branch information
karfau committed Apr 2, 2023
1 parent 5dd3254 commit 535050f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
27 changes: 27 additions & 0 deletions test/parse/__snapshots__/parse-element.test.js.snap
Expand Up @@ -9,6 +9,24 @@ Object {
}
`;

exports[`XML Node Parse closing tag with unquoted value following / 1`] = `
Object {
"warning": Array [
"[xmldom warning] attribute \\"lazy\\" missed quot(\\")!
@#[line:3,col:3]",
],
}
`;

exports[`XML Node Parse closing tag with unquoted value following space and / 1`] = `
Object {
"warning": Array [
"[xmldom warning] attribute \\"lazy\\" missed quot(\\")!!
@#[line:3,col:3]",
],
}
`;

exports[`XML Node Parse closing tag with unquoted value including / followed by space / 1`] = `
Object {
"warning": Array [
Expand All @@ -18,6 +36,15 @@ Object {
}
`;

exports[`XML Node Parse closing tag without attribute value 1`] = `
Object {
"warning": Array [
"[xmldom warning] attribute \\"lazy\\" missed value!! \\"lazy\\" instead!!
@#[line:3,col:3]",
],
}
`;

exports[`XML Node Parse namespaced attributes unclosed root tag will be closed 1`] = `
Object {
"actual": "<xml xmlns=\\"1\\" xmlns:a=\\"2\\" a:test=\\"3/\\"/>",
Expand Down
12 changes: 9 additions & 3 deletions test/parse/parse-element.test.js
Expand Up @@ -40,7 +40,8 @@ describe('XML Node Parse', () => {
});

it('closing tag without attribute value', () => {
const actual = new DOMParser()
const { errors, parser } = getTestParser();
const actual = parser
.parseFromString(
`<template>
<view>
Expand All @@ -51,6 +52,7 @@ describe('XML Node Parse', () => {
'text/xml'
)
.toString();
expect(errors).toMatchSnapshot();
expect(actual).toBe(
`<template>
<view>
Expand All @@ -61,7 +63,8 @@ describe('XML Node Parse', () => {
);
});
it('closing tag with unquoted value following /', () => {
const actual = new DOMParser()
const { errors, parser } = getTestParser();
const actual = parser
.parseFromString(
`<template>
<view>
Expand All @@ -72,6 +75,7 @@ describe('XML Node Parse', () => {
'text/xml'
)
.toString();
expect(errors).toMatchSnapshot();
expect(actual).toBe(
`<template>
<view>
Expand All @@ -82,7 +86,8 @@ describe('XML Node Parse', () => {
);
});
it('closing tag with unquoted value following space and /', () => {
const actual = new DOMParser()
const { errors, parser } = getTestParser();
const actual = parser
.parseFromString(
`<template>
<view>
Expand All @@ -93,6 +98,7 @@ describe('XML Node Parse', () => {
'text/xml'
)
.toString();
expect(errors).toMatchSnapshot();
expect(actual).toBe(
`<template>
<view>
Expand Down

0 comments on commit 535050f

Please sign in to comment.