mirror of
https://github.com/tenrok/vue2-datepicker.git
synced 2026-06-22 03:40:36 +03:00
feat: add prop formatter to replace the object usage of format
This commit is contained in:
@@ -92,7 +92,58 @@ exports[`DatePicker prop: clearable 1`] = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`DatePicker prop: custom format 1`] = `
|
||||
exports[`DatePicker prop: editable 1`] = `
|
||||
<div
|
||||
class="mx-datepicker"
|
||||
>
|
||||
<div
|
||||
class="mx-input-wrapper"
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
class="mx-input"
|
||||
name="date"
|
||||
placeholder=""
|
||||
readonly="readonly"
|
||||
type="text"
|
||||
/>
|
||||
|
||||
<i
|
||||
class="mx-icon-clear"
|
||||
>
|
||||
<icon-close-stub />
|
||||
</i>
|
||||
|
||||
<i
|
||||
class="mx-icon-calendar"
|
||||
>
|
||||
<icon-calendar-stub />
|
||||
</i>
|
||||
</div>
|
||||
|
||||
<popup-stub
|
||||
appendtobody="true"
|
||||
>
|
||||
<!---->
|
||||
|
||||
<div
|
||||
class="mx-datepicker-content"
|
||||
>
|
||||
<!---->
|
||||
|
||||
<div
|
||||
class="mx-datepicker-body"
|
||||
>
|
||||
<div />
|
||||
</div>
|
||||
|
||||
<!---->
|
||||
</div>
|
||||
</popup-stub>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`DatePicker prop: formatter 1`] = `
|
||||
<table
|
||||
class="mx-table mx-table-date"
|
||||
>
|
||||
@@ -580,54 +631,3 @@ exports[`DatePicker prop: custom format 1`] = `
|
||||
</tbody>
|
||||
</table>
|
||||
`;
|
||||
|
||||
exports[`DatePicker prop: editable 1`] = `
|
||||
<div
|
||||
class="mx-datepicker"
|
||||
>
|
||||
<div
|
||||
class="mx-input-wrapper"
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
class="mx-input"
|
||||
name="date"
|
||||
placeholder=""
|
||||
readonly="readonly"
|
||||
type="text"
|
||||
/>
|
||||
|
||||
<i
|
||||
class="mx-icon-clear"
|
||||
>
|
||||
<icon-close-stub />
|
||||
</i>
|
||||
|
||||
<i
|
||||
class="mx-icon-calendar"
|
||||
>
|
||||
<icon-calendar-stub />
|
||||
</i>
|
||||
</div>
|
||||
|
||||
<popup-stub
|
||||
appendtobody="true"
|
||||
>
|
||||
<!---->
|
||||
|
||||
<div
|
||||
class="mx-datepicker-content"
|
||||
>
|
||||
<!---->
|
||||
|
||||
<div
|
||||
class="mx-datepicker-body"
|
||||
>
|
||||
<div />
|
||||
</div>
|
||||
|
||||
<!---->
|
||||
</div>
|
||||
</popup-stub>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -135,14 +135,14 @@ describe('DatePicker', () => {
|
||||
expect(input.value).toBe('2019/10/10');
|
||||
});
|
||||
|
||||
it('prop: custom format', () => {
|
||||
it('prop: formatter', () => {
|
||||
wrapper = mount(DatePicker, {
|
||||
propsData: {
|
||||
valueType: 'format',
|
||||
value: '13/10/2019',
|
||||
open: true,
|
||||
type: 'week',
|
||||
format: {
|
||||
formatter: {
|
||||
stringify(date) {
|
||||
return format(date, 'dd/MM/yyyy');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user