Skip to content

Commit

Permalink
test: fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Aug 26, 2023
1 parent 10aef5f commit e3f9258
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions tests/events.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('events', () => {
},
mounted() {
setTimeout(() => {
(this.$refs.countdown as any).abort();
(this as any).$refs.countdown.abort();
}, 500);
},
methods: {
Expand All @@ -108,7 +108,7 @@ describe('events', () => {
},
mounted() {
setTimeout(() => {
(this.$refs.countdown as any).abort();
(this as any).$refs.countdown.abort();
setTimeout(done, 500);
}, 500);
},
Expand Down
18 changes: 9 additions & 9 deletions tests/props.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('props', () => {
},
mounted() {
setTimeout(() => {
this.autoStart = true;
(this as any).autoStart = true;
}, 100);
},
methods: {
Expand Down Expand Up @@ -115,10 +115,10 @@ describe('props', () => {
},
methods: {
onCountdownStart() {
this.startTime = Date.now();
(this as any).startTime = Date.now();
},
onCountdownEnd() {
const interval = Date.now() - this.startTime;
const interval = Date.now() - (this as any).startTime;

expect(interval).toBeLessThan(200);
done();
Expand Down Expand Up @@ -209,10 +209,10 @@ describe('props', () => {
};
},
mounted() {
expect((this.$refs.countdown as any).totalMilliseconds).toBe(1000);
this.time = 2000;
this.$nextTick(() => {
expect((this.$refs.countdown as any).totalMilliseconds).toBe(2000);
expect((this as any).$refs.countdown.totalMilliseconds).toBe(1000);
(this as any).time = 2000;
(this as any).$nextTick(() => {
expect((this as any).$refs.countdown.totalMilliseconds).toBe(2000);
done();
});
},
Expand All @@ -228,7 +228,7 @@ describe('props', () => {
VueCountdown,
},
mounted() {
expect(this.$el.textContent).toBe('0 days, 0 hours, 0 minutes, 2 seconds, 0 milliseconds.');
expect((this as any).$el.textContent).toBe('0 days, 0 hours, 0 minutes, 2 seconds, 0 milliseconds.');
done();
},
template: '<vue-countdown :time="2000" v-slot="{ days, hours, minutes, seconds, milliseconds }">{{ days }} days, {{ hours }} hours, {{ minutes }} minutes, {{ seconds }} seconds, {{ milliseconds }} milliseconds.</vue-countdown>',
Expand All @@ -241,7 +241,7 @@ describe('props', () => {
VueCountdown,
},
mounted() {
expect(this.$el.textContent).toBe('00 days, 00 hours, 00 minutes, 02 seconds, 00 milliseconds.');
expect((this as any).$el.textContent).toBe('00 days, 00 hours, 00 minutes, 02 seconds, 00 milliseconds.');
done();
},
methods: {
Expand Down

0 comments on commit e3f9258

Please sign in to comment.