-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
10 changed files
with
111 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<script> | ||
export let content; | ||
</script> | ||
|
||
{@html content} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
export default { | ||
html: ` | ||
<button>Switch</button> | ||
<p>Another first line</p> | ||
<p>This line should be last.</p> | ||
`, | ||
async test({ assert, target, window }) { | ||
const btn = target.querySelector("button"); | ||
const clickEvent = new window.MouseEvent("click"); | ||
|
||
await btn.dispatchEvent(clickEvent); | ||
|
||
assert.htmlEqual( | ||
target.innerHTML, | ||
` | ||
<button>Switch</button> | ||
<p>First line</p> | ||
<p>This line should be last.</p> | ||
` | ||
); | ||
|
||
await btn.dispatchEvent(clickEvent); | ||
|
||
assert.htmlEqual( | ||
target.innerHTML, | ||
` | ||
<button>Switch</button> | ||
<p>Another first line</p> | ||
<p>This line should be last.</p> | ||
` | ||
); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script> | ||
import RawMustache from './RawMustache.svelte'; | ||
let content1 = `<p>First line</p>`; | ||
let content2 = `<p>Another first line</p>`; | ||
let show = false; | ||
$: content = show ? content1 : content2; | ||
</script> | ||
|
||
<button on:click={() => show = !show}> | ||
Switch | ||
</button> | ||
|
||
<RawMustache {content} /> | ||
|
||
<p>This line should be last.</p> |
2 changes: 2 additions & 0 deletions
2
test/runtime/samples/raw-mustache-before-element/Component.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<slot /> | ||
<p>This line should be last.</p> |
32 changes: 31 additions & 1 deletion
32
test/runtime/samples/raw-mustache-before-element/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,33 @@ | ||
export default { | ||
html: `<p>x<span>baz</span></p>` | ||
html: ` | ||
<button>Switch</button> | ||
<p>Another first line</p> | ||
<p>This line should be last.</p> | ||
`, | ||
async test({ assert, target, window }) { | ||
const btn = target.querySelector("button"); | ||
const clickEvent = new window.MouseEvent("click"); | ||
|
||
await btn.dispatchEvent(clickEvent); | ||
|
||
assert.htmlEqual( | ||
target.innerHTML, | ||
` | ||
<button>Switch</button> | ||
<p>First line</p> | ||
<p>This line should be last.</p> | ||
` | ||
); | ||
|
||
await btn.dispatchEvent(clickEvent); | ||
|
||
assert.htmlEqual( | ||
target.innerHTML, | ||
` | ||
<button>Switch</button> | ||
<p>Another first line</p> | ||
<p>This line should be last.</p> | ||
` | ||
); | ||
}, | ||
}; |
18 changes: 17 additions & 1 deletion
18
test/runtime/samples/raw-mustache-before-element/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
<p>{@html 'x'}<span>baz</span></p> | ||
<script> | ||
import Component from './Component.svelte'; | ||
let content1 = `<p>First line</p>`; | ||
let content2 = `<p>Another first line</p>` | ||
let show = false; | ||
$: content = show ? content1 : content2; | ||
</script> | ||
|
||
<button on:click={() => show = !show}> | ||
Switch | ||
</button> | ||
|
||
<Component> | ||
{@html content} | ||
</Component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
html: `<p>x<span>baz</span></p>` | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<p>{@html 'x'}<span>baz</span></p> |