-
-
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.
- Loading branch information
Showing
12 changed files
with
130 additions
and
14 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 |
---|---|---|
|
@@ -9,4 +9,4 @@ export default { | |
component.condition = true; | ||
assert.equal(window.document.title, 'woo!!!'); | ||
} | ||
}; | ||
}; |
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 |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
{#if condition} | ||
<title>woo!!!</title> | ||
{/if} | ||
</svelte:head> | ||
</svelte:head> |
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,14 @@ | ||
export default { | ||
props: { | ||
condition: false | ||
}, | ||
|
||
test({ assert, component, target, window }) { | ||
assert.equal(window.document.title, ''); | ||
assert.equal(Boolean(window.document.getElementById('meta')), true); | ||
|
||
component.condition = true; | ||
assert.equal(window.document.title, 'woo!!!'); | ||
assert.equal(window.document.getElementById('meta'), null); | ||
} | ||
}; |
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,11 @@ | ||
<script> | ||
export let condition; | ||
</script> | ||
|
||
<svelte:head> | ||
{#if condition} | ||
<title>woo!!!</title> | ||
{:else} | ||
<meta id="meta" name="title" content="woo!!!"/> | ||
{/if} | ||
</svelte:head> |
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,19 @@ | ||
const foo = '<script type="application/json">{ "foo": "true" }</script>'; | ||
const bar = '<script type="application/json">{ "bar": "true" }</script>'; | ||
|
||
export default { | ||
props: { | ||
condition: false, | ||
foo, | ||
bar | ||
}, | ||
|
||
test({ assert, component, window }) { | ||
assert.equal(window.document.head.innerHTML.includes(foo), false); | ||
assert.equal(window.document.head.innerHTML.includes(bar), true); | ||
|
||
component.condition = true; | ||
assert.equal(window.document.head.innerHTML.includes(foo), true); | ||
assert.equal(window.document.head.innerHTML.includes(bar), false); | ||
} | ||
}; |
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,11 @@ | ||
<script> | ||
export let condition, foo, bar; | ||
</script> | ||
|
||
<svelte:head> | ||
{#if condition} | ||
{@html foo} | ||
{:else} | ||
{@html bar} | ||
{/if} | ||
</svelte:head> |
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,11 @@ | ||
<script> | ||
export let bar; | ||
</script> | ||
|
||
<svelte:head> | ||
<meta id="meta" name="title" content="bar!!!"/> | ||
{#if true} | ||
{@html bar} | ||
{/if} | ||
<title>bar!!!</title> | ||
</svelte:head> |
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,7 @@ | ||
<script> | ||
export let foo; | ||
</script> | ||
|
||
<svelte:head> | ||
{@html foo} | ||
</svelte:head> |
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,26 @@ | ||
const foo = '<script type="application/json">{ "foo": "true" }</script>'; | ||
const bar = '<script type="application/json">{ "bar": "true" }</script>'; | ||
|
||
export default { | ||
props: { | ||
condition: 1, | ||
foo, | ||
bar | ||
}, | ||
|
||
test({ assert, component, window }) { | ||
assert.equal(window.document.head.innerHTML.includes(foo), true); | ||
|
||
component.condition = false; | ||
assert.equal(window.document.head.innerHTML.includes(foo), false); | ||
|
||
component.condition = 2; | ||
assert.equal(window.document.title, 'bar!!!'); | ||
assert.equal(window.document.head.innerHTML.includes(bar), true); | ||
assert.equal(Boolean(window.document.getElementById('meta')), true); | ||
|
||
component.condition = false; | ||
assert.equal(window.document.head.innerHTML.includes(bar), false); | ||
assert.equal(window.document.getElementById('meta'), null); | ||
} | ||
}; |
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,12 @@ | ||
<script> | ||
import Foo from './Foo.svelte'; | ||
import Bar from './Bar.svelte'; | ||
|
||
export let condition, foo, bar; | ||
</script> | ||
|
||
{#if condition === 1} | ||
<Foo {foo} /> | ||
{:else if condition === 2} | ||
<Bar {bar} /> | ||
{/if} |