From 535050f7e82b4062b4d003f21085fbdc5a9bb73b Mon Sep 17 00:00:00 2001 From: Christian Bewernitz Date: Sun, 2 Apr 2023 14:06:54 +0200 Subject: [PATCH] test: reduce output by using `getTestWrapper` (#487) and adding snapshots for warnings The additional output was introduced by the new tests in #485 --- .../__snapshots__/parse-element.test.js.snap | 27 +++++++++++++++++++ test/parse/parse-element.test.js | 12 ++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/test/parse/__snapshots__/parse-element.test.js.snap b/test/parse/__snapshots__/parse-element.test.js.snap index 468f4e137..15122c36c 100644 --- a/test/parse/__snapshots__/parse-element.test.js.snap +++ b/test/parse/__snapshots__/parse-element.test.js.snap @@ -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 [ @@ -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": "", diff --git a/test/parse/parse-element.test.js b/test/parse/parse-element.test.js index 679c60b6c..310e34ae6 100644 --- a/test/parse/parse-element.test.js +++ b/test/parse/parse-element.test.js @@ -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( `