forked from jd-opensource/nutui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65fb30b
commit 420ecdd
Showing
62 changed files
with
1,676 additions
and
1,422 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
"printWidth": 150, | ||
"useTabs": false, | ||
"htmlWhitespaceSensitivity": "strict" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,56 +1,57 @@ | ||
import { shallowMount, mount } from '@vue/test-utils'; | ||
import ActionSheet from '../actionsheet.vue'; | ||
import { shallowMount, mount } from '@vue/test-utils' | ||
import ActionSheet from '../actionsheet.vue' | ||
import Vue from 'vue'; | ||
|
||
|
||
describe('ActionSheet.vue', () => { | ||
const wrapper = shallowMount(ActionSheet, { | ||
propsData: { | ||
menuItems: [ | ||
{ | ||
name: '男', | ||
value: 0, | ||
}, | ||
{ | ||
name: '女', | ||
value: 1, | ||
}, | ||
], | ||
}, | ||
}); | ||
const wrapper = shallowMount(ActionSheet, { | ||
propsData:{ | ||
menuItems: [ | ||
{ | ||
'name': '男', | ||
'value': 0 | ||
}, | ||
{ | ||
'name': '女', | ||
'value': 1 | ||
} | ||
] | ||
} | ||
}); | ||
|
||
it('测试条数', () => { | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.findAll('.nut-actionsheet-item').length).toBe(2); | ||
it('测试条数', () => { | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.findAll('.nut-actionsheet-item').length).toBe(2); | ||
}) | ||
}); | ||
}); | ||
|
||
it('是否可见', () => { | ||
wrapper.setProps({ isVisible: true }); | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.find('.nut-actionsheet-mask').isVisible()).toBe(true); | ||
expect(wrapper.find('.nut-actionsheet-panel').isVisible()).toBe(true); | ||
it('是否可见', () => { | ||
wrapper.setProps({isVisible: true }); | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.find('.nut-actionsheet-mask').isVisible()).toBe(true); | ||
expect(wrapper.find('.nut-actionsheet-panel').isVisible()).toBe(true); | ||
}) | ||
}); | ||
}); | ||
|
||
it('显示取消', () => { | ||
wrapper.setProps({ isVisible: true, cancelTxt: '取消' }); | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.find('.nut-actionsheet-cancel').isVisible()).toBe(true); | ||
expect(wrapper.find('.nut-actionsheet-cancel').text()).toBe('取消'); | ||
it('显示取消', () => { | ||
wrapper.setProps({isVisible: true, cancelTxt: '取消' }); | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.find('.nut-actionsheet-cancel').isVisible()).toBe(true); | ||
expect(wrapper.find('.nut-actionsheet-cancel').text()).toBe('取消'); | ||
}) | ||
}); | ||
}); | ||
|
||
it('高亮显示', () => { | ||
wrapper.setProps({ chooseTagValue: '男' }); | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.findAll('.nut-actionsheet-item').at(0).contains('.nut-actionsheet-item-active')).toBe(true); | ||
it('高亮显示', () => { | ||
wrapper.setProps({chooseTagValue: '男' }); | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.findAll('.nut-actionsheet-item').at(0).contains('.nut-actionsheet-item-active')).toBe(true); | ||
}) | ||
}); | ||
}); | ||
|
||
it('设置列表项展示使用参数', () => { | ||
wrapper.setProps({ optionTag: 'value' }); | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.findAll('.nut-actionsheet-item').at(1).text()).toBe('1'); | ||
it('设置列表项展示使用参数', () => { | ||
wrapper.setProps({optionTag: 'value' }); | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.findAll('.nut-actionsheet-item').at(1).text()).toBe('1'); | ||
}) | ||
}); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,42 +1,44 @@ | ||
import { shallowMount, mount } from '@vue/test-utils'; | ||
import avatar from '../avatar.vue'; | ||
import { shallowMount, mount } from '@vue/test-utils' | ||
import avatar from '../avatar.vue' | ||
import Vue from 'vue'; | ||
|
||
|
||
describe('Avatar.vue', () => { | ||
const wrapper = shallowMount(avatar, {}); | ||
it('尺寸规格', () => { | ||
wrapper.setProps({ size: 'small' }); | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.find('.nut-avatar').contains('.avatar-small')).toBe(true); | ||
const wrapper = shallowMount(avatar, { | ||
}); | ||
it('尺寸规格', () => { | ||
wrapper.setProps({size: "small" }); | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.find('.nut-avatar').contains('.avatar-small')).toBe(true); | ||
}) | ||
}); | ||
}); | ||
|
||
it('形状类型是否为square', () => { | ||
wrapper.setProps({ shape: 'square' }); | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.find('.nut-avatar').contains('.avatar-square')).toBe(true); | ||
it('形状类型是否为square', () => { | ||
wrapper.setProps({shape: "square" }); | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.find('.nut-avatar').contains('.avatar-square')).toBe(true); | ||
}) | ||
}); | ||
}); | ||
|
||
it('背景颜色是否为red', () => { | ||
wrapper.setProps({ bgColor: 'red' }); | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.find('.nut-avatar').hasStyle('background-color', 'red')).toBe(true); | ||
it('背景颜色是否为red', () => { | ||
wrapper.setProps({bgColor: "red" }); | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.find('.nut-avatar').hasStyle('background-color','red')).toBe(true); | ||
}) | ||
}); | ||
}); | ||
|
||
it('背景图片是否为设置的bgImage', () => { | ||
wrapper.setProps({ bgImage: 'http://image.png' }); | ||
return Vue.nextTick().then(function () { | ||
// console.log(wrapper.find('.nut-avatar').attributes('style')) | ||
expect(wrapper.find('.nut-avatar').hasStyle('background-image', 'url(http://image.png)')).toBe(true); | ||
it('背景图片是否为设置的bgImage', () => { | ||
wrapper.setProps({bgImage: "http://image.png" }); | ||
return Vue.nextTick().then(function () { | ||
// console.log(wrapper.find('.nut-avatar').attributes('style')) | ||
expect(wrapper.find('.nut-avatar').hasStyle('background-image','url(http://image.png)')).toBe(true); | ||
}) | ||
}); | ||
}); | ||
|
||
it('头像图片是否为设置的bgIcon', () => { | ||
wrapper.setProps({ bgIcon: 'http://image.png' }); | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.find('.icon').hasStyle('background-image', 'url(http://image.png)')).toBe(true); | ||
it('头像图片是否为设置的bgIcon', () => { | ||
wrapper.setProps({bgIcon: "http://image.png" }); | ||
return Vue.nextTick().then(function () { | ||
expect(wrapper.find('.icon').hasStyle('background-image','url(http://image.png)')).toBe(true); | ||
}) | ||
}); | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.