From d95f300e57d36f2b14220f67b994a6db3cf23d32 Mon Sep 17 00:00:00 2001 From: Katy DeCorah Date: Thu, 20 Jul 2023 20:28:39 -0400 Subject: [PATCH] Revert Prettier Update main-app.test.ts.snap --- .prettierignore | 1 + components/clear-button.ts | 2 +- components/custom-event.ts | 2 +- components/filter-checkbox.ts | 4 +- components/filter-select.ts | 6 +- components/filter.ts | 14 +-- components/font-item.ts | 12 +-- components/main-app.ts | 6 +- components/pagination-buttons.ts | 2 +- components/search-status.ts | 2 +- components/set-attributes.ts | 2 +- components/tag-button.ts | 4 +- data/data.json | 6 +- package-lock.json | 12 +-- package.json | 2 +- test/__snapshots__/main-app.test.ts.snap | 26 ++++-- test/clear-button.test.ts | 2 +- test/families.test.ts | 21 ++--- test/filter-checkbox.test.ts | 4 +- test/filter-select.test.ts | 2 +- test/font-item.test.ts | 48 +++++------ test/main-app.test.ts | 104 +++++++++++------------ test/search-status.test.ts | 2 +- test/tag-button.test.ts | 4 +- 24 files changed, 150 insertions(+), 140 deletions(-) diff --git a/.prettierignore b/.prettierignore index 9e0713f6..acc095fa 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,3 @@ _site package-lock.json +coverage \ No newline at end of file diff --git a/components/clear-button.ts b/components/clear-button.ts index 35518acc..28605951 100644 --- a/components/clear-button.ts +++ b/components/clear-button.ts @@ -11,7 +11,7 @@ class ClearButton extends HTMLButtonElement { this.dispatchEvent( customEvent("clear-filter", { value: this.value, - }), + }) ); } } diff --git a/components/custom-event.ts b/components/custom-event.ts index 62a47b1e..ed68dbde 100644 --- a/components/custom-event.ts +++ b/components/custom-event.ts @@ -3,7 +3,7 @@ export default function customEvent( detail?: { value?: string | boolean | number; id?: string; - }, + } ): CustomEvent { return new CustomEvent(eventName, { bubbles: true, diff --git a/components/filter-checkbox.ts b/components/filter-checkbox.ts index 42d724be..6cdb31d7 100644 --- a/components/filter-checkbox.ts +++ b/components/filter-checkbox.ts @@ -18,7 +18,7 @@ class FilterCheckbox extends HTMLInputElement { customEvent("handle-filter", { value: this.checked, id: this.id, - }), + }) ); this.setUrlParam(); } @@ -34,7 +34,7 @@ class FilterCheckbox extends HTMLInputElement { window.history.replaceState( {}, "", - `${window.location.pathname}?${urlParameters.toString()}`, + `${window.location.pathname}?${urlParameters.toString()}` ); } diff --git a/components/filter-select.ts b/components/filter-select.ts index f110d998..911215cf 100644 --- a/components/filter-select.ts +++ b/components/filter-select.ts @@ -30,8 +30,8 @@ class FilterSelect extends HTMLSelectElement { { value, id, - }, - ), + } + ) ); this.setUrlParam(); @@ -48,7 +48,7 @@ class FilterSelect extends HTMLSelectElement { window.history.replaceState( {}, "", - `${window.location.pathname}?${urlParameters.toString()}`, + `${window.location.pathname}?${urlParameters.toString()}` ); } diff --git a/components/filter.ts b/components/filter.ts index e25d4f53..a0f83b36 100644 --- a/components/filter.ts +++ b/components/filter.ts @@ -12,7 +12,7 @@ export default function filter( currentPage: number; pageSize: number; }, - generatedData: GeneratedData, + generatedData: GeneratedData ): [number, GeneratedData] { const { selectedSearch, @@ -29,7 +29,7 @@ export default function filter( if (selectedSearch) { filteredData = filteredData.filter((row) => - row.family.toLowerCase().includes(selectedSearch.toLowerCase()), + row.family.toLowerCase().includes(selectedSearch.toLowerCase()) ); } @@ -41,17 +41,17 @@ export default function filter( } if (selectedCategory) { filteredData = filteredData.filter( - (row) => row.category === selectedCategory, + (row) => row.category === selectedCategory ); } if (selectedSubset) { filteredData = filteredData.filter((row) => - row.subsets.includes(selectedSubset), + row.subsets.includes(selectedSubset) ); } if (selectedVariant) { filteredData = filteredData.filter((row) => - row.variants.includes(selectedVariant), + row.variants.includes(selectedVariant) ); } @@ -62,13 +62,13 @@ export default function filter( if (sortBy === "date") { filteredData = filteredData.sort( (a, b) => - new Date(b.lastModified).getTime() - new Date(a.lastModified).getTime(), + new Date(b.lastModified).getTime() - new Date(a.lastModified).getTime() ); } if (sortBy === "family") { filteredData = filteredData.sort((a, b) => - a.family.localeCompare(b.family), + a.family.localeCompare(b.family) ); } diff --git a/components/font-item.ts b/components/font-item.ts index 1cf285e3..23a14a38 100644 --- a/components/font-item.ts +++ b/components/font-item.ts @@ -73,7 +73,7 @@ class FontItem extends HTMLLIElement { const tagButtons = tags .map( (tag: string) => - ``, + `` ) .join(""); @@ -89,11 +89,11 @@ class FontItem extends HTMLLIElement { @@ -135,7 +135,7 @@ class FontItem extends HTMLLIElement { disconnectedCallback() { const linkElement = document.querySelector( - `link[data-family="${this.font.family}"]`, + `link[data-family="${this.font.family}"]` ); if (linkElement) linkElement.remove(); } diff --git a/components/main-app.ts b/components/main-app.ts index 7e68c86a..b9c4ce43 100644 --- a/components/main-app.ts +++ b/components/main-app.ts @@ -186,7 +186,7 @@ class MainApp extends HTMLElement { window.dispatchEvent( customEvent("remove-select", { value, - }), + }) ); } @@ -207,7 +207,7 @@ class MainApp extends HTMLElement { handleSearch(event: Event) { this.selectedSearch = (event.target as HTMLInputElement).value.replaceAll( /[^\d A-Za-z-]/g, - "", + "" ); this.scrollToContent(); } @@ -229,7 +229,7 @@ class MainApp extends HTMLElement { attributeChangedCallback( name: string, previousValue: string, - nextValue: string, + nextValue: string ) { if (previousValue === nextValue) return; if (name !== "current-page" && this.currentPage !== 1) { diff --git a/components/pagination-buttons.ts b/components/pagination-buttons.ts index 361698f3..bab83ef6 100644 --- a/components/pagination-buttons.ts +++ b/components/pagination-buttons.ts @@ -93,7 +93,7 @@ class PaginationButtons extends HTMLElement { window.history.replaceState( {}, "", - `${window.location.pathname}?${urlParameters.toString()}`, + `${window.location.pathname}?${urlParameters.toString()}` ); } diff --git a/components/search-status.ts b/components/search-status.ts index aa6ba6be..4bbaeb65 100644 --- a/components/search-status.ts +++ b/components/search-status.ts @@ -58,7 +58,7 @@ class SearchStatus extends HTMLElement { this.selectedFilters .map((filter) => this.renderFilter(filter)) .join(""), - ``, + `` ); } diff --git a/components/set-attributes.ts b/components/set-attributes.ts index 0ddb800c..bb1e523b 100644 --- a/components/set-attributes.ts +++ b/components/set-attributes.ts @@ -2,7 +2,7 @@ export function setAttributes( element: HTMLElement, attributes: { [x: string]: string; - }, + } ) { for (const key in attributes) { if (attributes[key] !== undefined && attributes[key] !== null) { diff --git a/components/tag-button.ts b/components/tag-button.ts index fa03cd8d..fbfadfb2 100644 --- a/components/tag-button.ts +++ b/components/tag-button.ts @@ -33,7 +33,7 @@ class TagButton extends HTMLButtonElement { customEvent("tag-button-selected", { id: "selectedTag", value: this.value, - }), + }) ); this.setUrlParam(); @@ -45,7 +45,7 @@ class TagButton extends HTMLButtonElement { window.history.replaceState( {}, "", - `${window.location.pathname}?${urlParameters.toString()}`, + `${window.location.pathname}?${urlParameters.toString()}` ); } diff --git a/data/data.json b/data/data.json index 98d089e9..952b0f25 100644 --- a/data/data.json +++ b/data/data.json @@ -9700,7 +9700,7 @@ "tags": ["outline", "icons"], "lineNumber": 777, "variable": false, - "lastModified": "2023-07-13" + "lastModified": "2023-07-20" }, { "family": "Material Symbols Rounded", @@ -9710,7 +9710,7 @@ "tags": ["round", "icons"], "lineNumber": 778, "variable": false, - "lastModified": "2023-07-13" + "lastModified": "2023-07-20" }, { "family": "Material Symbols Sharp", @@ -9720,7 +9720,7 @@ "tags": ["icons"], "lineNumber": 779, "variable": false, - "lastModified": "2023-07-13" + "lastModified": "2023-07-20" }, { "family": "Maven Pro", diff --git a/package-lock.json b/package-lock.json index f0c58582..d86d0aa3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "jest-environment-jsdom": "^29.6.1", "lint-staged": "^13.2.3", "node-fetch": "^3.3.1", - "prettier": "^3.0.0", + "prettier": "^2.8.8", "stylelint": "^15.10.1", "stylelint-config-standard": "^34.0.0", "ts-jest": "^29.1.1", @@ -8924,15 +8924,15 @@ } }, "node_modules/prettier": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.0.tgz", - "integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==", + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "dev": true, "bin": { - "prettier": "bin/prettier.cjs" + "prettier": "bin-prettier.js" }, "engines": { - "node": ">=14" + "node": ">=10.13.0" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" diff --git a/package.json b/package.json index 5968c5a0..ddd60904 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "jest-environment-jsdom": "^29.6.1", "lint-staged": "^13.2.3", "node-fetch": "^3.3.1", - "prettier": "^3.0.0", + "prettier": "^2.8.8", "stylelint": "^15.10.1", "stylelint-config-standard": "^34.0.0", "ts-jest": "^29.1.1", diff --git a/test/__snapshots__/main-app.test.ts.snap b/test/__snapshots__/main-app.test.ts.snap index c439e290..52935a3b 100644 --- a/test/__snapshots__/main-app.test.ts.snap +++ b/test/__snapshots__/main-app.test.ts.snap @@ -3,7 +3,7 @@ exports[`MainApp renders correctly 1`] = ` @@ -2413,7 +2413,7 @@ exports[`MainApp renders correctly 1`] = ` `; const clearButton: HTMLButtonElement = document.querySelector( - "button[is=clear-button]", + "button[is=clear-button]" ); it("renders", () => { expect(clearButton).toMatchInlineSnapshot(` diff --git a/test/families.test.ts b/test/families.test.ts index 37b777bc..bfcb7ff5 100644 --- a/test/families.test.ts +++ b/test/families.test.ts @@ -50,19 +50,16 @@ describe("families.json", () => { // sort tags by number of families // eslint-disable-next-line unicorn/no-array-reduce - const tags = Object.values(families).reduce( - (accumulator, tags) => { - for (const tag of tags) { - if (accumulator[tag]) { - accumulator[tag]++; - } else { - accumulator[tag] = 1; - } + const tags = Object.values(families).reduce((accumulator, tags) => { + for (const tag of tags) { + if (accumulator[tag]) { + accumulator[tag]++; + } else { + accumulator[tag] = 1; } - return accumulator; - }, - {} as Record, - ); + } + return accumulator; + }, {} as Record); const sortedTags = Object.keys(tags).sort((a, b) => tags[b] - tags[a]); describe("tags", () => { diff --git a/test/filter-checkbox.test.ts b/test/filter-checkbox.test.ts index f6530703..085fc65c 100644 --- a/test/filter-checkbox.test.ts +++ b/test/filter-checkbox.test.ts @@ -14,7 +14,7 @@ describe("filter-checkbox", () => { document.body.innerHTML = ``; const filterCheckbox: HTMLInputElement = document.querySelector( - "input[is=filter-checkbox]", + "input[is=filter-checkbox]" ); it("fires a custom event on change", () => { @@ -44,7 +44,7 @@ describe("filter-checkbox", () => { document.body.innerHTML = ``; const filterCheckbox: HTMLInputElement = document.querySelector( - "input[is=filter-checkbox]", + "input[is=filter-checkbox]" ); expect(filterCheckbox.checked).toBe(true); // expect the event to fire after the main-app is loaded diff --git a/test/filter-select.test.ts b/test/filter-select.test.ts index 38cf6982..5060dea7 100644 --- a/test/filter-select.test.ts +++ b/test/filter-select.test.ts @@ -7,7 +7,7 @@ describe("filter-select", () => { `; const filterSelect: HTMLSelectElement = document.querySelector( - "select[is=filter-select]", + "select[is=filter-select]" ); it("fires a custom event on change", () => { diff --git a/test/font-item.test.ts b/test/font-item.test.ts index e7c2d1f2..82c81116 100644 --- a/test/font-item.test.ts +++ b/test/font-item.test.ts @@ -14,9 +14,9 @@ describe("FontItem", () => { const fontItem = document.querySelector("li[is='font-item']"); expect(fontItem).toMatchSnapshot(); expect( - document.querySelector("[data-family='Alef']").getAttribute("href"), + document.querySelector("[data-family='Alef']").getAttribute("href") ).toMatchInlineSnapshot( - `"https://fonts.googleapis.com/css2?family=Alef&text=Alef&display=swap"`, + `"https://fonts.googleapis.com/css2?family=Alef&text=Alef&display=swap"` ); }); @@ -27,9 +27,9 @@ describe("FontItem", () => { expect( document .querySelector("[data-family='GFS Neohellenic']") - .getAttribute("href"), + .getAttribute("href") ).toMatchInlineSnapshot( - `"https://fonts.googleapis.com/css2?family=GFS+Neohellenic&text=%CE%93%CE%B5%CE%B9%CE%AC%20%CF%83%CE%BF%CF%85%20%CE%9A%CF%8C%CF%83%CE%BC%CE%B5&display=swap"`, + `"https://fonts.googleapis.com/css2?family=GFS+Neohellenic&text=%CE%93%CE%B5%CE%B9%CE%AC%20%CF%83%CE%BF%CF%85%20%CE%9A%CF%8C%CF%83%CE%BC%CE%B5&display=swap"` ); }); @@ -38,9 +38,9 @@ describe("FontItem", () => { const fontItem = document.querySelector("li[is='font-item']"); expect(fontItem).toMatchSnapshot(); expect( - document.querySelector("[data-family='Almarai']").getAttribute("href"), + document.querySelector("[data-family='Almarai']").getAttribute("href") ).toMatchInlineSnapshot( - `"https://fonts.googleapis.com/css2?family=Almarai&text=%D9%85%D8%B1%D8%AD%D8%A8%D8%A7%20%D8%A8%D8%A7%D9%84%D8%B9%D8%A7%D9%84%D9%85&display=swap"`, + `"https://fonts.googleapis.com/css2?family=Almarai&text=%D9%85%D8%B1%D8%AD%D8%A8%D8%A7%20%D8%A8%D8%A7%D9%84%D8%B9%D8%A7%D9%84%D9%85&display=swap"` ); }); @@ -49,18 +49,18 @@ describe("FontItem", () => { const fontItem = document.querySelector("li[is='font-item']"); expect(fontItem).toMatchSnapshot(); expect( - document.querySelector("[data-family='Anybody']").getAttribute("href"), + document.querySelector("[data-family='Anybody']").getAttribute("href") ).toMatchInlineSnapshot( - `"https://fonts.googleapis.com/css2?family=Anybody:ital,wght@1,900&text=Anybody&display=swap"`, + `"https://fonts.googleapis.com/css2?family=Anybody:ital,wght@1,900&text=Anybody&display=swap"` ); }); test("selected variant, italic", () => { document.body.innerHTML = `
  • `; expect( - document.querySelector("[data-family='Anybody']").getAttribute("href"), + document.querySelector("[data-family='Anybody']").getAttribute("href") ).toMatchInlineSnapshot( - `"https://fonts.googleapis.com/css2?family=Anybody:ital@1&text=Anybody&display=swap"`, + `"https://fonts.googleapis.com/css2?family=Anybody:ital@1&text=Anybody&display=swap"` ); }); @@ -69,9 +69,9 @@ describe("FontItem", () => { const fontItem = document.querySelector("li[is='font-item']"); expect(fontItem).toMatchSnapshot(); expect( - document.querySelector("[data-family='Anybody']").getAttribute("href"), + document.querySelector("[data-family='Anybody']").getAttribute("href") ).toMatchInlineSnapshot( - `"https://fonts.googleapis.com/css2?family=Anybody:wght@900&text=Anybody&display=swap"`, + `"https://fonts.googleapis.com/css2?family=Anybody:wght@900&text=Anybody&display=swap"` ); }); @@ -80,9 +80,9 @@ describe("FontItem", () => { const fontItem = document.querySelector("li[is='font-item']"); expect(fontItem).toMatchSnapshot(); expect( - document.querySelector("[data-family='Alef']").getAttribute("href"), + document.querySelector("[data-family='Alef']").getAttribute("href") ).toMatchInlineSnapshot( - `"https://fonts.googleapis.com/css2?family=Alef&text=%D7%A9%D6%B8%D7%81%D7%9C%D7%95%D6%B9%D7%9D%20%D7%A2%D7%95%D6%B9%D7%9C%D6%B8%D7%9D%20&display=swap"`, + `"https://fonts.googleapis.com/css2?family=Alef&text=%D7%A9%D6%B8%D7%81%D7%9C%D7%95%D6%B9%D7%9D%20%D7%A2%D7%95%D6%B9%D7%9C%D6%B8%D7%9D%20&display=swap"` ); }); @@ -93,9 +93,9 @@ describe("FontItem", () => { expect( document .querySelector("[data-family='Material Symbols Sharp']") - .getAttribute("href"), + .getAttribute("href") ).toMatchInlineSnapshot( - `"https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp&text=favorite%20add%20delete%20settings%20search&display=swap"`, + `"https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp&text=favorite%20add%20delete%20settings%20search&display=swap"` ); }); @@ -104,26 +104,26 @@ describe("FontItem", () => { const fontItem = document.querySelector("li[is='font-item']"); expect(fontItem).toMatchSnapshot(); expect( - document.querySelector("[data-family='Akshar']").getAttribute("href"), + document.querySelector("[data-family='Akshar']").getAttribute("href") ).toMatchInlineSnapshot( - `"https://fonts.googleapis.com/css2?family=Akshar&text=Akshar&display=swap"`, + `"https://fonts.googleapis.com/css2?family=Akshar&text=Akshar&display=swap"` ); }); test("molle, italic variant only", () => { document.body.innerHTML = `
  • `; expect( - document.querySelector("[data-family='Molle']").getAttribute("href"), + document.querySelector("[data-family='Molle']").getAttribute("href") ).toMatchInlineSnapshot( - `"https://fonts.googleapis.com/css2?family=Molle:ital@1&text=Molle&display=swap"`, + `"https://fonts.googleapis.com/css2?family=Molle:ital@1&text=Molle&display=swap"` ); }); test("sunflower, multiple non-regular variants", () => { document.body.innerHTML = `
  • `; expect( - document.querySelector("[data-family='Sunflower']").getAttribute("href"), + document.querySelector("[data-family='Sunflower']").getAttribute("href") ).toMatchInlineSnapshot( - `"https://fonts.googleapis.com/css2?family=Sunflower:wght@300&text=Sunflower&display=swap"`, + `"https://fonts.googleapis.com/css2?family=Sunflower:wght@300&text=Sunflower&display=swap"` ); }); test("unifrakturcook, one non-regular variant", () => { @@ -131,9 +131,9 @@ describe("FontItem", () => { expect( document .querySelector("[data-family='UnifrakturCook']") - .getAttribute("href"), + .getAttribute("href") ).toMatchInlineSnapshot( - `"https://fonts.googleapis.com/css2?family=UnifrakturCook:wght@700&text=UnifrakturCook&display=swap"`, + `"https://fonts.googleapis.com/css2?family=UnifrakturCook:wght@700&text=UnifrakturCook&display=swap"` ); }); }); diff --git a/test/main-app.test.ts b/test/main-app.test.ts index 8c7d7b85..05739f16 100644 --- a/test/main-app.test.ts +++ b/test/main-app.test.ts @@ -62,11 +62,11 @@ describe("MainApp", () => { expect(selectVariant.value).toBe("300italic"); expect(document.querySelector("search-status")).toMatchInlineSnapshot(`
    - Found 140 fonts: + Found 142 fonts:
    @@ -152,11 +152,11 @@ describe("MainApp", () => { expect(selectedCategory.value).toBe("display"); expect(document.querySelector("search-status")).toMatchInlineSnapshot(`
    - Found 407 fonts: + Found 408 fonts:
    @@ -194,16 +194,16 @@ describe("MainApp", () => { customEvent("tag-button-selected", { value: "need tags", id: "selectedTag", - }), + }) ); const searchStatus = document.querySelector("search-status"); expect(searchStatus).toMatchInlineSnapshot(`
    - Found 422 fonts: + Found 424 fonts:
    @@ -242,22 +242,22 @@ describe("MainApp", () => { customEvent("tag-button-selected", { value: "cute", id: "selectedTag", - }), + }) ); mainApp.dispatchEvent( customEvent("clear-filter", { value: "selectedTag", - }), + }) ); expect(document.querySelector("search-status")).toMatchInlineSnapshot(`
    - Found 1550 fonts + Found 1558 fonts
    `); @@ -271,7 +271,7 @@ describe("MainApp", () => { const searchStatus = document.querySelector("search-status"); const resultsLength = Number.parseInt( - searchStatus.getAttribute("results-length"), + searchStatus.getAttribute("results-length") ); expect(searchStatus).toMatchInlineSnapshot(` @@ -314,7 +314,7 @@ describe("MainApp", () => { // expect there two be resultsLength number of font-items expect(document.querySelectorAll("li[is='font-item']").length).toEqual( - resultsLength, + resultsLength ); }); @@ -326,16 +326,16 @@ describe("MainApp", () => { mainApp.dispatchEvent( customEvent("clear-filter", { value: "selectedSearch", - }), + }) ); const searchStatus = document.querySelector("search-status"); expect(searchStatus).toMatchInlineSnapshot(`
    - Found 1550 fonts + Found 1558 fonts
    `); @@ -385,15 +385,15 @@ describe("MainApp", () => { mainApp.dispatchEvent( customEvent("clear-filter", { value: "selectedVariable", - }), + }) ); expect(document.querySelector("search-status")).toMatchInlineSnapshot(`
    - Found 1550 fonts + Found 1558 fonts
    `); @@ -403,23 +403,23 @@ describe("MainApp", () => { test("removes category filter", async () => { await user.selectOptions( document.querySelector("#selectedCategory"), - "display", + "display" ); mainApp.dispatchEvent( customEvent("clear-filter", { value: "selectedCategory", - }), + }) ); const searchStatus = document.querySelector("search-status"); expect(searchStatus).toMatchInlineSnapshot(`
    - Found 1550 fonts + Found 1558 fonts
    `); @@ -429,23 +429,23 @@ describe("MainApp", () => { test("removes subset filter", async () => { await user.selectOptions( document.querySelector("#selectedSubset"), - "hebrew", + "hebrew" ); mainApp.dispatchEvent( customEvent("clear-filter", { value: "selectedSubset", - }), + }) ); const searchStatus = document.querySelector("search-status"); expect(searchStatus).toMatchInlineSnapshot(`
    - Found 1550 fonts + Found 1558 fonts
    `); @@ -455,23 +455,23 @@ describe("MainApp", () => { test("removes variant filter", async () => { await user.selectOptions( document.querySelector("#selectedVariant"), - "100italic", + "100italic" ); mainApp.dispatchEvent( customEvent("clear-filter", { value: "selectedVariant", - }), + }) ); const searchStatus = document.querySelector("search-status"); expect(searchStatus).toMatchInlineSnapshot(`
    - Found 1550 fonts + Found 1558 fonts
    `); @@ -483,7 +483,7 @@ describe("MainApp", () => { customEvent("tag-button-selected", { value: "modern", id: "selectedTag", - }), + }) ); const checkboxVariable: HTMLInputElement = document.querySelector("#selectedVariable"); @@ -493,17 +493,17 @@ describe("MainApp", () => { await user.selectOptions( document.querySelector("#selectedCategory"), - "display", + "display" ); await user.selectOptions( document.querySelector("#selectedSubset"), - "hebrew", + "hebrew" ); await user.selectOptions( document.querySelector("#selectedVariant"), - "100italic", + "100italic" ); expect(document.querySelector("search-status")).toMatchInlineSnapshot(` @@ -631,7 +631,7 @@ describe("MainApp", () => { expect(document.querySelector("search-status")).toMatchInlineSnapshot(` { selected-variant="" >
    - Found 1550 fonts + Found 1558 fonts
    `); @@ -700,7 +700,7 @@ describe("MainApp", () => { // expect tag to be selected expect( - (document.querySelector("#selectedTag") as HTMLSelectElement).value, + (document.querySelector("#selectedTag") as HTMLSelectElement).value ).toBe("cute"); }); @@ -718,10 +718,10 @@ describe("MainApp", () => { const searchStatus = document.querySelector("search-status"); expect(searchStatus).toMatchInlineSnapshot(`
    - Found 1550 fonts + Found 1558 fonts
    `); @@ -818,10 +818,10 @@ describe("MainApp", () => { expect(checkboxVariable.checked).toBeFalsy(); expect(document.querySelector("search-status")).toMatchInlineSnapshot(`
    - Found 1550 fonts + Found 1558 fonts
    `); @@ -877,7 +877,7 @@ describe("MainApp", () => { `); // expect variable to be checked expect( - (document.querySelector("#selectedVariable") as HTMLInputElement).checked, + (document.querySelector("#selectedVariable") as HTMLInputElement).checked ).toBe(true); }); @@ -895,28 +895,28 @@ describe("MainApp", () => { const searchStatus = document.querySelector("search-status"); expect(searchStatus).toMatchInlineSnapshot(`
    - Found 1550 fonts + Found 1558 fonts
    `); expect( - (document.querySelector("#selectedVariable") as HTMLInputElement).checked, + (document.querySelector("#selectedVariable") as HTMLInputElement).checked ).toBe(false); }); test("sorts fonts when sort-by button is clicked", async () => { const sortByButton: HTMLButtonElement = document.querySelector( - "sort-by button[data-sort='date']", + "sort-by button[data-sort='date']" ); sortByButton.click(); const sortBy = document.querySelector("sort-by"); expect(sortBy).toMatchInlineSnapshot(`
    { it("current page changes on click", () => { document.body.innerHTML = body; const nextButton: HTMLButtonElement = document.querySelector( - "pagination-buttons #btn-next", + "pagination-buttons #btn-next" ); nextButton.click(); const mainApp = document.querySelector("main-app"); @@ -959,7 +959,7 @@ describe("MainApp", () => { it("current page changes on click, next then back", () => { document.body.innerHTML = body; const nextButton: HTMLButtonElement = document.querySelector( - "pagination-buttons #btn-next", + "pagination-buttons #btn-next" ); nextButton.click(); const mainApp = document.querySelector("main-app"); @@ -968,7 +968,7 @@ describe("MainApp", () => { expect(paginationButtons.getAttribute("current-page")).toBe("2"); const backButton: HTMLButtonElement = document.querySelector( - "pagination-buttons #btn-prev", + "pagination-buttons #btn-prev" ); backButton.click(); expect(mainApp.getAttribute("current-page")).toBe("1"); @@ -978,7 +978,7 @@ describe("MainApp", () => { it("current page changes when a different filter is changed", () => { document.body.innerHTML = body; const nextButton: HTMLButtonElement = document.querySelector( - "pagination-buttons #btn-next", + "pagination-buttons #btn-next" ); nextButton.click(); const mainApp = document.querySelector("main-app"); diff --git a/test/search-status.test.ts b/test/search-status.test.ts index b8a2ba0e..8bd4d94c 100644 --- a/test/search-status.test.ts +++ b/test/search-status.test.ts @@ -7,7 +7,7 @@ describe("search-status", () => { document.body.innerHTML = ``; const searchStatus = document.querySelector("search-status"); expect(searchStatus.innerHTML).toMatchInlineSnapshot( - `"
    Found 1200 fonts
    "`, + `"
    Found 1200 fonts
    "` ); }); diff --git a/test/tag-button.test.ts b/test/tag-button.test.ts index 4a6308e1..fb49e75e 100644 --- a/test/tag-button.test.ts +++ b/test/tag-button.test.ts @@ -31,7 +31,7 @@ describe("tag-button", () => { const tag = "cute"; document.body.innerHTML = ``; const tagButton: HTMLButtonElement = document.querySelector( - "button[is=tag-button]", + "button[is=tag-button]" ); const mockFunction = jest.fn(); tagButton.addEventListener("tag-button-selected", mockFunction); @@ -62,7 +62,7 @@ describe("tag-button", () => { document.body.innerHTML = ``; const tagButton: HTMLButtonElement = document.querySelector( - "button[is=tag-button]", + "button[is=tag-button]" ); expect(tagButton).toMatchInlineSnapshot(`