diff --git a/tests/fixtures/common/ComplexExpression.expected.json b/tests/fixtures/common/ComplexExpression.expected.json new file mode 100644 index 0000000..ec9c873 --- /dev/null +++ b/tests/fixtures/common/ComplexExpression.expected.json @@ -0,0 +1,43 @@ +{ + "filename": "ComplexExpression.svelte", + "parsed": true, + "error": null, + "warnings": [ + { + "filename": "ComplexExpression.svelte", + "message": "Unsafe raw HTML insertion without sanitizer", + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 22 + } + }, + { + "filename": "ComplexExpression.svelte", + "message": "Unsafe raw HTML insertion without sanitizer", + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 29 + } + }, + { + "filename": "ComplexExpression.svelte", + "message": "Unsafe raw HTML insertion without sanitizer", + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 36 + } + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/common/ComplexExpression.svelte b/tests/fixtures/common/ComplexExpression.svelte new file mode 100644 index 0000000..d649ea1 --- /dev/null +++ b/tests/fixtures/common/ComplexExpression.svelte @@ -0,0 +1,9 @@ + + +
+ {@html obj.content} + {@html obj.content.trim()} + {@html obj.content.toUpperCase()} +
diff --git a/tests/fixtures/common/ComplexExpressionWithComment.expected.json b/tests/fixtures/common/ComplexExpressionWithComment.expected.json new file mode 100644 index 0000000..f4f6d27 --- /dev/null +++ b/tests/fixtures/common/ComplexExpressionWithComment.expected.json @@ -0,0 +1,19 @@ +{ + "filename": "ComplexExpressionWithComment.svelte", + "parsed": true, + "error": null, + "warnings": [ + { + "filename": "ComplexExpressionWithComment.svelte", + "message": "Unsafe raw HTML insertion without sanitizer", + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 36 + } + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/common/ComplexExpressionWithComment.svelte b/tests/fixtures/common/ComplexExpressionWithComment.svelte new file mode 100644 index 0000000..6534924 --- /dev/null +++ b/tests/fixtures/common/ComplexExpressionWithComment.svelte @@ -0,0 +1,11 @@ + + +
+ + {@html obj.content} + + {@html obj.content.trim()} + {@html obj.content.toUpperCase()} +
diff --git a/tests/fixtures/common/OneUnsafeWithIgnoreComment.expected.json b/tests/fixtures/common/Empty.expected.json similarity index 53% rename from tests/fixtures/common/OneUnsafeWithIgnoreComment.expected.json rename to tests/fixtures/common/Empty.expected.json index b55e1eb..6e2ca39 100644 --- a/tests/fixtures/common/OneUnsafeWithIgnoreComment.expected.json +++ b/tests/fixtures/common/Empty.expected.json @@ -1,5 +1,5 @@ { - "filename": "OneUnsafeWithIgnoreComment.svelte", + "filename": "Empty.svelte", "parsed": true, "error": null, "warnings": [] diff --git a/tests/fixtures/common/Empty.svelte b/tests/fixtures/common/Empty.svelte new file mode 100644 index 0000000..e69de29 diff --git a/tests/fixtures/common/EmptyWithComment.expected.json b/tests/fixtures/common/EmptyWithComment.expected.json new file mode 100644 index 0000000..a476f7b --- /dev/null +++ b/tests/fixtures/common/EmptyWithComment.expected.json @@ -0,0 +1,6 @@ +{ + "filename": "EmptyWithComment.svelte", + "parsed": true, + "error": null, + "warnings": [] +} \ No newline at end of file diff --git a/tests/fixtures/common/EmptyWithComment.svelte b/tests/fixtures/common/EmptyWithComment.svelte new file mode 100644 index 0000000..011f768 --- /dev/null +++ b/tests/fixtures/common/EmptyWithComment.svelte @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tests/fixtures/common/InComments.expected.json b/tests/fixtures/common/InComments.expected.json new file mode 100644 index 0000000..76ef4f2 --- /dev/null +++ b/tests/fixtures/common/InComments.expected.json @@ -0,0 +1,6 @@ +{ + "filename": "InComments.svelte", + "parsed": true, + "error": null, + "warnings": [] +} \ No newline at end of file diff --git a/tests/fixtures/common/InComments.svelte b/tests/fixtures/common/InComments.svelte new file mode 100644 index 0000000..05ad880 --- /dev/null +++ b/tests/fixtures/common/InComments.svelte @@ -0,0 +1,8 @@ + + + +
Normal content
diff --git a/tests/fixtures/common/InsideEach.expected.json b/tests/fixtures/common/InsideEach.expected.json new file mode 100644 index 0000000..107effe --- /dev/null +++ b/tests/fixtures/common/InsideEach.expected.json @@ -0,0 +1,19 @@ +{ + "filename": "InsideEach.svelte", + "parsed": true, + "error": null, + "warnings": [ + { + "filename": "InsideEach.svelte", + "message": "Unsafe raw HTML insertion without sanitizer", + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 23 + } + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/common/InsideEach.svelte b/tests/fixtures/common/InsideEach.svelte new file mode 100644 index 0000000..4753952 --- /dev/null +++ b/tests/fixtures/common/InsideEach.svelte @@ -0,0 +1,11 @@ + + +{#each items as item} + {@html item.content} +{/each} \ No newline at end of file diff --git a/tests/fixtures/common/InsideEachWithComment.expected.json b/tests/fixtures/common/InsideEachWithComment.expected.json new file mode 100644 index 0000000..0684b8b --- /dev/null +++ b/tests/fixtures/common/InsideEachWithComment.expected.json @@ -0,0 +1,6 @@ +{ + "filename": "InsideEachWithComment.svelte", + "parsed": true, + "error": null, + "warnings": [] +} \ No newline at end of file diff --git a/tests/fixtures/common/InsideEachWithComment.svelte b/tests/fixtures/common/InsideEachWithComment.svelte new file mode 100644 index 0000000..6ca5b92 --- /dev/null +++ b/tests/fixtures/common/InsideEachWithComment.svelte @@ -0,0 +1,12 @@ + + +{#each items as item} + + {@html item.content} +{/each} \ No newline at end of file diff --git a/tests/fixtures/common/InsideIf.expected.json b/tests/fixtures/common/InsideIf.expected.json new file mode 100644 index 0000000..0fc974d --- /dev/null +++ b/tests/fixtures/common/InsideIf.expected.json @@ -0,0 +1,19 @@ +{ + "filename": "InsideIf.svelte", + "parsed": true, + "error": null, + "warnings": [ + { + "filename": "InsideIf.svelte", + "message": "Unsafe raw HTML insertion without sanitizer", + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 39 + } + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/common/InsideIf.svelte b/tests/fixtures/common/InsideIf.svelte new file mode 100644 index 0000000..b9716d7 --- /dev/null +++ b/tests/fixtures/common/InsideIf.svelte @@ -0,0 +1,9 @@ + + +
+ {#if insideIf} + {@html "Inside If"} + {/if} +
diff --git a/tests/fixtures/common/InsideIfWithComment.expected.json b/tests/fixtures/common/InsideIfWithComment.expected.json new file mode 100644 index 0000000..168a14a --- /dev/null +++ b/tests/fixtures/common/InsideIfWithComment.expected.json @@ -0,0 +1,6 @@ +{ + "filename": "InsideIfWithComment.svelte", + "parsed": true, + "error": null, + "warnings": [] +} \ No newline at end of file diff --git a/tests/fixtures/common/InsideIfWithComment.svelte b/tests/fixtures/common/InsideIfWithComment.svelte new file mode 100644 index 0000000..601b0f6 --- /dev/null +++ b/tests/fixtures/common/InsideIfWithComment.svelte @@ -0,0 +1,10 @@ + + +
+ {#if insideIf} + + {@html "Inside If"} + {/if} +
diff --git a/tests/fixtures/common/MalformedHTML.expected.json b/tests/fixtures/common/MalformedHTML.expected.json new file mode 100644 index 0000000..0c2fc9b --- /dev/null +++ b/tests/fixtures/common/MalformedHTML.expected.json @@ -0,0 +1,6 @@ +{ + "filename": "MalformedHTML.svelte", + "parsed": true, + "error": null, + "warnings": [] +} \ No newline at end of file diff --git a/tests/fixtures/common/MalformedHTML.svelte b/tests/fixtures/common/MalformedHTML.svelte new file mode 100644 index 0000000..c022460 --- /dev/null +++ b/tests/fixtures/common/MalformedHTML.svelte @@ -0,0 +1 @@ +
oops
\ No newline at end of file diff --git a/tests/fixtures/common/Multiline.expected.json b/tests/fixtures/common/Multiline.expected.json new file mode 100644 index 0000000..8fd0842 --- /dev/null +++ b/tests/fixtures/common/Multiline.expected.json @@ -0,0 +1,19 @@ +{ + "filename": "Multiline.svelte", + "parsed": true, + "error": null, + "warnings": [ + { + "filename": "Multiline.svelte", + "message": "Unsafe raw HTML insertion without sanitizer", + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 34 + } + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/common/Multiline.svelte b/tests/fixtures/common/Multiline.svelte new file mode 100644 index 0000000..e6adbd5 --- /dev/null +++ b/tests/fixtures/common/Multiline.svelte @@ -0,0 +1,5 @@ +
+ {@html + "

This is line one.

" + } +
\ No newline at end of file diff --git a/tests/fixtures/common/MultilineWithComment.expected.json b/tests/fixtures/common/MultilineWithComment.expected.json new file mode 100644 index 0000000..699b711 --- /dev/null +++ b/tests/fixtures/common/MultilineWithComment.expected.json @@ -0,0 +1,6 @@ +{ + "filename": "MultilineWithComment.svelte", + "parsed": true, + "error": null, + "warnings": [] +} \ No newline at end of file diff --git a/tests/fixtures/common/MultilineWithComment.svelte b/tests/fixtures/common/MultilineWithComment.svelte new file mode 100644 index 0000000..8d35eff --- /dev/null +++ b/tests/fixtures/common/MultilineWithComment.svelte @@ -0,0 +1,6 @@ +
+ + {@html + "

This is line one.

" + } +
\ No newline at end of file diff --git a/tests/fixtures/common/NoIssues.expected.json b/tests/fixtures/common/NoIssues.expected.json new file mode 100644 index 0000000..91f5141 --- /dev/null +++ b/tests/fixtures/common/NoIssues.expected.json @@ -0,0 +1,6 @@ +{ + "filename": "NoIssues.svelte", + "parsed": true, + "error": null, + "warnings": [] +} \ No newline at end of file diff --git a/tests/fixtures/common/NoIssues.svelte b/tests/fixtures/common/NoIssues.svelte new file mode 100644 index 0000000..5a95591 --- /dev/null +++ b/tests/fixtures/common/NoIssues.svelte @@ -0,0 +1,8 @@ + + +
+ {text} +

No @html here

+
diff --git a/tests/fixtures/common/NoIssuesWithComment.expected.json b/tests/fixtures/common/NoIssuesWithComment.expected.json new file mode 100644 index 0000000..2acd44e --- /dev/null +++ b/tests/fixtures/common/NoIssuesWithComment.expected.json @@ -0,0 +1,6 @@ +{ + "filename": "NoIssuesWithComment.svelte", + "parsed": true, + "error": null, + "warnings": [] +} \ No newline at end of file diff --git a/tests/fixtures/common/NoIssuesWithComment.svelte b/tests/fixtures/common/NoIssuesWithComment.svelte new file mode 100644 index 0000000..ac71a5d --- /dev/null +++ b/tests/fixtures/common/NoIssuesWithComment.svelte @@ -0,0 +1,9 @@ + + +
+ {text} + +

No @html here

+
diff --git a/tests/fixtures/common/OneUnsafeWithComment.expected.json b/tests/fixtures/common/OneUnsafeWithComment.expected.json new file mode 100644 index 0000000..eba0806 --- /dev/null +++ b/tests/fixtures/common/OneUnsafeWithComment.expected.json @@ -0,0 +1,6 @@ +{ + "filename": "OneUnsafeWithComment.svelte", + "parsed": true, + "error": null, + "warnings": [] +} \ No newline at end of file diff --git a/tests/fixtures/common/OneUnsafeWithIgnoreComment.svelte b/tests/fixtures/common/OneUnsafeWithComment.svelte similarity index 100% rename from tests/fixtures/common/OneUnsafeWithIgnoreComment.svelte rename to tests/fixtures/common/OneUnsafeWithComment.svelte diff --git a/tests/fixtures/common/RTLInsideHTML.expected.json b/tests/fixtures/common/RTLInsideHTML.expected.json new file mode 100644 index 0000000..0974aa8 --- /dev/null +++ b/tests/fixtures/common/RTLInsideHTML.expected.json @@ -0,0 +1,19 @@ +{ + "filename": "RTLInsideHTML.svelte", + "parsed": true, + "error": null, + "warnings": [ + { + "filename": "RTLInsideHTML.svelte", + "message": "Unsafe raw HTML insertion without sanitizer", + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 26 + } + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/common/RTLInsideHTML.svelte b/tests/fixtures/common/RTLInsideHTML.svelte new file mode 100644 index 0000000..13f7c3b --- /dev/null +++ b/tests/fixtures/common/RTLInsideHTML.svelte @@ -0,0 +1 @@ +{@html "

שלום مرحبا

"} \ No newline at end of file diff --git a/tests/fixtures/common/RTLNormalText.expected.json b/tests/fixtures/common/RTLNormalText.expected.json new file mode 100644 index 0000000..71773da --- /dev/null +++ b/tests/fixtures/common/RTLNormalText.expected.json @@ -0,0 +1,6 @@ +{ + "filename": "RTLNormalText.svelte", + "parsed": true, + "error": null, + "warnings": [] +} \ No newline at end of file diff --git a/tests/fixtures/common/RTLNormalText.svelte b/tests/fixtures/common/RTLNormalText.svelte new file mode 100644 index 0000000..4ab450d --- /dev/null +++ b/tests/fixtures/common/RTLNormalText.svelte @@ -0,0 +1 @@ +

שלום مرحبا

\ No newline at end of file diff --git a/tests/fixtures/common/TwoUnsafeWithScript.expected.json b/tests/fixtures/common/TwoUnsafeWithScript.expected.json new file mode 100644 index 0000000..0d23a59 --- /dev/null +++ b/tests/fixtures/common/TwoUnsafeWithScript.expected.json @@ -0,0 +1,31 @@ +{ + "filename": "TwoUnsafeWithScript.svelte", + "parsed": true, + "error": null, + "warnings": [ + { + "filename": "TwoUnsafeWithScript.svelte", + "message": "Unsafe raw HTML insertion without sanitizer", + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 28 + } + }, + { + "filename": "TwoUnsafeWithScript.svelte", + "message": "Unsafe raw HTML insertion without sanitizer", + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 48 + } + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/common/TwoUnsafeWithScript.svelte b/tests/fixtures/common/TwoUnsafeWithScript.svelte new file mode 100644 index 0000000..d77adc9 --- /dev/null +++ b/tests/fixtures/common/TwoUnsafeWithScript.svelte @@ -0,0 +1,8 @@ + + +

{@html 'Bold Text'}

+ + +

{@html ''}

\ No newline at end of file diff --git a/tests/fixtures/common/WhitespaceVariations.expected.json b/tests/fixtures/common/WhitespaceVariations.expected.json new file mode 100644 index 0000000..97eb4dd --- /dev/null +++ b/tests/fixtures/common/WhitespaceVariations.expected.json @@ -0,0 +1,43 @@ +{ + "filename": "WhitespaceVariations.svelte", + "parsed": true, + "error": null, + "warnings": [ + { + "filename": "WhitespaceVariations.svelte", + "message": "Unsafe raw HTML insertion without sanitizer", + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 15 + } + }, + { + "filename": "WhitespaceVariations.svelte", + "message": "Unsafe raw HTML insertion without sanitizer", + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 18 + } + }, + { + "filename": "WhitespaceVariations.svelte", + "message": "Unsafe raw HTML insertion without sanitizer", + "start": { + "line": 8, + "column": 13 + }, + "end": { + "line": 8, + "column": 17 + } + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/common/WhitespaceVariations.svelte b/tests/fixtures/common/WhitespaceVariations.svelte new file mode 100644 index 0000000..cf19141 --- /dev/null +++ b/tests/fixtures/common/WhitespaceVariations.svelte @@ -0,0 +1,9 @@ + + +
+ {@html html} + {@html html } + { @html html } +
\ No newline at end of file