Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Rename the search bar placeholder
Rūdolfs Ošiņš committed 3 years ago
commit d80c46e085f0ace6f5921c422b60a17c9a2a3bc0
parent 05ba3bfc043d21dde5012e7cb40fa8762ee5212e
5 files changed +12 -6
modified src/App/Header/Search.svelte
@@ -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>
modified src/App/Hotkeys.svelte
@@ -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;
added src/lib/shared.ts
@@ -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…";
modified tests/e2e/hotkeys.spec.ts
@@ -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(`/`);
modified tests/e2e/search.spec.ts
@@ -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";