mirror of https://github.com/sveltejs/svelte
parent
8be51653ff
commit
02e434277b
@ -0,0 +1,6 @@
|
|||||||
|
export default {
|
||||||
|
async test({ assert, component }) {
|
||||||
|
assert.equal(component.toggle, true);
|
||||||
|
assert.equal(component.offsetHeight, 800);
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
<script>
|
||||||
|
export let offsetHeight;
|
||||||
|
export let offsetWidth;
|
||||||
|
export let toggle = false;
|
||||||
|
$: if (offsetWidth) {
|
||||||
|
toggle = true;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class:toggle>
|
||||||
|
<div bind:offsetHeight bind:offsetWidth>{offsetHeight}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.toggle > div {
|
||||||
|
height: 800px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,5 +0,0 @@
|
|||||||
export default {
|
|
||||||
async test({ assert, target }) {
|
|
||||||
assert.htmlEqual(target.querySelector('.description').innerHTML, 'width:200, height:100');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
<script>
|
|
||||||
let offsetWidth = 0;
|
|
||||||
let offsetHeight = 0;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="inner" bind:offsetHeight bind:offsetWidth>
|
|
||||||
<div class="description">width:{offsetWidth}, height:{offsetHeight}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.wrapper {
|
|
||||||
width: 200px;
|
|
||||||
height: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.inner {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
Loading…
Reference in new issue