Skip to content

Commit

Permalink
add test from sonner
Browse files Browse the repository at this point in the history
  • Loading branch information
Corentin Marzin committed Oct 17, 2024
1 parent a30f60f commit 7ac0fb7
Show file tree
Hide file tree
Showing 10 changed files with 2,000 additions and 3,444 deletions.
3 changes: 0 additions & 3 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
'Carbon:cafe': typeof import('~icons/carbon/cafe')['default']
'Carbon:logoTwitter': typeof import('~icons/carbon/logo-twitter')['default']
CheckIcon: typeof import('./src/components/icons/CheckIcon.vue')['default']
CopyIcon: typeof import('./src/components/icons/CopyIcon.vue')['default']
Expand: typeof import('./src/components/Expand.vue')['default']
Expand All @@ -17,7 +15,6 @@ declare module 'vue' {
HeadlessToastWithProps: typeof import('./src/components/HeadlessToastWithProps.vue')['default']
Hero: typeof import('./src/components/Hero.vue')['default']
Installation: typeof import('./src/components/Installation.vue')['default']
'Mdi:heart': typeof import('~icons/mdi/heart')['default']
Others: typeof import('./src/components/Others.vue')['default']
Position: typeof import('./src/components/Position.vue')['default']
Styling: typeof import('./src/components/Styling.vue')['default']
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"author": "xiaoluoboding <[email protected]>",
"scripts": {
"dev": "vite",
"build:dev": "vite build --mode lib --watch",
"build:docs": "vite build --mode docs",
"build:lib": "vite build --mode lib && pnpm run build:types",
"build:types": "vue-tsc -p tsconfig.build.json && api-extractor run",
Expand Down
1 change: 1 addition & 0 deletions packages/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class Observer {
)
})
}
console.log('coucou 3')

this.subscribers.forEach((subscriber) => subscriber({ id, dismiss: true }))
return id
Expand Down
7 changes: 1 addition & 6 deletions test/e2e/vue.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ test.describe('Basic functionality', () => {
await expect(toast.promise(rejectedPromise, {}).unwrap()).rejects.toThrow('Promise rejected');
});

test('render custom jsx in toast', async ({ page }) => {
await page.getByTestId('custom').click();
await expect(page.getByText('jsx')).toHaveCount(1);
});

test('toast is removed after swiping down', async ({ page }) => {
await page.getByTestId('default-button').click();
await page.hover('[data-sonner-toast]');
Expand Down Expand Up @@ -102,7 +97,7 @@ test.describe('Basic functionality', () => {
});

test('toast is dismissed programmatically after 500ms', async ({ page }) => {
await page.getByTestId('infinity-toast').click();
await page.getByTestId('dismiss-toast').click();
const timeout = new Promise((resolve) => setTimeout(resolve, 600));
await timeout;
await expect(page.locator('[data-sonner-toast]')).toHaveCount(0);
Expand Down
Loading

0 comments on commit 7ac0fb7

Please sign in to comment.