Skip to content

Commit

Permalink
Revert Prettier
Browse files Browse the repository at this point in the history
Update main-app.test.ts.snap
  • Loading branch information
katydecorah committed Jul 21, 2023
1 parent 72ada93 commit d95f300
Show file tree
Hide file tree
Showing 24 changed files with 150 additions and 140 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
_site
package-lock.json
coverage
2 changes: 1 addition & 1 deletion components/clear-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ClearButton extends HTMLButtonElement {
this.dispatchEvent(
customEvent("clear-filter", {
value: this.value,
}),
})
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/custom-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export default function customEvent(
detail?: {
value?: string | boolean | number;
id?: string;
},
}
): CustomEvent {
return new CustomEvent(eventName, {
bubbles: true,
Expand Down
4 changes: 2 additions & 2 deletions components/filter-checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class FilterCheckbox extends HTMLInputElement {
customEvent("handle-filter", {
value: this.checked,
id: this.id,
}),
})
);
this.setUrlParam();
}
Expand All @@ -34,7 +34,7 @@ class FilterCheckbox extends HTMLInputElement {
window.history.replaceState(
{},
"",
`${window.location.pathname}?${urlParameters.toString()}`,
`${window.location.pathname}?${urlParameters.toString()}`
);
}

Expand Down
6 changes: 3 additions & 3 deletions components/filter-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class FilterSelect extends HTMLSelectElement {
{
value,
id,
},
),
}
)
);

this.setUrlParam();
Expand All @@ -48,7 +48,7 @@ class FilterSelect extends HTMLSelectElement {
window.history.replaceState(
{},
"",
`${window.location.pathname}?${urlParameters.toString()}`,
`${window.location.pathname}?${urlParameters.toString()}`
);
}

Expand Down
14 changes: 7 additions & 7 deletions components/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function filter(
currentPage: number;
pageSize: number;
},
generatedData: GeneratedData,
generatedData: GeneratedData
): [number, GeneratedData] {
const {
selectedSearch,
Expand All @@ -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())
);
}

Expand All @@ -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)
);
}

Expand All @@ -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)
);
}

Expand Down
12 changes: 6 additions & 6 deletions components/font-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class FontItem extends HTMLLIElement {
const tagButtons = tags
.map(
(tag: string) =>
`<button is="tag-button" title="${tag}" value="${tag}">${tag}</button>`,
`<button is="tag-button" title="${tag}" value="${tag}">${tag}</button>`
)
.join("");

Expand All @@ -89,11 +89,11 @@ class FontItem extends HTMLLIElement {
<ul>
<li>${category}</li>
<li><span aria-label="${variants.join(", ")}">${
variants.length
} variants${variable ? " (variable)" : ""}</span></li>
variants.length
} variants${variable ? " (variable)" : ""}</span></li>
<li><span aria-label="${subsets.join(", ")}">${
subsets.length
} subsets</span></li>
subsets.length
} subsets</span></li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -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();
}
Expand Down
6 changes: 3 additions & 3 deletions components/main-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class MainApp extends HTMLElement {
window.dispatchEvent(
customEvent("remove-select", {
value,
}),
})
);
}

Expand All @@ -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();
}
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion components/pagination-buttons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class PaginationButtons extends HTMLElement {
window.history.replaceState(
{},
"",
`${window.location.pathname}?${urlParameters.toString()}`,
`${window.location.pathname}?${urlParameters.toString()}`
);
}

Expand Down
2 changes: 1 addition & 1 deletion components/search-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class SearchStatus extends HTMLElement {
this.selectedFilters
.map((filter) => this.renderFilter(filter))
.join(""),
`<button is="clear-button" aria-label="remove all filters" class="btn btn-clear">Clear</button>`,
`<button is="clear-button" aria-label="remove all filters" class="btn btn-clear">Clear</button>`
);
}

Expand Down
2 changes: 1 addition & 1 deletion components/set-attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions components/tag-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class TagButton extends HTMLButtonElement {
customEvent("tag-button-selected", {
id: "selectedTag",
value: this.value,
}),
})
);

this.setUrlParam();
Expand All @@ -45,7 +45,7 @@ class TagButton extends HTMLButtonElement {
window.history.replaceState(
{},
"",
`${window.location.pathname}?${urlParameters.toString()}`,
`${window.location.pathname}?${urlParameters.toString()}`
);
}

Expand Down
6 changes: 3 additions & 3 deletions data/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -9700,7 +9700,7 @@
"tags": ["outline", "icons"],
"lineNumber": 777,
"variable": false,
"lastModified": "2023-07-13"
"lastModified": "2023-07-20"
},
{
"family": "Material Symbols Rounded",
Expand All @@ -9710,7 +9710,7 @@
"tags": ["round", "icons"],
"lineNumber": 778,
"variable": false,
"lastModified": "2023-07-13"
"lastModified": "2023-07-20"
},
{
"family": "Material Symbols Sharp",
Expand All @@ -9720,7 +9720,7 @@
"tags": ["icons"],
"lineNumber": 779,
"variable": false,
"lastModified": "2023-07-13"
"lastModified": "2023-07-20"
},
{
"family": "Maven Pro",
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
26 changes: 19 additions & 7 deletions test/__snapshots__/main-app.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`MainApp renders correctly 1`] = `
<main-app
current-page="1"
results-length="1550"
results-length="1558"
>
Expand Down Expand Up @@ -2413,7 +2413,7 @@ exports[`MainApp renders correctly 1`] = `
<button
is="tag-button"
style="font-family: "Bruno Ace";"
style="font-family: "Agdasima";"
title="techno"
value="techno"
>
Expand Down Expand Up @@ -4109,6 +4109,12 @@ exports[`MainApp renders correctly 1`] = `
>
cypriot
</option>
<option
id="cypro-minoan"
value="cypro-minoan"
>
cypro-minoan
</option>
<option
id="cyrillic"
value="cyrillic"
Expand Down Expand Up @@ -4313,6 +4319,12 @@ exports[`MainApp renders correctly 1`] = `
>
kharoshthi
</option>
<option
id="khitan-small-script"
value="khitan-small-script"
>
khitan-small-script
</option>
<option
id="khmer"
value="khmer"
Expand Down Expand Up @@ -5108,16 +5120,16 @@ exports[`MainApp renders correctly 1`] = `
<search-status
results-length="1550"
results-length="1558"
>
<div>
Found 1550 fonts
Found 1558 fonts
</div>
</search-status>
<sort-by
results-length="1550"
results-length="1558"
sort-by="family"
>
<div
Expand Down Expand Up @@ -6432,7 +6444,7 @@ exports[`MainApp renders correctly 1`] = `
<pagination-buttons
current-page="1"
results-length="1550"
results-length="1558"
>
<button
class="btn"
Expand All @@ -6448,7 +6460,7 @@ exports[`MainApp renders correctly 1`] = `
class="page-count"
id="page-count"
>
1 of 155
1 of 156
</div>
Expand Down
2 changes: 1 addition & 1 deletion test/clear-button.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import "./components";
describe("clear-button", () => {
document.body.innerHTML = `<button is="clear-button" aria-label="remove all filters" class="btn btn-clear">Clear</button>`;
const clearButton: HTMLButtonElement = document.querySelector(
"button[is=clear-button]",
"button[is=clear-button]"
);
it("renders", () => {
expect(clearButton).toMatchInlineSnapshot(`
Expand Down
Loading

0 comments on commit d95f300

Please sign in to comment.