-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(MdField): preserve the name attribute on change (#1385)
- Loading branch information
1 parent
ff341a2
commit 0a83834
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') | ||
}) |