Skip to content

Commit 0a83834

Browse files
jastkandmarcosmoura
authored andcommitted
fix(MdField): preserve the name attribute on change (#1385)
1 parent ff341a2 commit 0a83834

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

src/components/MdField/MdFieldMixin.js

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export default {
22
props: {
33
value: {},
44
placeholder: String,
5+
name: String,
56
maxlength: [String, Number],
67
readonly: Boolean,
78
required: Boolean,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import Vue from 'vue'
2+
import mountTemplate from 'test/utils/mountTemplate'
3+
import MdFieldModule from 'components/MdField'
4+
import MdField from '../MdField.vue'
5+
6+
Vue.use(MdFieldModule)
7+
8+
test('should render the input', async () => {
9+
const template = `
10+
<md-field>
11+
<md-input></md-input>
12+
</md-field>
13+
`
14+
const wrapper = await mountTemplate(MdField, template)
15+
16+
expect(wrapper.contains('.md-input')).toBe(true)
17+
})
18+
19+
test('should preserve a value of the "name" attribute on change', async () => {
20+
const template = `
21+
<md-field>
22+
<md-input name="details"></md-input>
23+
</md-field>
24+
`
25+
const wrapper = await mountTemplate(MdField, template)
26+
const input = wrapper.find('.md-input')[0]
27+
28+
input.trigger('change')
29+
30+
await wrapper.vm.$nextTick()
31+
32+
expect(input.getAttribute('name')).toBe('details')
33+
})

0 commit comments

Comments
 (0)