mirror of https://github.com/sveltejs/svelte
parent
4d1d1861eb
commit
c67f8ef14c
@ -0,0 +1,18 @@
|
||||
export default {
|
||||
html: `
|
||||
<div style="background-image: url(https://raw.githubusercontent.com/sveltejs/branding/master/svelte-vertical.png); --css-variable: rgba(0, 0, 0, 1);"></div>
|
||||
`,
|
||||
|
||||
test({ assert, target, window }) {
|
||||
const div = target.querySelector('div');
|
||||
const styles = window.getComputedStyle(div);
|
||||
|
||||
assert.equal(styles['background-image'], 'url(https://raw.githubusercontent.com/sveltejs/branding/master/svelte-vertical.png)');
|
||||
assert.equal(styles.getPropertyValue('--css-variable'), 'rgba(0, 0, 0, 1)');
|
||||
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
'<div style="background-image: url(https://raw.githubusercontent.com/sveltejs/branding/master/svelte-vertical.png); --css-variable: rgba(0, 0, 0, 1);"></div>'
|
||||
);
|
||||
}
|
||||
};
|
@ -0,0 +1,11 @@
|
||||
<script>
|
||||
let url =
|
||||
"https://raw.githubusercontent.com/sveltejs/branding/master/svelte-vertical.png";
|
||||
|
||||
let alpha = 1;
|
||||
</script>
|
||||
|
||||
<div
|
||||
style:background-image="url({url})"
|
||||
style:--css-variable="rgba(0, 0, 0, {alpha})"
|
||||
/>
|
Loading…
Reference in new issue