Skip to content

Commit 8b71d7b

Browse files
committed
failing tests for second bug in #290
1 parent b31ecc5 commit 8b71d7b

File tree

6 files changed

+101
-0
lines changed

6 files changed

+101
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<input bind:value>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
export default {
2+
html: `
3+
<input>
4+
<input>
5+
<input>
6+
7+
<p>foo, bar, baz</p>
8+
`,
9+
10+
test ( assert, component, target, window ) {
11+
const change = new window.MouseEvent( 'change' );
12+
const inputs = target.querySelectorAll( 'input' );
13+
14+
inputs[0].value = 'blah';
15+
inputs[0].dispatchEvent( change );
16+
17+
assert.deepEqual( component.get( 'a' ), [ 'blah', 'bar', 'baz' ] );
18+
assert.htmlEqual( target.innerHTML, `
19+
<input>
20+
<input>
21+
<input>
22+
23+
<p>blah, bar, baz</p>
24+
` );
25+
26+
component.teardown();
27+
}
28+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{#each a as x}}
2+
<Widget bind:value='x.name'/>
3+
{{/each}}
4+
5+
<p>{{a.map(getName).join(', ')}}</p>
6+
7+
<script>
8+
import Widget from './Widget.html';
9+
10+
export default {
11+
data () {
12+
return {
13+
a: [{ name: 'foo' }, { name: 'bar' }, { name: 'baz' }],
14+
getName: x => x.name
15+
};
16+
},
17+
18+
components: {
19+
Widget
20+
}
21+
};
22+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<input bind:value>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
export default {
2+
html: `
3+
<input>
4+
<input>
5+
<input>
6+
7+
<p>foo, bar, baz</p>
8+
`,
9+
10+
test ( assert, component, target, window ) {
11+
const change = new window.MouseEvent( 'change' );
12+
const inputs = target.querySelectorAll( 'input' );
13+
14+
inputs[0].value = 'blah';
15+
inputs[0].dispatchEvent( change );
16+
17+
assert.deepEqual( component.get( 'a' ), [ 'blah', 'bar', 'baz' ] );
18+
assert.htmlEqual( target.innerHTML, `
19+
<input>
20+
<input>
21+
<input>
22+
23+
<p>blah, bar, baz</p>
24+
` );
25+
26+
component.teardown();
27+
}
28+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{#each a as x}}
2+
<Widget bind:value='x'/>
3+
{{/each}}
4+
5+
<p>{{a.join(', ')}}</p>
6+
7+
<script>
8+
import Widget from './Widget.html';
9+
10+
export default {
11+
data () {
12+
return {
13+
a: [ 'foo', 'bar', 'baz' ]
14+
};
15+
},
16+
17+
components: {
18+
Widget
19+
}
20+
};
21+
</script>

0 commit comments

Comments
 (0)