Skip to content

Commit

Permalink
test: fix test input props snap
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxiong10 committed Dec 13, 2021
1 parent ea22440 commit b894cf6
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 7 deletions.
6 changes: 3 additions & 3 deletions __tests__/DatePicker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe('DatePicker', () => {
expect(wrapper.find('.mx-datepicker-popup').exists()).toBe(false);
});

it('prop: input props', () => {
it('prop: input props', async () => {
wrapper = shallowMount(DatePicker, {
props: {
value: new Date(2019, 4, 10),
Expand All @@ -114,17 +114,17 @@ describe('DatePicker', () => {
},
});
expect(wrapper.element).toMatchSnapshot();
wrapper.setProps({
await wrapper.setProps({
clearable: false,
editable: false,
placeholder: 'test placeholder',
inputClass: 'test',
inputAttr: {
type: 'number',
name: 'test',
id: 'test',
},
});
expect(wrapper.element).toMatchSnapshot();
});

it('prop: format', () => {
Expand Down
30 changes: 30 additions & 0 deletions __tests__/__snapshots__/DatePicker.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,33 @@ exports[`DatePicker prop: input props 1`] = `
<!--teleport end-->
</div>
`;

exports[`DatePicker prop: input props 2`] = `
<div
class="mx-datepicker"
>
<div
class="mx-input-wrapper"
>
<input
autocomplete="off"
class="test"
id="test"
name="test"
placeholder="test placeholder"
readonly=""
type="text"
/>
<!---->
<i
class="mx-icon-calendar"
>
<!---->
</i>
</div>
<!--teleport start-->
<!--teleport end-->
</div>
`;
18 changes: 14 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ export default defineComponent({
},
data() {
return {
inputProps: {
clearable: false,
editable: false,
placeholder: 'test placeholder',
inputAttr: {
name: 'test',
id: 'test',
},
},
shortcuts: [
{
text: 'range',
Expand Down Expand Up @@ -49,10 +58,11 @@ export default defineComponent({
<button @click="append = !append">ass</button>
<DatePicker
v-model:value="value"
v-bind="inputProps"
:clearable="false"
multiple
:append-to-body="append"
type="date"
type="datetime"
:time-picker-options="{ start: '00:00', end: '09:00', step: '00:30' }"
:disabled-date="(date) => date < new Date(2021, 10, 9)"
:open="true"
></DatePicker>
Expand All @@ -71,8 +81,8 @@ export default defineComponent({
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
/* color: #2c3e50; */
margin-top: 60px;
margin-left: 60px;
}
</style>

0 comments on commit b894cf6

Please sign in to comment.