Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit 088e2b7

Browse files
committed
Ensuring input controls maintain their type attributes. Fixes #554
1 parent 0c78ed3 commit 088e2b7

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

src/components/control-component.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ function createControlClass(customControlPropsMap = {}, s = defaultStrategy) {
636636
component="input"
637637
mapProps={{
638638
...controlPropsMap.text,
639+
type: 'text',
639640
...props.mapProps,
640641
}}
641642
{...omit(props, 'mapProps')}

src/constants/control-props-map.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ function createControlPropsMap() {
5959
...standardPropsMap,
6060
value: (props) => (props.modelValue),
6161
},
62-
text: {
63-
...textPropsMap,
64-
type: 'text',
65-
},
62+
text: textPropsMap,
6663
textarea: textPropsMap,
6764
file: standardPropsMap,
6865
button: standardPropsMap,

test/control-component-spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ Object.keys(testContexts).forEach((testKey) => {
217217
it('should have a type="text"', () => {
218218
assert.equal(node.getAttribute('type'), 'text');
219219
});
220+
} else {
221+
it('should have the appropriate type attribute', () => {
222+
assert.equal(node.getAttribute('type'), type);
223+
});
220224
}
221225
});
222226
});

test/field-component-spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,10 @@ Object.keys(testContexts).forEach((testKey) => {
291291
get(store.getState().test, 'foo'),
292292
'testing again');
293293
});
294+
295+
it('should have the appropriate type attribute', () => {
296+
assert.equal(node.getAttribute('type'), type);
297+
});
294298
});
295299

296300
describe(`with a controlled <${element} ${type ? `type="${type}"` : ''} /> component`, () => {

0 commit comments

Comments
 (0)