mirror of https://github.com/sveltejs/svelte
only enforce static type if input is bound (fixes #620)
parent
6eb80e3732
commit
ff40308358
@ -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