Skip to content

Commit

Permalink
link check treat 403 http status as alive, update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Mar 11, 2024
1 parent 0f85b67 commit 1b04c15
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/link-check-config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"aliveStatusCodes": [200, 429]
"aliveStatusCodes": [200, 403, 429]
}
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ repos:
exclude: changelog\.md

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.0.0-beta.1
rev: v9.0.0-beta.2
hooks:
- id: eslint
types: [file]
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
},
"devDependencies": {
"@iconify/svelte": "^3.1.6",
"@playwright/test": "^1.41.2",
"@playwright/test": "^1.42.1",
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.5.2",
"@sveltejs/package": "2.2.7",
"@sveltejs/kit": "^2.5.3",
"@sveltejs/package": "2.3.0",
"@sveltejs/vite-plugin-svelte": "3.0.2",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"@vitest/coverage-v8": "^1.3.1",
"eslint": "^8.57.0",
"eslint-plugin-svelte": "^2.35.1",
Expand All @@ -43,17 +43,17 @@
"mdsvex": "^0.11.0",
"mdsvexamples": "^0.4.1",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.1",
"prettier-plugin-svelte": "^3.2.2",
"rehype-autolink-headings": "^7.1.0",
"rehype-slug": "^6.0.0",
"svelte-check": "^3.6.4",
"svelte-check": "^3.6.6",
"svelte-multiselect": "^10.2.0",
"svelte-preprocess": "^5.1.3",
"svelte-toc": "^0.5.7",
"svelte-zoo": "^0.4.10",
"svelte2tsx": "^0.7.1",
"typescript": "5.3.3",
"vite": "^5.1.4",
"svelte2tsx": "^0.7.3",
"typescript": "5.4.2",
"vite": "^5.1.5",
"vitest": "^1.3.1"
},
"keywords": [
Expand Down
6 changes: 3 additions & 3 deletions src/lib/CmdPalette.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
}
}
function run_and_close(event: CustomEvent<{ option: Action }>) {
event.detail.option.action()
function trigger_action_and_close(event: CustomEvent<{ option: Action }>) {
event.detail.option.action(event.detail.option.label)
open = false
}
</script>
Expand All @@ -48,7 +48,7 @@
options={actions}
bind:input
{placeholder}
on:add={run_and_close}
on:add={trigger_action_and_close}
on:keydown={toggle}
{...$$restProps}
let:option
Expand Down
2 changes: 1 addition & 1 deletion src/site/LanguageSlot.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$: src = `https://cdn.jsdelivr.net/gh/devicons/devicon/icons/${lang}/${lang}-original.svg`
let hidden = false
// default back to visible every time src changes to see if the image loads successfully
// default back to visible every time src changes to see if image loads successfully
$: src, (hidden = false)
</script>

Expand Down
24 changes: 12 additions & 12 deletions tests/MultiSelect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { foods } from '../src/site/options.ts'

test.describe.configure({ mode: `parallel` })

test.describe(`input`, async () => {
test.describe(`input`, () => {
test.skip(`opens dropdown on focus`, async ({ page }) => {
await page.goto(`/ui`, { waitUntil: `networkidle` })
expect(await page.$(`div.multiselect > ul.options.hidden`)).toBeTruthy()
Expand Down Expand Up @@ -53,7 +53,7 @@ test.describe(`input`, async () => {
})
})

test.describe(`remove single button`, async () => {
test.describe(`remove single button`, () => {
test(`should remove 1 option`, async ({ page }) => {
await page.goto(`/ui`, { waitUntil: `networkidle` })

Expand All @@ -69,7 +69,7 @@ test.describe(`remove single button`, async () => {
})
})

test.describe(`remove all button`, async () => {
test.describe(`remove all button`, () => {
test.beforeEach(async ({ page }) => {
await page.goto(`/ui`, { waitUntil: `networkidle` })

Expand Down Expand Up @@ -112,7 +112,7 @@ test.describe(`remove all button`, async () => {
// })
})

test.describe(`external CSS classes`, async () => {
test.describe(`external CSS classes`, () => {
for (const [prop, selector, cls] of [
[`outerDiv`, `div.multiselect`, `wrapper`],
[`ulSelected`, `ul.selected`, `user-choices`],
Expand Down Expand Up @@ -148,7 +148,7 @@ test.describe(`external CSS classes`, async () => {
}
})

test.describe(`disabled multiselect`, async () => {
test.describe(`disabled multiselect`, () => {
test.beforeEach(async ({ page }) => {
await page.goto(`/disabled`, { waitUntil: `networkidle` })
})
Expand Down Expand Up @@ -182,7 +182,7 @@ test.describe(`disabled multiselect`, async () => {
})
})

test.describe(`accessibility`, async () => {
test.describe(`accessibility`, () => {
test.beforeEach(async ({ page }) => {
await page.goto(`/ui`, { waitUntil: `networkidle` })
})
Expand Down Expand Up @@ -249,7 +249,7 @@ test.describe(`accessibility`, async () => {
})
})

test.describe(`multiselect`, async () => {
test.describe(`multiselect`, () => {
test(`can select and remove many options`, async ({ page }) => {
await page.goto(`/ui`, { waitUntil: `networkidle` })

Expand Down Expand Up @@ -319,7 +319,7 @@ test.describe(`multiselect`, async () => {
})
})

test.describe(`allowUserOptions`, async () => {
test.describe(`allowUserOptions`, () => {
test(`entering custom option adds it to selected but not to options`, async ({
page,
}) => {
Expand Down Expand Up @@ -435,7 +435,7 @@ test.describe(`allowUserOptions`, async () => {
})
})

test.describe(`sortSelected`, async () => {
test.describe(`sortSelected`, () => {
const labels = `Svelte Vue React Angular Polymer Laravel Django`.split(` `)

test(`default sorting is alphabetical by label`, async ({ page }) => {
Expand Down Expand Up @@ -472,7 +472,7 @@ test.describe(`sortSelected`, async () => {
})
})

test.describe(`parseLabelsAsHtml`, async () => {
test.describe(`parseLabelsAsHtml`, () => {
test(`renders anchor tags as links`, async ({ page }) => {
await page.goto(`/parse-labels-as-html`, { waitUntil: `networkidle` })

Expand All @@ -498,7 +498,7 @@ test.describe(`parseLabelsAsHtml`, async () => {
})
})

test.describe(`maxSelect`, async () => {
test.describe(`maxSelect`, () => {
const max_select = 5

test.beforeEach(async ({ page }) => {
Expand Down Expand Up @@ -537,7 +537,7 @@ test.describe(`maxSelect`, async () => {
})
})

test.describe(`slots`, async () => {
test.describe(`slots`, () => {
test(`renders remove-icon slot for individual remove buttons and the remove-all button`, async ({
page,
}) => {
Expand Down
1 change: 1 addition & 0 deletions tests/unit/CmdPalette.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ test(`calls the action when an option is selected`, async () => {
input.dispatchEvent(new KeyboardEvent(`keydown`, { key: `Enter` }))

expect(spy).toHaveBeenCalledOnce()
expect(spy).toHaveBeenCalledWith(actions[0].label)
})

test.each([[[`Escape`]], [[`x`]], [[`Escape`, `x`]]])(
Expand Down
19 changes: 10 additions & 9 deletions tests/unit/MultiSelect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ test(`2-way binding of activeIndex`, async () => {
target: document.body,
props: { options: [1, 2, 3] },
})
binder.$on(`activeIndex-changed`, (e: CustomEvent) => {
activeIndex = e.detail
binder.$on(`activeIndex-changed`, (event: CustomEvent) => {
activeIndex = event.detail
})

// test internal changes to activeIndex bind outwards
Expand All @@ -44,8 +44,8 @@ test(`1-way binding of activeOption and hovering an option makes it active`, asy

// test internal change to activeOption binds outwards
let active_option: number = 0
binder.$on(`activeOption-changed`, (e: CustomEvent) => {
active_option = e.detail
binder.$on(`activeOption-changed`, (event: CustomEvent) => {
active_option = event.detail
})
const cb = vi.fn()
binder.$on(`activeOption-changed`, cb)
Expand All @@ -56,6 +56,7 @@ test(`1-way binding of activeOption and hovering an option makes it active`, asy
await tick()
expect(active_option).toBe(1)
expect(cb).toBeCalledTimes(1)
expect(cb.mock.calls[0][0].detail).toBe(1)
})

test(`1-way binding of activeOption and hovering an option makes it active`, async () => {
Expand All @@ -66,8 +67,8 @@ test(`1-way binding of activeOption and hovering an option makes it active`, asy

// test internal change to activeOption binds outwards
let activeOption: number = 0
binder.$on(`activeOption-changed`, (e: CustomEvent) => {
activeOption = e.detail
binder.$on(`activeOption-changed`, (event: CustomEvent) => {
activeOption = event.detail
})
const cb = vi.fn()
binder.$on(`activeOption-changed`, cb)
Expand Down Expand Up @@ -392,7 +393,7 @@ test.each([
async (options) => {
const form = document.createElement(`form`)
// actual form submission not supported in nodejs, would throw without preventing default behavior
form.onsubmit = (e) => e.preventDefault()
form.onsubmit = (event) => event.preventDefault()
document.body.appendChild(form)

const field_name = `test form submission`
Expand Down Expand Up @@ -735,8 +736,8 @@ test(`2-way binding of selected`, async () => {
target: document.body,
props: { options: [1, 2, 3] },
})
binder.$on(`selected-changed`, (e: CustomEvent) => {
selected = e.detail
binder.$on(`selected-changed`, (event: CustomEvent) => {
selected = event.detail
})

// test internal changes to selected bind outwards
Expand Down

0 comments on commit 1b04c15

Please sign in to comment.