mirror of https://github.com/sveltejs/svelte
parent
9e8592ef2c
commit
fc9032cd08
@ -0,0 +1,34 @@
|
||||
export default {
|
||||
html: `
|
||||
<h1 class="svelte-udf14z" style="background-color: red;">hello</h1>
|
||||
<h1 class="svelte-udf14z">hello</h1>
|
||||
<h1 class="svelte-udf14z" style="background-color: red !important;">hello</h1>
|
||||
<h1 class="svelte-udf14z" style="background-color: red !important;">hello</h1>
|
||||
<h1 class="svelte-udf14z" style="background-color: red !important;">hello</h1>
|
||||
<h2 class="svelte-udf14z" style="--background-color:red;">hello</h2>
|
||||
<h2 class="svelte-udf14z" style="--background-color:red !important;">hello</h2>
|
||||
`,
|
||||
|
||||
ssrHtml: `
|
||||
<h1 class="svelte-udf14z" style="background-color: red;">hello</h1>
|
||||
<h1 class="svelte-udf14z" style="background-color: red important;">hello</h1>
|
||||
<h1 class="svelte-udf14z" style="background-color: red !important;">hello</h1>
|
||||
<h1 class="svelte-udf14z" style="background-color: red !important;">hello</h1>
|
||||
<h1 class="svelte-udf14z" style="background-color: red !important">hello</h1>
|
||||
<h2 class="svelte-udf14z" style="--background-color: red;">hello</h2>
|
||||
<h2 class="svelte-udf14z" style="--background-color: red !important;">hello</h2>
|
||||
`,
|
||||
|
||||
test({ assert, target, window }) {
|
||||
const h1s = target.querySelectorAll('h1');
|
||||
const h2s = target.querySelectorAll('h2');
|
||||
|
||||
assert.equal(window.getComputedStyle(h1s[0])['backgroundColor'], 'rgb(0, 0, 255)');
|
||||
assert.equal(window.getComputedStyle(h1s[1])['backgroundColor'], 'rgb(0, 0, 255)');
|
||||
assert.equal(window.getComputedStyle(h1s[2])['backgroundColor'], 'rgb(255, 0, 0)');
|
||||
assert.equal(window.getComputedStyle(h1s[3])['backgroundColor'], 'rgb(255, 0, 0)');
|
||||
assert.equal(window.getComputedStyle(h1s[4])['backgroundColor'], 'rgb(255, 0, 0)');
|
||||
assert.equal(window.getComputedStyle(h2s[0])['backgroundColor'], 'rgb(0, 0, 255)');
|
||||
assert.equal(window.getComputedStyle(h2s[1])['backgroundColor'], 'rgb(255, 0, 0)');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,21 @@
|
||||
<script>
|
||||
export let color = 'red'
|
||||
</script>
|
||||
|
||||
<h1 style:background-color={color} >hello</h1>
|
||||
<h1 style:background-color="{color} important">hello</h1>
|
||||
<h1 style:background-color="{color} !important">hello</h1>
|
||||
<h1 style:background-color="{color} !important;">hello</h1>
|
||||
<h1 style="background-color: {color} !important">hello</h1>
|
||||
<h2 style:--background-color={color}>hello</h2>
|
||||
<h2 style:--background-color="{color} !important;">hello</h2>
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
background-color: blue !important;
|
||||
}
|
||||
h2 {
|
||||
--background-color: blue !important;
|
||||
background-color: var(--background-color);
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,27 @@
|
||||
export default {
|
||||
html: `
|
||||
<h1 class="svelte-szzkfu" style="background-color: red;">hello</h1>
|
||||
<h1 class="svelte-szzkfu">hello</h1>
|
||||
<h1 class="svelte-szzkfu" style="background-color: red;">hello</h1>
|
||||
<h1 class="svelte-szzkfu" style="background-color: red;">hello</h1>
|
||||
<h1 class="svelte-szzkfu" style="background-color: red;">hello</h1>
|
||||
`,
|
||||
|
||||
ssrHtml: `
|
||||
<h1 class="svelte-szzkfu" style="background-color: red;">hello</h1>
|
||||
<h1 class="svelte-szzkfu" style="background-color: red important;">hello</h1>
|
||||
<h1 class="svelte-szzkfu" style="background-color: red !important;">hello</h1>
|
||||
<h1 class="svelte-szzkfu" style="background-color: red !important;">hello</h1>
|
||||
<h1 class="svelte-szzkfu" style="background-color: red !important">hello</h1>
|
||||
`,
|
||||
|
||||
test({ assert, target, window }) {
|
||||
const h1s = target.querySelectorAll('h1');
|
||||
|
||||
assert.equal(window.getComputedStyle(h1s[0])['backgroundColor'], 'red');
|
||||
assert.equal(window.getComputedStyle(h1s[1])['backgroundColor'], 'blue');
|
||||
assert.equal(window.getComputedStyle(h1s[2])['backgroundColor'], 'red');
|
||||
assert.equal(window.getComputedStyle(h1s[3])['backgroundColor'], 'red');
|
||||
assert.equal(window.getComputedStyle(h1s[4])['backgroundColor'], 'red');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,15 @@
|
||||
<script>
|
||||
export let color = 'red'
|
||||
</script>
|
||||
|
||||
<h1 style:background-color={color} >hello</h1>
|
||||
<h1 style:background-color="{color} important">hello</h1>
|
||||
<h1 style:background-color="{color} !important">hello</h1>
|
||||
<h1 style:background-color="{color} !important;">hello</h1>
|
||||
<h1 style="background-color: {color} !important">hello</h1>
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
background-color: blue !important;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in new issue