Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions tests/fixtures/common/ComplexExpression.expected.json
Original file line number Diff line number Diff line change
@@ -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
}
}
]
}
9 changes: 9 additions & 0 deletions tests/fixtures/common/ComplexExpression.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script>
let obj = { content: "<div>Test</div>" };
</script>

<div>
{@html obj.content}
{@html obj.content.trim()}
{@html obj.content.toUpperCase()}
</div>
19 changes: 19 additions & 0 deletions tests/fixtures/common/ComplexExpressionWithComment.expected.json
Original file line number Diff line number Diff line change
@@ -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
}
}
]
}
11 changes: 11 additions & 0 deletions tests/fixtures/common/ComplexExpressionWithComment.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script>
let obj = { content: "<div>Test</div>" };
</script>

<div>
<!-- svelte-ignore unsafe_html -->
{@html obj.content}
<!-- svelte-ignore unsafe_html -->
{@html obj.content.trim()}
{@html obj.content.toUpperCase()}
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"filename": "OneUnsafeWithIgnoreComment.svelte",
"filename": "Empty.svelte",
"parsed": true,
"error": null,
"warnings": []
Expand Down
Empty file.
6 changes: 6 additions & 0 deletions tests/fixtures/common/EmptyWithComment.expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"filename": "EmptyWithComment.svelte",
"parsed": true,
"error": null,
"warnings": []
}
1 change: 1 addition & 0 deletions tests/fixtures/common/EmptyWithComment.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- This is empty file with comment. -->
6 changes: 6 additions & 0 deletions tests/fixtures/common/InComments.expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"filename": "InComments.svelte",
"parsed": true,
"error": null,
"warnings": []
}
8 changes: 8 additions & 0 deletions tests/fixtures/common/InComments.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script>
// {@html commented}
/* {@html blocked} */
let x = 1;
</script>

<!-- {@html inHTMLComment} -->
<div>Normal content</div>
19 changes: 19 additions & 0 deletions tests/fixtures/common/InsideEach.expected.json
Original file line number Diff line number Diff line change
@@ -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
}
}
]
}
11 changes: 11 additions & 0 deletions tests/fixtures/common/InsideEach.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script>
let items = [
{ content: '<strong>Item 1</strong>' },
{ content: '<em>Item 2</em>' },
{ content: '<u>Item 3</u>' }
];
</script>

{#each items as item}
{@html item.content}
{/each}
6 changes: 6 additions & 0 deletions tests/fixtures/common/InsideEachWithComment.expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"filename": "InsideEachWithComment.svelte",
"parsed": true,
"error": null,
"warnings": []
}
12 changes: 12 additions & 0 deletions tests/fixtures/common/InsideEachWithComment.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script>
let items = [
{ content: '<strong>Item 1</strong>' },
{ content: '<em>Item 2</em>' },
{ content: '<u>Item 3</u>' }
];
</script>

{#each items as item}
<!-- svelte-ignore unsafe_html -->
{@html item.content}
{/each}
19 changes: 19 additions & 0 deletions tests/fixtures/common/InsideIf.expected.json
Original file line number Diff line number Diff line change
@@ -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
}
}
]
}
9 changes: 9 additions & 0 deletions tests/fixtures/common/InsideIf.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script>
const insideIf = true;
</script>

<div>
{#if insideIf}
{@html "<span>Inside If</span>"}
{/if}
</div>
6 changes: 6 additions & 0 deletions tests/fixtures/common/InsideIfWithComment.expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"filename": "InsideIfWithComment.svelte",
"parsed": true,
"error": null,
"warnings": []
}
10 changes: 10 additions & 0 deletions tests/fixtures/common/InsideIfWithComment.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script>
const insideIf = true;
</script>

<div>
{#if insideIf}
<!-- svelte-ignore unsafe_html -->
{@html "<span>Inside If</span>"}
{/if}
</div>
6 changes: 6 additions & 0 deletions tests/fixtures/common/MalformedHTML.expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"filename": "MalformedHTML.svelte",
"parsed": true,
"error": null,
"warnings": []
}
1 change: 1 addition & 0 deletions tests/fixtures/common/MalformedHTML.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div><span><b>oops</div>
19 changes: 19 additions & 0 deletions tests/fixtures/common/Multiline.expected.json
Original file line number Diff line number Diff line change
@@ -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
}
}
]
}
5 changes: 5 additions & 0 deletions tests/fixtures/common/Multiline.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div>
{@html
"<p>This is line one.</p>"
}
</div>
6 changes: 6 additions & 0 deletions tests/fixtures/common/MultilineWithComment.expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"filename": "MultilineWithComment.svelte",
"parsed": true,
"error": null,
"warnings": []
}
6 changes: 6 additions & 0 deletions tests/fixtures/common/MultilineWithComment.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div>
<!-- svelte-ignore unsafe_html -->
{@html
"<p>This is line one.</p>"
}
</div>
6 changes: 6 additions & 0 deletions tests/fixtures/common/NoIssues.expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"filename": "NoIssues.svelte",
"parsed": true,
"error": null,
"warnings": []
}
8 changes: 8 additions & 0 deletions tests/fixtures/common/NoIssues.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script>
let text = "Safe text";
</script>

<div>
{text}
<p>No @html here</p>
</div>
6 changes: 6 additions & 0 deletions tests/fixtures/common/NoIssuesWithComment.expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"filename": "NoIssuesWithComment.svelte",
"parsed": true,
"error": null,
"warnings": []
}
9 changes: 9 additions & 0 deletions tests/fixtures/common/NoIssuesWithComment.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script>
let text = "Safe text";
</script>

<div>
{text}
<!-- svelte-ignore unsafe_html -->
<p>No @html here</p>
</div>
6 changes: 6 additions & 0 deletions tests/fixtures/common/OneUnsafeWithComment.expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"filename": "OneUnsafeWithComment.svelte",
"parsed": true,
"error": null,
"warnings": []
}
19 changes: 19 additions & 0 deletions tests/fixtures/common/RTLInsideHTML.expected.json
Original file line number Diff line number Diff line change
@@ -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
}
}
]
}
1 change: 1 addition & 0 deletions tests/fixtures/common/RTLInsideHTML.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{@html "<p>שלום مرحبا</p>"}
6 changes: 6 additions & 0 deletions tests/fixtures/common/RTLNormalText.expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"filename": "RTLNormalText.svelte",
"parsed": true,
"error": null,
"warnings": []
}
1 change: 1 addition & 0 deletions tests/fixtures/common/RTLNormalText.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>שלום مرحبا</p>
31 changes: 31 additions & 0 deletions tests/fixtures/common/TwoUnsafeWithScript.expected.json
Original file line number Diff line number Diff line change
@@ -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
}
}
]
}
Loading