2
0
mirror of https://github.com/tenrok/vue2-datepicker.git synced 2026-06-22 11:10:36 +03:00

feat: add getWeek in custom format (#382)

This commit is contained in:
mengxiong10
2019-11-29 15:19:12 +08:00
parent 0a3174569b
commit 4d935d7e24
4 changed files with 511 additions and 3 deletions
+8 -1
View File
@@ -136,10 +136,12 @@ describe('DatePicker', () => {
});
it('prop: custom format', () => {
wrapper = shallowMount(DatePicker, {
wrapper = mount(DatePicker, {
propsData: {
valueType: 'format',
value: '13/10/2019',
open: true,
type: 'week',
format: {
stringify(date) {
return format(date, 'dd/MM/yyyy');
@@ -147,11 +149,16 @@ describe('DatePicker', () => {
parse(value) {
return parse(value, 'dd/MM/yyyy', new Date());
},
getWeek(date) {
return date.getDate();
},
},
},
});
const input = wrapper.find('input').element;
expect(input.value).toBe('13/10/2019');
const tableDate = wrapper.find('.mx-table-date');
expect(tableDate.element).toMatchSnapshot();
});
it('prop: valueType', () => {