From 7bab116dd1b54f73fce26415b52ad1a272d454a2 Mon Sep 17 00:00:00 2001 From: Michael Cousins Date: Mon, 5 Feb 2024 17:46:57 -0500 Subject: [PATCH 1/3] test(transitions): add `on:introend` test (#311) test(transitions): add on:introend test --- package.json | 1 + src/__tests__/fixtures/Transitioner.svelte | 18 +++++++++++++ src/__tests__/transition.test.js | 30 ++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 src/__tests__/fixtures/Transitioner.svelte create mode 100644 src/__tests__/transition.test.js diff --git a/package.json b/package.json index d6a153d..20bc1c2 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "devDependencies": { "@sveltejs/vite-plugin-svelte": "^2.4.2", "@testing-library/jest-dom": "^6.3.0", + "@testing-library/user-event": "^14.5.2", "@typescript-eslint/eslint-plugin": "6.19.1", "@typescript-eslint/parser": "6.19.1", "@vitest/coverage-v8": "^0.33.0", diff --git a/src/__tests__/fixtures/Transitioner.svelte b/src/__tests__/fixtures/Transitioner.svelte new file mode 100644 index 0000000..2ee1557 --- /dev/null +++ b/src/__tests__/fixtures/Transitioner.svelte @@ -0,0 +1,18 @@ + + + + +{#if show} +
(introDone = true)}> + {#if introDone} +

Done

+ {:else} +

Pending

+ {/if} +
+{/if} diff --git a/src/__tests__/transition.test.js b/src/__tests__/transition.test.js new file mode 100644 index 0000000..5b1ff18 --- /dev/null +++ b/src/__tests__/transition.test.js @@ -0,0 +1,30 @@ +import { userEvent } from '@testing-library/user-event' +import { beforeEach, describe, expect, test, vi } from 'vitest' + +import { render, screen, waitFor } from '..' +import Transitioner from './fixtures/Transitioner.svelte' + +describe('transitions', () => { + beforeEach(() => { + if (window.navigator.userAgent.includes('jsdom')) { + const raf = (fn) => setTimeout(() => fn(new Date()), 16) + vi.stubGlobal('requestAnimationFrame', raf) + } + }) + + test('on:introend', async () => { + const user = userEvent.setup() + + render(Transitioner) + const start = screen.getByRole('button') + await user.click(start) + + const pending = screen.getByTestId('intro-pending') + expect(pending).toBeInTheDocument() + + await waitFor(() => { + const done = screen.queryByTestId('intro-done') + expect(done).toBeInTheDocument() + }) + }) +}) From 803e9bc52f63586304e7f085a58e8993c372f991 Mon Sep 17 00:00:00 2001 From: Michael Cousins Date: Mon, 5 Feb 2024 17:48:14 -0500 Subject: [PATCH 2/3] ci: update semantic-pull-request and cleanup dependabot (#306) --- .github/dependabot.yml | 29 ++++++----------------------- .github/workflows/lint-pr.yml | 4 ++-- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 4851fc4..8b4845b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,25 +1,8 @@ version: 2 updates: -- package-ecosystem: npm - directory: "/" - schedule: - interval: daily - time: "10:00" - open-pull-requests-limit: 10 - ignore: - - dependency-name: husky - versions: - - 5.0.9 - - 5.1.0 - - 5.1.1 - - 5.1.2 - - 5.1.3 - - 5.2.0 - - dependency-name: "@commitlint/config-conventional" - versions: - - 12.0.0 - - 12.0.1 - - dependency-name: "@commitlint/cli" - versions: - - 12.0.0 - - 12.0.1 + - package-ecosystem: npm + directory: '/' + schedule: + interval: daily + time: '10:00' + open-pull-requests-limit: 10 diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml index ad6df65..9050f17 100644 --- a/.github/workflows/lint-pr.yml +++ b/.github/workflows/lint-pr.yml @@ -1,4 +1,4 @@ -name: "Lint PR" +name: 'Lint PR' on: pull_request_target: @@ -12,6 +12,6 @@ jobs: name: Validate PR title runs-on: ubuntu-latest steps: - - uses: amannn/action-semantic-pull-request@v4 + - uses: amannn/action-semantic-pull-request@v5 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c4ce879ad71e28dcada2a99ca76b07cbba58cd78 Mon Sep 17 00:00:00 2001 From: Michael Cousins Date: Mon, 12 Feb 2024 10:24:25 -0500 Subject: [PATCH 3/3] ci: run release workflow on `next` branch (#315) --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e218a53..c6e83fa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,9 +2,9 @@ name: CI on: push: - branches: [main] + branches: [main, next] pull_request: - branches: [main] + branches: [main, next] concurrency: group: ${{ github.workflow }}-${{ github.ref }}