Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listjs - correctly patch list.min.js to support special character #10725

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package/src/common/update-html-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ export async function updateHtmlDependencies(config: Configuration) {
// Omit regular expression escaping
// (Fixes https://github.com/quarto-dev/quarto-cli/issues/8435)
const contents = Deno.readTextFileSync(listJs);
const removeContent = /e=\(e=t\.utils\.toString\(e\)\.toLowerCase\(\)\)\.replace\(.*?\),/g
const cleaned = contents.replaceAll(removeContent, "");
const removeContent = /(\(e=t\.utils\.toString\(e\)\.toLowerCase\(\)\))\.replace\(.*\)(,r=e)/g;
const cleaned = contents.replace(removeContent, "$1$2");
Deno.writeTextFileSync(listJs, cleaned);

return Promise.resolve();
Expand Down
2 changes: 1 addition & 1 deletion src/resources/projects/website/listing/list.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tests/docs/playwright/blog/listing-search/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.quarto/
/_site/
7 changes: 7 additions & 0 deletions tests/docs/playwright/blog/listing-search/_quarto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
project:
type: website

website:
title: "Testing listing search"

format: html
13 changes: 13 additions & 0 deletions tests/docs/playwright/blog/listing-search/index.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: "Testing listing search"
listing:
contents: posts
sort: "date desc"
type: table
categories: true
filter-ui: true
page-layout: full
title-block-banner: true
---


4 changes: 4 additions & 0 deletions tests/docs/playwright/blog/listing-search/posts/_metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# options specified here will apply to all posts in this folder

# Enable banner style title blocks
title-block-banner: true
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: "Post With Code"
author: "Harlow Malloc"
date: "2024-09-06"
categories: [news, code, analysis]
image: "image.jpg"
---

This is a post with executable code.
12 changes: 12 additions & 0 deletions tests/docs/playwright/blog/listing-search/posts/welcome/index.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: "Welcome To My Blog"
author: "Tristan O'Malley"
date: "2024-09-03"
categories: [news]
---

This is the first post in a Quarto blog. Welcome!

![](thumbnail.jpg)

Since this post doesn't specify an explicit `image`, the first image in the post will be used in the listing page of posts.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions tests/integration/playwright/tests/blog-listing-search.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { expect, test } from "@playwright/test";

import { getUrl } from "../src/utils.js";

test('List.js is correctly patch to allow searching with lowercase and uppercase',
async ({ page }) => {
await page.goto(getUrl('blog/listing-search/_site/'));
await page.getByPlaceholder('Filter').click();
await page.getByPlaceholder('Filter').fill('Code');
await page.getByPlaceholder('Filter').press('Enter');
await expect(page.getByRole('link', { name: 'Post With Code' })).toBeVisible();
await expect(page.getByRole('link', { name: 'Welcome To My Blog' })).toBeHidden();
await page.getByPlaceholder('Filter').click();
await page.getByPlaceholder('Filter').fill('');
await page.getByPlaceholder('Filter').press('Enter');
await expect(page.getByRole('link', { name: 'Post With Code' })).toBeVisible();
await expect(page.getByRole('link', { name: 'Welcome To My Blog' })).toBeVisible();
await page.getByPlaceholder('Filter').click();
await page.getByPlaceholder('Filter').fill('CODE');
await page.getByPlaceholder('Filter').press('Enter');
await expect(page.getByRole('link', { name: 'Post With Code' })).toBeVisible();
await expect(page.getByRole('link', { name: 'Welcome To My Blog' })).toBeHidden();
});
34 changes: 21 additions & 13 deletions tests/integration/playwright/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,27 @@


"@playwright/test@^1.28.1":
version "1.28.1"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.28.1.tgz#e5be297e024a3256610cac2baaa9347fd57c7860"
integrity sha512-xN6spdqrNlwSn9KabIhqfZR7IWjPpFK1835tFNgjrlysaSezuX8PYUwaz38V/yI8TJLG9PkAMEXoHRXYXlpTPQ==
version "1.47.0"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.47.0.tgz#69fc55b10754147cc20021afbfa05747d4961bf0"
integrity sha512-SgAdlSwYVpToI4e/IH19IHHWvoijAYH5hu2MWSXptRypLSnzj51PcGD+rsOXFayde4P9ZLi+loXVwArg6IUkCA==
dependencies:
"@types/node" "*"
playwright-core "1.28.1"
playwright "1.47.0"

"@types/node@*":
version "18.11.9"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.9.tgz#02d013de7058cea16d36168ef2fc653464cfbad4"
integrity sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==
fsevents@2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==

playwright-core@1.28.1:
version "1.28.1"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.28.1.tgz#8400be9f4a8d1c0489abdb9e75a4cc0ffc3c00cb"
integrity sha512-3PixLnGPno0E8rSBJjtwqTwJe3Yw72QwBBBxNoukIj3lEeBNXwbNiKrNuB1oyQgTBw5QHUhNO3SteEtHaMK6ag==
playwright-core@1.47.0:
version "1.47.0"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.47.0.tgz#b54ec060fd83e5c2e46b63986b5ebb5e96ace427"
integrity sha512-1DyHT8OqkcfCkYUD9zzUTfg7EfTd+6a8MkD/NWOvjo0u/SCNd5YmY/lJwFvUZOxJbWNds+ei7ic2+R/cRz/PDg==

playwright@1.47.0:
version "1.47.0"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.47.0.tgz#fb9b028883fad11362f9ff63ce7ba44bda0bf626"
integrity sha512-jOWiRq2pdNAX/mwLiwFYnPHpEZ4rM+fRSQpRHwEwZlP2PUANvL3+aJOF/bvISMhFD30rqMxUB4RJx9aQbfh4Ww==
dependencies:
playwright-core "1.47.0"
optionalDependencies:
fsevents "2.3.2"
Loading