Skip to content
Permalink
Browse files

fix(MdField): preserve the name attribute on change (#1385)

  • Loading branch information...
jastkand authored and marcosmoura committed Jan 12, 2018
1 parent ff341a2 commit 0a83834ab3a9f731d0ad83ed73d728096d34ecd4
Showing with 34 additions and 0 deletions.
  1. +1 −0 src/components/MdField/MdFieldMixin.js
  2. +33 −0 src/components/MdField/MdInput/MdInput.test.js
@@ -2,6 +2,7 @@ export default {
props: {
value: {},
placeholder: String,
name: String,
maxlength: [String, Number],
readonly: Boolean,
required: Boolean,
@@ -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')
})

0 comments on commit 0a83834

Please sign in to comment.
You can’t perform that action at this time.