Rename the search bar placeholder

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
Rūdolfs Ošiņš
2023-04-20 08:36:16 +02:00
parent 05ba3bfc04
commit d80c46e085
5 changed files with 12 additions and 6 deletions
+2 -1
View File
@@ -5,6 +5,7 @@
import * as Search from "@app/lib/search";
import * as modal from "@app/lib/modal";
import * as router from "@app/lib/router";
import { searchPlaceholder } from "@app/lib/shared";
import { unreachable } from "@app/lib/utils";
import Icon from "@app/components/Icon.svelte";
@@ -131,7 +132,7 @@
}
}}
on:submit={search}
placeholder="Search a RID…">
placeholder={searchPlaceholder}>
<svelte:fragment slot="left">
<Icon name="magnifying-glass" />
</svelte:fragment>
+2 -1
View File
@@ -3,6 +3,7 @@
import ColorPaletteModal from "@app/App/ColorPaletteModal.svelte";
import HotkeysModal from "@app/App/HotkeysModal.svelte";
import { searchPlaceholder } from "@app/lib/shared";
const onKeydown = (event: KeyboardEvent) => {
if (event.key === "Escape") {
@@ -17,7 +18,7 @@
case "/": {
event.preventDefault();
const searchInput: HTMLElement | null = document.querySelector(
'*[placeholder="Search a RID…"]',
`*[placeholder="${searchPlaceholder}"]`,
);
searchInput?.focus();
break;
+4
View File
@@ -0,0 +1,4 @@
// This file is shared between tests and the UI code. It should only contain
// basic JS primitives, so that it works in both browser and node environments.
export const searchPlaceholder = "Enter an RID…";
+1 -2
View File
@@ -1,7 +1,6 @@
import { searchPlaceholder } from "@app/lib/shared";
import { test, expect } from "@tests/support/fixtures.js";
const searchPlaceholder = "Search a RID…";
test("global hotkeys", async ({ page }) => {
await page.goto("/");
await page.locator("body").press(`/`);
+3 -2
View File
@@ -1,3 +1,4 @@
import { searchPlaceholder } from "@app/lib/shared";
import {
test,
expect,
@@ -7,7 +8,7 @@ import {
test("navigate to existing project", async ({ page }) => {
await page.goto("/");
const searchInput = page.getByPlaceholder("Search a RID…");
const searchInput = page.getByPlaceholder(searchPlaceholder);
await searchInput.click();
await searchInput.fill(`${rid}`);
await searchInput.press("Enter");
@@ -18,7 +19,7 @@ test("navigate to existing project", async ({ page }) => {
test("navigate to a project that does not exist", async ({ page }) => {
await page.goto("/");
const searchInput = page.getByPlaceholder("Search a RID…");
const searchInput = page.getByPlaceholder(searchPlaceholder);
await searchInput.click();
const nonExistantId = "rad:zAAAAAAAAAAAAAAAAAAAAAAAAAAA";