mirror of https://github.com/sveltejs/svelte
Merge pull request #630 from sveltejs/gh-620
only enforce static type if input is boundpull/635/head
commit
61f5cbef54
@ -0,0 +1,19 @@
|
|||||||
|
export default {
|
||||||
|
'skip-ssr': true,
|
||||||
|
|
||||||
|
data: {
|
||||||
|
inputType: 'text',
|
||||||
|
inputValue: 42
|
||||||
|
},
|
||||||
|
|
||||||
|
html: `<input type="text">`,
|
||||||
|
|
||||||
|
test(assert, component, target) {
|
||||||
|
const input = target.querySelector('input');
|
||||||
|
assert.equal(input.type, 'text');
|
||||||
|
assert.equal(input.value, '42');
|
||||||
|
|
||||||
|
component.set({ inputType: 'number' });
|
||||||
|
assert.equal(input.type, 'number');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1 @@
|
|||||||
|
<input type='{{inputType}}' value='{{inputValue}}'>
|
@ -0,0 +1,8 @@
|
|||||||
|
[{
|
||||||
|
"message": "'type' attribute cannot be dynamic if input uses two-way binding",
|
||||||
|
"loc": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 24
|
||||||
|
},
|
||||||
|
"pos": 24
|
||||||
|
}]
|
@ -0,0 +1 @@
|
|||||||
|
<input bind:value='foo' type='{{inputType}}'>
|
Loading…
Reference in new issue