mirror of https://github.com/sveltejs/svelte
parent
6e2eeeb88e
commit
23dfe2b135
@ -1,9 +1,7 @@
|
||||
<script>
|
||||
export let test;
|
||||
|
||||
import Foo from './Foo.html';
|
||||
|
||||
export let foo = Foo;
|
||||
export let test;
|
||||
</script>
|
||||
|
||||
<svelte:component this={foo} ref:test/>
|
||||
<svelte:component this={Foo} ref:test/>
|
||||
|
@ -1 +0,0 @@
|
||||
<div></div>
|
@ -1,15 +0,0 @@
|
||||
export default {
|
||||
test(assert, component) {
|
||||
const foo = component.refs.foo;
|
||||
let count = 0;
|
||||
|
||||
foo.on('state', ({ changed }) => {
|
||||
if (changed.foo) count += 1;
|
||||
});
|
||||
|
||||
assert.equal(count, 0);
|
||||
|
||||
component.y = {};
|
||||
assert.equal(count, 0);
|
||||
}
|
||||
};
|
@ -1,10 +0,0 @@
|
||||
<script>
|
||||
export let foo;
|
||||
|
||||
import Foo from './Foo.html';
|
||||
|
||||
export let x = {};
|
||||
export let y = {};
|
||||
</script>
|
||||
|
||||
<Foo ref:foo x='{x}'/>
|
@ -1,8 +0,0 @@
|
||||
<script>
|
||||
export let x;
|
||||
export let y;
|
||||
export let width;
|
||||
export let height;
|
||||
</script>
|
||||
|
||||
<rect x='{x}' y='{y}' width='{width}' height='{height}'/>
|
@ -1,22 +0,0 @@
|
||||
export default {
|
||||
props: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 100,
|
||||
height: 100
|
||||
},
|
||||
|
||||
html: `<svg><rect x="0" y="0" width="100" height="100"></rect></svg>`,
|
||||
|
||||
test ( assert, component, target ) {
|
||||
const svg = target.querySelector( 'svg' );
|
||||
const rect = target.querySelector( 'rect' );
|
||||
|
||||
assert.equal( svg.namespaceURI, 'http://www.w3.org/2000/svg' );
|
||||
assert.equal( rect.namespaceURI, 'http://www.w3.org/2000/svg' );
|
||||
|
||||
component.width = 150;
|
||||
component.height = 50;
|
||||
assert.equal( target.innerHTML, `<svg><rect x="0" y="0" width="150" height="50"></rect></svg>` );
|
||||
},
|
||||
};
|
@ -1,12 +0,0 @@
|
||||
<script>
|
||||
import Rect from './Rect.html';
|
||||
|
||||
export let x;
|
||||
export let y;
|
||||
export let width;
|
||||
export let height;
|
||||
</script>
|
||||
|
||||
<svg>
|
||||
<Rect x='{x}' y='{y}' width='{width}' height='{height}'/>
|
||||
</svg>
|
Loading…
Reference in new issue