Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(MdFieldMixin) Preserve the name attribute on change #1385

Merged
merged 1 commit into from Jan 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/MdField/MdFieldMixin.js
Expand Up @@ -2,6 +2,7 @@ export default {
props: {
value: {},
placeholder: String,
name: String,
maxlength: [String, Number],
readonly: Boolean,
required: Boolean,
Expand Down
33 changes: 33 additions & 0 deletions src/components/MdField/MdInput/MdInput.test.js
@@ -0,0 +1,33 @@
import Vue from 'vue'
import mountTemplate from 'test/utils/mountTemplate'
import MdFieldModule from 'components/MdField'
import MdField from '../MdField.vue'

Vue.use(MdFieldModule)

test('should render the input', async () => {
const template = `
<md-field>
<md-input></md-input>
</md-field>
`
const wrapper = await mountTemplate(MdField, template)

expect(wrapper.contains('.md-input')).toBe(true)
})

test('should preserve a value of the "name" attribute on change', async () => {
const template = `
<md-field>
<md-input name="details"></md-input>
</md-field>
`
const wrapper = await mountTemplate(MdField, template)
const input = wrapper.find('.md-input')[0]

input.trigger('change')

await wrapper.vm.$nextTick()

expect(input.getAttribute('name')).toBe('details')
})