mirror of
https://github.com/sveltejs/svelte.git
synced 2024-12-01 17:30:59 +01:00
some more tests
This commit is contained in:
parent
2ed34f4fe2
commit
978a2bcae7
14
test/compiler/set-in-observe/_config.js
Normal file
14
test/compiler/set-in-observe/_config.js
Normal file
@ -0,0 +1,14 @@
|
||||
export default {
|
||||
html: `
|
||||
<p>1</p>
|
||||
<p>2</p>
|
||||
`,
|
||||
|
||||
test ( assert, component, target ) {
|
||||
component.set({ foo: 2 });
|
||||
assert.htmlEqual( target.innerHTML, `
|
||||
<p>2</p>
|
||||
<p>4</p>
|
||||
` );
|
||||
}
|
||||
};
|
16
test/compiler/set-in-observe/main.html
Normal file
16
test/compiler/set-in-observe/main.html
Normal file
@ -0,0 +1,16 @@
|
||||
<p>{{foo}}</p>
|
||||
<p>{{bar}}</p>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
foo: 1
|
||||
}),
|
||||
|
||||
onrender () {
|
||||
this.observe( 'foo', foo => {
|
||||
this.set({ bar: foo * 2 });
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
3
test/compiler/set-in-onrender/_config.js
Normal file
3
test/compiler/set-in-onrender/_config.js
Normal file
@ -0,0 +1,3 @@
|
||||
export default {
|
||||
html: '<p>2</p>'
|
||||
};
|
13
test/compiler/set-in-onrender/main.html
Normal file
13
test/compiler/set-in-onrender/main.html
Normal file
@ -0,0 +1,13 @@
|
||||
<p>{{foo}}</p>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
foo: 1
|
||||
}),
|
||||
|
||||
onrender () {
|
||||
this.set({ foo: 2 });
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user