mirror of https://github.com/sveltejs/svelte
parent
531354fc39
commit
5070219218
@ -1,24 +1,38 @@
|
|||||||
|
import counter from './counter.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: {
|
data: {
|
||||||
x: 1,
|
x: 1,
|
||||||
y: 2
|
y: 2,
|
||||||
|
z: 3
|
||||||
},
|
},
|
||||||
|
|
||||||
html: `
|
html: `
|
||||||
<p>1</p>
|
<p>1</p>
|
||||||
<p>2</p>
|
<p class='2'>3</p>
|
||||||
`,
|
`,
|
||||||
|
|
||||||
test(assert, component) {
|
test(assert, component) {
|
||||||
global.count = 0;
|
counter.y = counter.z = 0;
|
||||||
|
|
||||||
|
component.set({ x: 4 });
|
||||||
|
assert.equal(counter.y, 0);
|
||||||
|
assert.equal(counter.z, 0);
|
||||||
|
|
||||||
|
component.set({ x: 5, y: 6 });
|
||||||
|
assert.equal(counter.y, 1);
|
||||||
|
assert.equal(counter.z, 0);
|
||||||
|
|
||||||
component.set({ x: 3 });
|
component.set({ x: 6, y: 6 });
|
||||||
assert.equal(global.count, 0);
|
assert.equal(counter.y, 1);
|
||||||
|
assert.equal(counter.z, 0);
|
||||||
|
|
||||||
component.set({ x: 4, y: 5 });
|
component.set({ z: 7 });
|
||||||
assert.equal(global.count, 1);
|
assert.equal(counter.y, 1);
|
||||||
|
assert.equal(counter.z, 1);
|
||||||
|
|
||||||
component.set({ x: 5, y: 5 });
|
component.set({ x: 8, z: 7 });
|
||||||
assert.equal(global.count, 1);
|
assert.equal(counter.y, 1);
|
||||||
|
assert.equal(counter.z, 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
export default {
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
};
|
Loading…
Reference in new issue