Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): branch naming text saves when you leave the screen #18381

Mergedadityavardhansharma(GitHub profile, opens in a new tab)merged 7 commits intomain fromrefs/pull/18381/headmerged by juliusmarminge View on GitHub

Showing 4 changed files with 167 additions and 0 deletions (loading 3).

x
0 of 4 viewed, 4 left
167 additions and 0 deletionsapps/mobile/src/features/settings/components/BranchNamingSettings.test.tsxAdded
View file
@@ -0,0 +1,167 @@
+// @vitest-environment jsdom
+import type { BranchNamingMode } from "@t3tools/contracts";
+import type { ReactNode } from "react";
+import { act } from "react";
+import { createRoot, type Root } from "react-dom/client";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test";
+​
+type InputProps = {
+ accessibilityLabel: string;
+ defaultValue: string;
+ onChangeText: (text: string) => void;
+ onEndEditing: (event: { nativeEvent: { text: string } }) => void;
+};
+​
+const inputs = vi.hoisted(() => new Map<string, InputProps>());
+​
+vi.mock("react-native", () => ({
+ View: ({ children }: { children: ReactNode }) => <div>{children}</div>,
+}));
+vi.mock("../../../components/AppText", () => ({
+ AppText: ({ children }: { children: ReactNode }) => <span>{children}</span>,
+ AppTextInput: (props: InputProps) => {
+ inputs.set(props.accessibilityLabel, props);
+ return null;
+ },
+}));
+vi.mock("./SettingsChoiceRow", () => ({ SettingsChoiceRow: () => null }));
+vi.mock("./SettingsSection", () => ({
+ SettingsSection: ({ children }: { children: ReactNode }) => <div>{children}</div>,
+}));