Skip to content

Commit

Permalink
Merge pull request #48 from kiosion/bump-svelte
Browse files Browse the repository at this point in the history
Bump svelte to `5.0.0-next.90`
  • Loading branch information
kiosion committed Mar 30, 2024
2 parents f683a0e + 19a66f8 commit 33be7f3
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 59 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"!dist/**/*.spec.*"
],
"peerDependencies": {
"svelte": "^5.0.0-next.57"
"svelte": "^5.0.0-next.89"
},
"devDependencies": {
"@playwright/test": "1.42.1",
Expand All @@ -63,7 +63,7 @@
"prettier": "3.2.5",
"prettier-plugin-svelte": "3.2.2",
"publint": "0.2.7",
"svelte": "5.0.0-next.82",
"svelte": "5.0.0-next.90",
"svelte-check": "3.6.8",
"tslib": "2.6.2",
"typescript": "5.4.3",
Expand Down
80 changes: 40 additions & 40 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/routes/+layout.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const ssr = false;
export const ssr = true;
34 changes: 18 additions & 16 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,27 @@
<span>extra large 2</span>
{/snippet}

<Breakpoints queries={DEFAULT_BREAKPOINT_SIZES} content={{ xl2 }}>
{#snippet sm()}
<span>small</span>
{/snippet}
{#snippet md()}
<span>medium</span>
{/snippet}
{#snippet lg()}
<span>large</span>
{/snippet}
{#snippet xl()}
<span>extra large</span>
{/snippet}
<span>unknown</span>
</Breakpoints>
<span data-test-id="current-match">
<Breakpoints queries={DEFAULT_BREAKPOINT_SIZES} content={{ xl2 }}>
{#snippet sm()}
small
{/snippet}
{#snippet md()}
medium
{/snippet}
{#snippet lg()}
large
{/snippet}
{#snippet xl()}
extra large
{/snippet}
unknown
</Breakpoints>
</span>
</strong></h2>

<Breakpoints queries={DEFAULT_BREAKPOINT_SIZES} let:$matches>
<p>Here are all matching queries from binding to the store: {$matches.join(', ')}</p>
<p>Here are all matching queries from binding to the store: <span data-test-id="matches-store">{$matches.join(', ')}</span></p>
</Breakpoints>

<Breakpoints queries={{
Expand Down
24 changes: 24 additions & 0 deletions tests/index_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,27 @@ test('index page breakpoints respond to viewport changes', async ({ page }) => {
).toBeVisible();
}
});

test('store of current matches functions as expected', async ({ page }) => {
await page.goto('/');

await page.setViewportSize({ width: 400, height: 600 });

await expect(page.locator('[data-test-id="matches-store"]')).toBeVisible();

expect(
await page.locator('[data-test-id="matches-store"]').textContent()
).toEqual('sm');

await page.setViewportSize({ width: 800, height: 600 });

expect(
await page.locator('[data-test-id="matches-store"]').textContent()
).toEqual('sm, md');

await page.setViewportSize({ width: 1050, height: 600 });

expect(
await page.locator('[data-test-id="matches-store"]').textContent()
).toEqual('sm, md, lg');
});

0 comments on commit 33be7f3

Please sign in to comment.