timered-counter
Version:
Make the value change more vivid and natural
20 lines • 977 B
JavaScript
import { expect } from '@storybook/test';
import { sleep } from '../utils/index.js';
export async function emoji(context, { counter, setBy, list, }) {
const { step, args } = context;
await step('Test difference emoji', async () => {
for await (const value of list) {
setBy(counter, 'value', value);
await sleep((args.animationOptions.duration ?? 100) + 10);
await expect(counter.parts.map(({ digits }) => digits).flat().length).toBe(counter.stringAdapter.stringToChars(value).length);
}
});
await step('Decrementing the value', async () => {
for await (const value of list.slice().reverse()) {
setBy(counter, 'value', value);
await sleep((args.animationOptions.duration ?? 100) + 10);
await expect(counter.parts.map(({ digits }) => digits).flat().length).toBe(counter.stringAdapter.stringToChars(value).length);
}
});
}
//# sourceMappingURL=emoji.js.map