update a few more tests

pull/1864/head
Rich Harris 7 years ago
parent 48a0a911fe
commit e2f36d0d04

@ -20,7 +20,7 @@ export default {
input.value = 'everybody'; input.value = 'everybody';
input.dispatchEvent(new window.Event('input')); input.dispatchEvent(new window.Event('input'));
assert.equal(component.get().name, 'everybody'); assert.equal(component.name, 'everybody');
assert.htmlEqual(target.innerHTML, ` assert.htmlEqual(target.innerHTML, `
<input> <input>
<p>Hello everybody!</p> <p>Hello everybody!</p>

@ -17,7 +17,7 @@ export default {
button.dispatchEvent(new window.MouseEvent('click')); button.dispatchEvent(new window.MouseEvent('click'));
assert.ok(component.get().clicked); assert.ok(component.clicked);
assert.htmlEqual(target.innerHTML, ` assert.htmlEqual(target.innerHTML, `
<button>click me</button> <button>click me</button>
<p>clicked!</p> <p>clicked!</p>

@ -45,7 +45,7 @@ export default {
inputs[1].checked = true; inputs[1].checked = true;
await inputs[1].dispatchEvent(event); await inputs[1].dispatchEvent(event);
assert.equal(component.numCompleted, 2); assert.equal(component.numCompleted(), 2);
assert.htmlEqual(target.innerHTML, ` assert.htmlEqual(target.innerHTML, `
<div><input type="checkbox"><p>one</p></div><div><input type="checkbox"><p>two</p></div><div><input type="checkbox"><p>three</p></div> <div><input type="checkbox"><p>one</p></div><div><input type="checkbox"><p>two</p></div><div><input type="checkbox"><p>three</p></div>
<p>2 completed</p> <p>2 completed</p>

@ -1,8 +1,8 @@
<script> <script>
export let items; export let items;
function numCompleted() { export function numCompleted() {
return items.reduce( ( total, item ) => total + ( item.completed ? 1 : 0 ), 0 ); return items.reduce((total, item) => total + (item.completed ? 1 : 0), 0);
} }
</script> </script>

@ -18,7 +18,7 @@ export default {
`, `,
test(assert, component, target, window) { test(assert, component, target, window) {
const { cats } = component.get(); const { cats } = component;
const newCats = cats.slice(); const newCats = cats.slice();
newCats.push({ newCats.push({
name: "cat " + cats.length, name: "cat " + cats.length,

@ -1,2 +1,2 @@
<input bind:value='obj[prop]'> <input bind:value={obj[prop]}>
<pre>{JSON.stringify(obj)}</pre> <pre>{JSON.stringify(obj)}</pre>

@ -1,2 +1,2 @@
<input bind:value='user[prop]'> <input bind:value={user[prop]}>
<p>hello {user.name}</p> <p>hello {user.name}</p>

@ -1,4 +1,4 @@
{#each objects as obj} {#each objects as obj}
<input bind:value='obj[prop]'> <input bind:value={obj[prop]}>
<pre>{JSON.stringify(obj)}</pre> <pre>{JSON.stringify(obj)}</pre>
{/each} {/each}

@ -1,6 +1,4 @@
export default { export default {
solo: 1,
props: { props: {
user: { user: {
name: 'alice', name: 'alice',

@ -8,7 +8,7 @@ export default {
preserveIdentifiers: true, preserveIdentifiers: true,
test(assert, component, target) { test(assert, component, target) {
const { tagList } = component.get(); const { tagList } = component;
tagList.push('two'); tagList.push('two');
component.tagList = tagList; component.tagList = tagList;

@ -23,7 +23,7 @@ export default {
inputs[1].value = 'w'; inputs[1].value = 'w';
inputs[1].dispatchEvent(new window.MouseEvent('input')); inputs[1].dispatchEvent(new window.MouseEvent('input'));
assert.deepEqual(component.get(), { assert.deepEqual(component, {
foo: { foo: {
bar: ['x', 'w', 'z'] bar: ['x', 'w', 'z']
} }

@ -21,7 +21,7 @@ export default {
inputs[1].value = 'Oz'; inputs[1].value = 'Oz';
inputs[1].dispatchEvent(new window.Event('input')); inputs[1].dispatchEvent(new window.Event('input'));
const { people } = component.get(); const { people } = component;
assert.deepEqual(people, [ assert.deepEqual(people, [
{ name: { first: 'Doctor', last: 'Oz' } } { name: { first: 'Doctor', last: 'Oz' } }

@ -7,7 +7,7 @@ export default {
test(assert, component) { test(assert, component) {
component.$destroy(); component.$destroy();
const { foo } = component.get(); const { foo } = component;
assert.equal(foo, undefined); assert.equal(foo, undefined);
} }
} }

@ -2,6 +2,6 @@ export default {
test ( assert, component ) { test ( assert, component ) {
assert.equal( component.a, 1 ); assert.equal( component.a, 1 );
assert.equal( component.c, 3 ); assert.equal( component.c, 3 );
assert.deepEqual( component.get(), { a: 1, b: 2, c: 3 }); assert.deepEqual( component, { a: 1, b: 2, c: 3 });
} }
}; };

@ -12,7 +12,7 @@ export default {
}, },
test(assert, component, target) { test(assert, component, target) {
const { things } = component.get(); const { things } = component;
component.things = things.reverse(); component.things = things.reverse();

@ -12,7 +12,7 @@ export default {
}, },
test(assert, component, target) { test(assert, component, target) {
const { things } = component.get(); const { things } = component;
component.things = things.reverse(); component.things = things.reverse();

Loading…
Cancel
Save