Skip to content

Commit

Permalink
Merge pull request #1162 from libris/chore/format-and-lint-supersearc…
Browse files Browse the repository at this point in the history
…h-and-codemirror-lang-lxlquery

chore(supersearch, lxl-querylang): Format and lint code (missed by husky)
  • Loading branch information
johanbissemattsson authored Nov 14, 2024
2 parents 34048b0 + 1c8697f commit 8a2431e
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/codemirror-lang-lxlquery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"test": "vitest",
"prepare": "cd ../../ && husky && cd ./packages/codemirror-lang-lxlquery && rollup -c",
"lint": "eslint . && prettier --check .",
"lint": "eslint . && prettier --check .",
"format": "prettier --write ."
},
"lint-staged": {
Expand Down
5 changes: 4 additions & 1 deletion packages/codemirror-lang-lxlquery/test/grammar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ for (const file of fs.readdirSync(caseDir)) {
const name = /^[^.]*/.exec(file)?.[0];
if (name) {
describe(name, () => {
for (const { name, run } of fileTests(fs.readFileSync(path.join(caseDir, file), 'utf8'), file))
for (const { name, run } of fileTests(
fs.readFileSync(path.join(caseDir, file), 'utf8'),
file
))
it(name, () => run(lxlQueryLanguage.parser));
});
}
Expand Down
6 changes: 3 additions & 3 deletions packages/codemirror-lang-lxlquery/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
include: ['**/*.{test,spec}.{js,ts}']
}
test: {
include: ['**/*.{test,spec}.{js,ts}']
}
});
22 changes: 15 additions & 7 deletions packages/supersearch/e2e/supersearch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@ test.beforeEach(async ({ page }) => {
});

test('submits closest form on enter key press', async ({ page }) => {
await page.locator('[data-test-id="test1"]').getByRole('textbox').locator('div').fill('hello world')
await page.keyboard.press('Enter');
await expect(page).toHaveURL('/test1?q=hello+world')
await page
.locator('[data-test-id="test1"]')
.getByRole('textbox')
.locator('div')
.fill('hello world');
await page.keyboard.press('Enter');
await expect(page).toHaveURL('/test1?q=hello+world');
});

test('submits form identified by form attribute on enter key press', async ({ page }) => {
await page.locator('[data-test-id="test2"]').getByRole('textbox').locator('div').fill('hello world')
await page.keyboard.press('Enter');
await expect(page).toHaveURL('/test2?q=hello+world')
});
await page
.locator('[data-test-id="test2"]')
.getByRole('textbox')
.locator('div')
.fill('hello world');
await page.keyboard.press('Enter');
await expect(page).toHaveURL('/test2?q=hello+world');
});
2 changes: 1 addition & 1 deletion packages/supersearch/src/lib/components/CodeMirror.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
};
let {
value = '', // value isn't bindable as it can easily cause undo/redo history issues when changing the value from outside – it's preferable to dispatch changes instead
value = '', // value isn't bindable as it can easily cause undo/redo history issues when changing the value from outside – it's preferable to dispatch changes instead
extensions = [],
onchange = () => {},
editorView = $bindable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { EditorView, keymap } from '@codemirror/view';

/**
* CodeMirror extension that submits form elements (either the closest or by specified id using the `form` attribute) on enter keypresses.
*
*
* @param {string} form Optional id of the `<form>` element with which the form control should be associated with (equivalent with
* the [form attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#form) on HTML Input elements).
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/supersearch/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import SuperSearch from '$lib/components/SuperSearch.svelte';

export { SuperSearch }
export { SuperSearch };
2 changes: 1 addition & 1 deletion packages/supersearch/src/routes/test1/+page.svelte
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<h1>A test route</h1>
<h1>A test route</h1>
2 changes: 1 addition & 1 deletion packages/supersearch/src/routes/test2/+page.svelte
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<h1>Another test route</h1>
<h1>Another test route</h1>

0 comments on commit 8a2431e

Please sign in to comment.