mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 23:29:02 +02:00
test(e2e): i18n test broken due to button
This commit is contained in:
parent
0754011909
commit
ce19d84247
@ -4,6 +4,7 @@ import { useRef, useMemo } from "preact/hooks";
|
|||||||
import { memo } from "preact/compat";
|
import { memo } from "preact/compat";
|
||||||
|
|
||||||
interface ButtonProps {
|
interface ButtonProps {
|
||||||
|
name?: string;
|
||||||
/** Reference to the button element. Mostly useful for requesting focus. */
|
/** Reference to the button element. Mostly useful for requesting focus. */
|
||||||
buttonRef?: RefObject<HTMLButtonElement>;
|
buttonRef?: RefObject<HTMLButtonElement>;
|
||||||
text: string;
|
text: string;
|
||||||
@ -18,7 +19,7 @@ interface ButtonProps {
|
|||||||
style?: CSSProperties;
|
style?: CSSProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Button = memo(({ buttonRef: _buttonRef, className, text, onClick, keyboardShortcut, icon, primary, disabled, size, style }: ButtonProps) => {
|
const Button = memo(({ name, buttonRef: _buttonRef, className, text, onClick, keyboardShortcut, icon, primary, disabled, size, style }: ButtonProps) => {
|
||||||
// Memoize classes array to prevent recreation
|
// Memoize classes array to prevent recreation
|
||||||
const classes = useMemo(() => {
|
const classes = useMemo(() => {
|
||||||
const classList: string[] = ["btn"];
|
const classList: string[] = ["btn"];
|
||||||
@ -54,6 +55,7 @@ const Button = memo(({ buttonRef: _buttonRef, className, text, onClick, keyboard
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
|
name={name}
|
||||||
className={classes}
|
className={classes}
|
||||||
type={onClick ? "button" : "submit"}
|
type={onClick ? "button" : "submit"}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
|
@ -107,6 +107,7 @@ function DateSettings() {
|
|||||||
|
|
||||||
<OptionsRow name="restart" centered>
|
<OptionsRow name="restart" centered>
|
||||||
<Button
|
<Button
|
||||||
|
name="restart-app-button"
|
||||||
text={t("electron_integration.restart-app-button")}
|
text={t("electron_integration.restart-app-button")}
|
||||||
size="micro"
|
size="micro"
|
||||||
onClick={restartDesktopApp}
|
onClick={restartDesktopApp}
|
||||||
|
@ -47,7 +47,7 @@ test("User can change language from settings", async ({ page, context }) => {
|
|||||||
|
|
||||||
// Select Chinese and ensure the translation is set.
|
// Select Chinese and ensure the translation is set.
|
||||||
await languageCombobox.selectOption("cn");
|
await languageCombobox.selectOption("cn");
|
||||||
await app.currentNoteSplit.locator("button.restart-app-button").click();
|
await app.currentNoteSplit.locator("button[name=restart-app-button]").click();
|
||||||
|
|
||||||
await expect(app.currentNoteSplit).toContainText("一周的第一天", { timeout: 15000 });
|
await expect(app.currentNoteSplit).toContainText("一周的第一天", { timeout: 15000 });
|
||||||
await expect(languageCombobox).toHaveValue("cn");
|
await expect(languageCombobox).toHaveValue("cn");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user