From 3fbf3ccc6c67faace1a42fdca7000570c6ee15d9 Mon Sep 17 00:00:00 2001 From: Yuichiro Yamashita Date: Sat, 31 Dec 2022 16:19:11 +0900 Subject: [PATCH] refactor test --- .../slotted-element-with-ignores/input.svelte | 4 -- .../slotted-element-with-ignores/output.json | 72 ------------------- .../samples/slot-warning-ignore/input.svelte | 8 +++ .../samples/slot-warning-ignore/warnings.json | 1 + .../samples/slot-warning/input.svelte | 7 ++ .../samples/slot-warning/warnings.json | 17 +++++ .../samples/slot-warning2/input.svelte | 8 +++ .../samples/slot-warning2/warnings.json | 17 +++++ 8 files changed, 58 insertions(+), 76 deletions(-) delete mode 100644 test/parser/samples/slotted-element-with-ignores/input.svelte delete mode 100644 test/parser/samples/slotted-element-with-ignores/output.json create mode 100644 test/validator/samples/slot-warning-ignore/input.svelte create mode 100644 test/validator/samples/slot-warning-ignore/warnings.json create mode 100644 test/validator/samples/slot-warning/input.svelte create mode 100644 test/validator/samples/slot-warning/warnings.json create mode 100644 test/validator/samples/slot-warning2/input.svelte create mode 100644 test/validator/samples/slot-warning2/warnings.json diff --git a/test/parser/samples/slotted-element-with-ignores/input.svelte b/test/parser/samples/slotted-element-with-ignores/input.svelte deleted file mode 100644 index cfa1c38d13..0000000000 --- a/test/parser/samples/slotted-element-with-ignores/input.svelte +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/test/parser/samples/slotted-element-with-ignores/output.json b/test/parser/samples/slotted-element-with-ignores/output.json deleted file mode 100644 index da0739ca77..0000000000 --- a/test/parser/samples/slotted-element-with-ignores/output.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "html": { - "start": 0, - "end": 92, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 92, - "type": "InlineComponent", - "name": "Component", - "attributes": [], - "children": [ - { - "start": 11, - "end": 13, - "type": "Text", - "raw": "\n\t", - "data": "\n\t" - }, - { - "start": 13, - "end": 58, - "type": "Comment", - "data": " svelte-ignore a11y-missing-attribute ", - "ignores": [ - "a11y-missing-attribute" - ] - }, - { - "start": 58, - "end": 61, - "type": "Text", - "raw": " \n\t", - "data": " \n\t" - }, - { - "start": 61, - "end": 79, - "type": "Element", - "name": "a", - "attributes": [ - { - "start": 64, - "end": 74, - "type": "Attribute", - "name": "slot", - "value": [ - { - "start": 70, - "end": 73, - "type": "Text", - "raw": "foo", - "data": "foo" - } - ] - } - ], - "children": [] - }, - { - "start": 79, - "end": 80, - "type": "Text", - "raw": "\n", - "data": "\n" - } - ] - } - ] - } -} diff --git a/test/validator/samples/slot-warning-ignore/input.svelte b/test/validator/samples/slot-warning-ignore/input.svelte new file mode 100644 index 0000000000..003b5bde63 --- /dev/null +++ b/test/validator/samples/slot-warning-ignore/input.svelte @@ -0,0 +1,8 @@ + + + + +
hi!
+
diff --git a/test/validator/samples/slot-warning-ignore/warnings.json b/test/validator/samples/slot-warning-ignore/warnings.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/test/validator/samples/slot-warning-ignore/warnings.json @@ -0,0 +1 @@ +[] diff --git a/test/validator/samples/slot-warning/input.svelte b/test/validator/samples/slot-warning/input.svelte new file mode 100644 index 0000000000..3d60236edc --- /dev/null +++ b/test/validator/samples/slot-warning/input.svelte @@ -0,0 +1,7 @@ + + + +
hi!
+
diff --git a/test/validator/samples/slot-warning/warnings.json b/test/validator/samples/slot-warning/warnings.json new file mode 100644 index 0000000000..14691b4231 --- /dev/null +++ b/test/validator/samples/slot-warning/warnings.json @@ -0,0 +1,17 @@ +[ + { + "code": "a11y-click-events-have-key-events", + "message": "A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.", + "start": { + "character": 78, + "column": 1, + "line": 6 + }, + "end": { + "character": 112, + "column": 35, + "line": 6 + }, + "pos": 78 + } +] diff --git a/test/validator/samples/slot-warning2/input.svelte b/test/validator/samples/slot-warning2/input.svelte new file mode 100644 index 0000000000..ab3c52d35d --- /dev/null +++ b/test/validator/samples/slot-warning2/input.svelte @@ -0,0 +1,8 @@ + + + + +
hi!
+
diff --git a/test/validator/samples/slot-warning2/warnings.json b/test/validator/samples/slot-warning2/warnings.json new file mode 100644 index 0000000000..5554c3f764 --- /dev/null +++ b/test/validator/samples/slot-warning2/warnings.json @@ -0,0 +1,17 @@ +[ + { + "code": "a11y-click-events-have-key-events", + "message": "A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.", + "start": { + "character": 120, + "column": 1, + "line": 7 + }, + "end": { + "character": 154, + "column": 35, + "line": 7 + }, + "pos": 120 + } +]