-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(maz-ui): MazAnimateCounter - animation on mobile browsers
- Loading branch information
1 parent
4aeb5ca
commit 984ec37
Showing
5 changed files
with
105 additions
and
123 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
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
49 changes: 49 additions & 0 deletions
49
packages/lib/tests/specs/components/MazAnimatedCounter.spec.ts
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import MazAnimatedCounter from '@components/MazAnimatedCounter.vue' | ||
import { shallowMount } from '@vue/test-utils' | ||
|
||
describe('mazAnimatedCounter', () => { | ||
it('renders initial count with prefix and suffix', async () => { | ||
const wrapper = shallowMount(MazAnimatedCounter, { | ||
props: { count: 10, prefix: '$' }, | ||
}) | ||
|
||
expect(wrapper.find('.maz-sr-only').text()).toBe('$10') | ||
expect(wrapper.text()).toBe('$10$0') | ||
|
||
await new Promise(resolve => setTimeout(resolve, 100)) | ||
expect(wrapper.text()).toBe('$10$0') | ||
Check failure on line 14 in packages/lib/tests/specs/components/MazAnimatedCounter.spec.ts GitHub Actions / coveragetests/specs/components/MazAnimatedCounter.spec.ts > mazAnimatedCounter > renders initial count with prefix and suffix
|
||
}) | ||
|
||
it('updates count and triggers animation', async () => { | ||
const wrapper = shallowMount(MazAnimatedCounter, { | ||
props: { count: 10, suffix: '%' }, | ||
}) | ||
|
||
expect(wrapper.find('.maz-sr-only').text()).toBe('10%') | ||
expect(wrapper.text()).toBe('10%0%') | ||
|
||
await new Promise(resolve => setTimeout(resolve, 100)) | ||
expect(wrapper.text()).toBe('10%0%') | ||
Check failure on line 26 in packages/lib/tests/specs/components/MazAnimatedCounter.spec.ts GitHub Actions / coveragetests/specs/components/MazAnimatedCounter.spec.ts > mazAnimatedCounter > updates count and triggers animation
|
||
|
||
await wrapper.setProps({ count: 20, suffix: '%' }) | ||
expect(wrapper.find('.maz-sr-only').text()).toBe('20%') | ||
expect(wrapper.text()).toBe('20%10%') | ||
|
||
// await new Promise(resolve => setTimeout(resolve, 100)) | ||
// expect(wrapper.text()).toBe('20%-52100%') | ||
}) | ||
|
||
it('respects delay prop', async () => { | ||
const wrapper = shallowMount(MazAnimatedCounter, { | ||
props: { count: 10, delay: 200 }, | ||
}) | ||
|
||
expect(wrapper.text()).toBe('100') | ||
|
||
await new Promise(resolve => setTimeout(resolve, 100)) | ||
expect(wrapper.text()).toBe('100') | ||
|
||
// await new Promise(resolve => setTimeout(resolve, 200)) | ||
// expect(wrapper.html()).toBe('10') | ||
}) | ||
}) |
46 changes: 0 additions & 46 deletions
46
packages/lib/tests/specs/components/maz-animated-counter.spec.ts
This file was deleted.
Oops, something went wrong.