mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +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";
|
||||
|
||||
interface ButtonProps {
|
||||
name?: string;
|
||||
/** Reference to the button element. Mostly useful for requesting focus. */
|
||||
buttonRef?: RefObject<HTMLButtonElement>;
|
||||
text: string;
|
||||
@ -18,7 +19,7 @@ interface ButtonProps {
|
||||
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
|
||||
const classes = useMemo(() => {
|
||||
const classList: string[] = ["btn"];
|
||||
@ -54,6 +55,7 @@ const Button = memo(({ buttonRef: _buttonRef, className, text, onClick, keyboard
|
||||
|
||||
return (
|
||||
<button
|
||||
name={name}
|
||||
className={classes}
|
||||
type={onClick ? "button" : "submit"}
|
||||
onClick={onClick}
|
||||
|
@ -107,6 +107,7 @@ function DateSettings() {
|
||||
|
||||
<OptionsRow name="restart" centered>
|
||||
<Button
|
||||
name="restart-app-button"
|
||||
text={t("electron_integration.restart-app-button")}
|
||||
size="micro"
|
||||
onClick={restartDesktopApp}
|
||||
|
@ -47,7 +47,7 @@ test("User can change language from settings", async ({ page, context }) => {
|
||||
|
||||
// Select Chinese and ensure the translation is set.
|
||||
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(languageCombobox).toHaveValue("cn");
|
||||
|
Loading…
x
Reference in New Issue
Block a user