mirror of https://github.com/sveltejs/svelte
parent
2741eee8bf
commit
54b713ce5a
@ -0,0 +1,27 @@
|
||||
export default {
|
||||
data: {
|
||||
thing: { a: 1 }
|
||||
},
|
||||
|
||||
test ( assert, component ) {
|
||||
const thing = component.get( 'thing' );
|
||||
|
||||
component.observe( 'thing', function ( thing ) {
|
||||
thing.b = thing.a * 2;
|
||||
this.set({ thing }); // triggers infinite loop, unless observer breaks it
|
||||
});
|
||||
|
||||
assert.deepEqual( thing, {
|
||||
a: 1,
|
||||
b: 2
|
||||
});
|
||||
|
||||
thing.a = 3;
|
||||
component.set({ thing });
|
||||
|
||||
assert.deepEqual( thing, {
|
||||
a: 3,
|
||||
b: 6
|
||||
});
|
||||
}
|
||||
};
|
@ -0,0 +1 @@
|
||||
<div></div>
|
Loading…
Reference in new issue