@terreno/ui 57.1.0 → 57.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ai/guidelines/core.md +1 -1
- package/README.md +17 -8
- package/dist/ActionSheet.d.ts +3 -3
- package/dist/ActionSheet.js +2 -2
- package/dist/ActionSheet.js.map +1 -1
- package/dist/Box.d.ts +1 -1
- package/dist/Box.js +219 -177
- package/dist/Box.js.map +1 -1
- package/dist/Button.js +101 -34
- package/dist/Button.js.map +1 -1
- package/dist/Common.d.ts +119 -9
- package/dist/Common.js.map +1 -1
- package/dist/ConsentFormScreen.js +46 -12
- package/dist/ConsentFormScreen.js.map +1 -1
- package/dist/ConsentNavigator.d.ts +5 -1
- package/dist/ConsentNavigator.js.map +1 -1
- package/dist/DataTable.d.ts +2 -2
- package/dist/DataTable.js +203 -44
- package/dist/DataTable.js.map +1 -1
- package/dist/DataTableHeaderInfoMarkdown.d.ts +6 -0
- package/dist/DataTableHeaderInfoMarkdown.js +7 -0
- package/dist/DataTableHeaderInfoMarkdown.js.map +1 -0
- package/dist/EmojiSelector.d.ts +2 -46
- package/dist/EmojiSelector.js +46 -56
- package/dist/EmojiSelector.js.map +1 -1
- package/dist/GPTChat.js +1 -1
- package/dist/GPTChat.js.map +1 -1
- package/dist/Heading.d.ts +5 -2
- package/dist/Heading.js +6 -8
- package/dist/Heading.js.map +1 -1
- package/dist/Hyperlink.js.map +1 -1
- package/dist/Icon.d.ts +1 -2
- package/dist/Icon.js +4 -1
- package/dist/Icon.js.map +1 -1
- package/dist/MarkdownView.d.ts +6 -3
- package/dist/MarkdownView.js +45 -43
- package/dist/MarkdownView.js.map +1 -1
- package/dist/MediaQuery.d.ts +5 -3
- package/dist/MediaQuery.js +9 -40
- package/dist/MediaQuery.js.map +1 -1
- package/dist/OpenAPIContext.js +7 -6
- package/dist/OpenAPIContext.js.map +1 -1
- package/dist/Page.js +7 -1
- package/dist/Page.js.map +1 -1
- package/dist/PickerSelect.js +8 -1
- package/dist/PickerSelect.js.map +1 -1
- package/dist/Popover.d.ts +12 -0
- package/dist/Popover.js +37 -0
- package/dist/Popover.js.map +1 -0
- package/dist/PortalHost.js +10 -1
- package/dist/PortalHost.js.map +1 -1
- package/dist/ResponsiveBreakpoint.d.ts +65 -0
- package/dist/ResponsiveBreakpoint.js +111 -0
- package/dist/ResponsiveBreakpoint.js.map +1 -0
- package/dist/SplitPage.d.ts +2 -2
- package/dist/SplitPage.js +7 -12
- package/dist/SplitPage.js.map +1 -1
- package/dist/SplitPage.native.d.ts +2 -2
- package/dist/SplitPage.native.js +1 -6
- package/dist/SplitPage.native.js.map +1 -1
- package/dist/TapToEdit.js +12 -10
- package/dist/TapToEdit.js.map +1 -1
- package/dist/TerrenoFontProvider.d.ts +7 -0
- package/dist/TerrenoFontProvider.js +27 -0
- package/dist/TerrenoFontProvider.js.map +1 -0
- package/dist/TerrenoProvider.js +4 -2
- package/dist/TerrenoProvider.js.map +1 -1
- package/dist/Text.d.ts +5 -2
- package/dist/Text.js +6 -11
- package/dist/Text.js.map +1 -1
- package/dist/TextFieldNumberActionSheet.js +9 -2
- package/dist/TextFieldNumberActionSheet.js.map +1 -1
- package/dist/Theme.js +10 -8
- package/dist/Theme.js.map +1 -1
- package/dist/ToastNotifications.d.ts +4 -2
- package/dist/ToastNotifications.js.map +1 -1
- package/dist/Tooltip.d.ts +4 -3
- package/dist/Tooltip.js +14 -3
- package/dist/Tooltip.js.map +1 -1
- package/dist/Unifier.d.ts +26 -1
- package/dist/Unifier.js.map +1 -1
- package/dist/WebAddressAutocomplete.js +6 -1
- package/dist/WebAddressAutocomplete.js.map +1 -1
- package/dist/emojiCategories.d.ts +46 -0
- package/dist/emojiCategories.js +47 -0
- package/dist/emojiCategories.js.map +1 -0
- package/dist/index.d.ts +13 -13
- package/dist/index.js +2 -13
- package/dist/index.js.map +1 -1
- package/dist/lazyBoundaries/createLazyComponentExport.d.ts +6 -0
- package/dist/lazyBoundaries/createLazyComponentExport.js +35 -0
- package/dist/lazyBoundaries/createLazyComponentExport.js.map +1 -0
- package/dist/lazyBoundaries/heavyOptionalExports.d.ts +41 -0
- package/dist/lazyBoundaries/heavyOptionalExports.js +43 -0
- package/dist/lazyBoundaries/heavyOptionalExports.js.map +1 -0
- package/dist/login/LoginScreen.d.ts +1 -0
- package/dist/login/LoginScreen.js +4 -2
- package/dist/login/LoginScreen.js.map +1 -1
- package/dist/login/loginTypes.d.ts +2 -0
- package/package.json +41 -2
- package/src/AIRequestExplorer.test.tsx +141 -0
- package/src/ActionSheet.tsx +9 -7
- package/src/AttachmentPreview.test.tsx +80 -0
- package/src/Box.test.tsx +97 -10
- package/src/Box.tsx +263 -200
- package/src/Button.test.tsx +207 -0
- package/src/Button.tsx +146 -48
- package/src/Common.ts +124 -25
- package/src/ConsentFormScreen.markdownGate.test.tsx +129 -0
- package/src/ConsentFormScreen.test.tsx +145 -8
- package/src/ConsentFormScreen.tsx +74 -25
- package/src/ConsentNavigator.tsx +13 -5
- package/src/DataTable.tsx +418 -147
- package/src/DataTableHeaderInfoMarkdown.test.tsx +21 -0
- package/src/DataTableHeaderInfoMarkdown.tsx +17 -0
- package/src/DataTableVirtualizationRegression.test.tsx +266 -0
- package/src/DateTimeField.test.tsx +54 -0
- package/src/EmojiSelector.test.tsx +33 -42
- package/src/EmojiSelector.tsx +60 -57
- package/src/FilePickerButton.test.tsx +167 -0
- package/src/FilterAccordion.test.tsx +37 -0
- package/src/FilterBoolean.test.tsx +96 -0
- package/src/FilterSelectMenu.test.tsx +23 -0
- package/src/GPTChat.test.tsx +696 -0
- package/src/GPTChat.tsx +2 -2
- package/src/GPTMemoryModal.test.tsx +67 -0
- package/src/Heading.tsx +8 -14
- package/src/HeightActionSheet.test.tsx +6 -9
- package/src/Hyperlink.tsx +5 -18
- package/src/Icon.tsx +6 -2
- package/src/MarkdownEditor.test.tsx +134 -0
- package/src/MarkdownEditorField.test.tsx +124 -0
- package/src/MarkdownView.test.tsx +55 -11
- package/src/MarkdownView.tsx +149 -150
- package/src/MediaQuery.ts +30 -34
- package/src/OpenAPIContext.tsx +36 -29
- package/src/OpenAPIRenderRegression.test.tsx +200 -0
- package/src/P0RenderRegression.test.tsx +214 -0
- package/src/P1RenderRegression.test.tsx +141 -0
- package/src/P2ButtonRenderRegression.test.tsx +158 -0
- package/src/Page.test.tsx +13 -0
- package/src/Page.tsx +25 -5
- package/src/PickerSelect.test.tsx +38 -0
- package/src/PickerSelect.tsx +7 -0
- package/src/Popover.test.tsx +151 -0
- package/src/Popover.tsx +211 -0
- package/src/PortalHost.tsx +12 -6
- package/src/ResponsiveBreakpoint.test.tsx +184 -0
- package/src/ResponsiveBreakpoint.tsx +195 -0
- package/src/RootImportRegression.test.tsx +62 -0
- package/src/SplitPage.native.tsx +5 -9
- package/src/SplitPage.tsx +16 -19
- package/src/TapToEdit.test.tsx +45 -0
- package/src/TapToEdit.tsx +23 -18
- package/src/TerrenoFontProvider.test.tsx +38 -0
- package/src/TerrenoFontProvider.tsx +50 -0
- package/src/TerrenoProvider.tsx +6 -1
- package/src/Text.tsx +8 -21
- package/src/TextFieldNumberActionSheet.test.tsx +100 -0
- package/src/TextFieldNumberActionSheet.tsx +11 -2
- package/src/Theme.test.tsx +27 -0
- package/src/Theme.tsx +15 -10
- package/src/Toast.tsx +1 -1
- package/src/ToastNotifications.tsx +4 -4
- package/src/Tooltip.test.tsx +64 -0
- package/src/Tooltip.tsx +18 -4
- package/src/Unifier.ts +26 -3
- package/src/WebAddressAutocomplete.tsx +6 -2
- package/src/__snapshots__/ActionSheet.test.tsx.snap +0 -36
- package/src/__snapshots__/AddressField.test.tsx.snap +1 -0
- package/src/__snapshots__/AttachmentPreview.test.tsx.snap +225 -0
- package/src/__snapshots__/CustomSelectField.test.tsx.snap +7 -0
- package/src/__snapshots__/DataTable.test.tsx.snap +793 -250
- package/src/__snapshots__/DecimalRangeActionSheet.test.tsx.snap +0 -8
- package/src/__snapshots__/EmojiSelector.test.tsx.snap +35555 -30
- package/src/__snapshots__/Field.test.tsx.snap +7 -0
- package/src/__snapshots__/FilterSelectMenu.test.tsx.snap +1 -0
- package/src/__snapshots__/HeightActionSheet.test.tsx.snap +0 -8
- package/src/__snapshots__/HeightField.test.tsx.snap +0 -20
- package/src/__snapshots__/NumberPickerActionSheet.test.tsx.snap +0 -8
- package/src/__snapshots__/Page.test.tsx.snap +13 -1
- package/src/__snapshots__/PickerSelect.test.tsx.snap +7 -0
- package/src/__snapshots__/SelectField.test.tsx.snap +6 -0
- package/src/__snapshots__/TimezonePicker.test.tsx.snap +6 -0
- package/src/benchmarks/importGraph.test.ts +71 -0
- package/src/benchmarks/importGraph.ts +136 -0
- package/src/benchmarks/importTiming.test.ts +42 -0
- package/src/benchmarks/importTiming.ts +86 -0
- package/src/bunSetup.ts +174 -32
- package/src/emojiCategories.test.ts +23 -0
- package/src/emojiCategories.ts +46 -0
- package/src/index.tsx +27 -13
- package/src/lazyBoundaries/createLazyComponentExport.test.tsx +104 -0
- package/src/lazyBoundaries/createLazyComponentExport.tsx +63 -0
- package/src/lazyBoundaries/heavyOptionalExports.test.tsx +33 -0
- package/src/lazyBoundaries/heavyOptionalExports.tsx +106 -0
- package/src/login/LoginScreen.test.tsx +9 -2
- package/src/login/LoginScreen.tsx +6 -2
- package/src/login/loginTypes.ts +2 -0
- package/src/table/TableDate.test.tsx +35 -1
- package/src/table/__snapshots__/TableBadge.test.tsx.snap +1 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type {AIRequestExplorer as AIRequestExplorerComponent} from "../AIRequestExplorer";
|
|
2
|
+
import type {AiSuggestionBox as AiSuggestionBoxComponent} from "../AiSuggestionBox";
|
|
3
|
+
import type {AttachmentPreview as AttachmentPreviewComponent} from "../AttachmentPreview";
|
|
4
|
+
import type {ConflictSheet as ConflictSheetComponent} from "../ConflictSheet";
|
|
5
|
+
import type {ConsentFormScreen as ConsentFormScreenComponent} from "../ConsentFormScreen";
|
|
6
|
+
import type {ConsentNavigator as ConsentNavigatorComponent} from "../ConsentNavigator";
|
|
7
|
+
import type {DraggableList as DraggableListComponent} from "../DraggableList";
|
|
8
|
+
import type EmojiSelectorComponent from "../EmojiSelector";
|
|
9
|
+
import {Categories} from "../emojiCategories";
|
|
10
|
+
import type {GPTChat as GPTChatComponent} from "../GPTChat";
|
|
11
|
+
import type {GPTMemoryModal as GPTMemoryModalComponent} from "../GPTMemoryModal";
|
|
12
|
+
import type {MarkdownEditor as MarkdownEditorComponent} from "../MarkdownEditor";
|
|
13
|
+
import type {MarkdownEditorField as MarkdownEditorFieldComponent} from "../MarkdownEditorField";
|
|
14
|
+
import type {UpgradeRequiredScreen as UpgradeRequiredScreenComponent} from "../UpgradeRequiredScreen";
|
|
15
|
+
import {createLazyComponentExport, createLazyNamedExport} from "./createLazyComponentExport";
|
|
16
|
+
|
|
17
|
+
export const heavyOptionalModuleFactories = {
|
|
18
|
+
AIRequestExplorer: () => import("../AIRequestExplorer"),
|
|
19
|
+
AiSuggestionBox: () => import("../AiSuggestionBox"),
|
|
20
|
+
AttachmentPreview: () => import("../AttachmentPreview"),
|
|
21
|
+
ConflictSheet: () => import("../ConflictSheet"),
|
|
22
|
+
ConsentFormScreen: () => import("../ConsentFormScreen"),
|
|
23
|
+
ConsentNavigator: () => import("../ConsentNavigator"),
|
|
24
|
+
DraggableList: () => import("../DraggableList"),
|
|
25
|
+
EmojiSelector: () => import("../EmojiSelector"),
|
|
26
|
+
GPTChat: () => import("../GPTChat"),
|
|
27
|
+
GPTMemoryModal: () => import("../GPTMemoryModal"),
|
|
28
|
+
MarkdownEditor: () => import("../MarkdownEditor"),
|
|
29
|
+
MarkdownEditorField: () => import("../MarkdownEditorField"),
|
|
30
|
+
UpgradeRequiredScreen: () => import("../UpgradeRequiredScreen"),
|
|
31
|
+
} as const;
|
|
32
|
+
|
|
33
|
+
const EMOJI_SELECTOR_DEFAULT_PROPS = {
|
|
34
|
+
category: Categories.all,
|
|
35
|
+
columns: 6,
|
|
36
|
+
placeholder: "Search...",
|
|
37
|
+
showHistory: false,
|
|
38
|
+
showSearchBar: true,
|
|
39
|
+
showSectionTitles: true,
|
|
40
|
+
showTabs: true,
|
|
41
|
+
theme: "#007AFF",
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const AIRequestExplorer = createLazyNamedExport(
|
|
45
|
+
heavyOptionalModuleFactories.AIRequestExplorer,
|
|
46
|
+
"AIRequestExplorer"
|
|
47
|
+
) as unknown as typeof AIRequestExplorerComponent;
|
|
48
|
+
|
|
49
|
+
export const AiSuggestionBox = createLazyNamedExport(
|
|
50
|
+
heavyOptionalModuleFactories.AiSuggestionBox,
|
|
51
|
+
"AiSuggestionBox"
|
|
52
|
+
) as unknown as typeof AiSuggestionBoxComponent;
|
|
53
|
+
|
|
54
|
+
export const AttachmentPreview = createLazyNamedExport(
|
|
55
|
+
heavyOptionalModuleFactories.AttachmentPreview,
|
|
56
|
+
"AttachmentPreview"
|
|
57
|
+
) as unknown as typeof AttachmentPreviewComponent;
|
|
58
|
+
|
|
59
|
+
export const ConflictSheet = createLazyNamedExport(
|
|
60
|
+
heavyOptionalModuleFactories.ConflictSheet,
|
|
61
|
+
"ConflictSheet"
|
|
62
|
+
) as unknown as typeof ConflictSheetComponent;
|
|
63
|
+
|
|
64
|
+
export const ConsentFormScreen = createLazyNamedExport(
|
|
65
|
+
heavyOptionalModuleFactories.ConsentFormScreen,
|
|
66
|
+
"ConsentFormScreen"
|
|
67
|
+
) as unknown as typeof ConsentFormScreenComponent;
|
|
68
|
+
|
|
69
|
+
export const ConsentNavigator = createLazyNamedExport(
|
|
70
|
+
heavyOptionalModuleFactories.ConsentNavigator,
|
|
71
|
+
"ConsentNavigator"
|
|
72
|
+
) as unknown as typeof ConsentNavigatorComponent;
|
|
73
|
+
|
|
74
|
+
export const DraggableList = createLazyNamedExport(
|
|
75
|
+
heavyOptionalModuleFactories.DraggableList,
|
|
76
|
+
"DraggableList"
|
|
77
|
+
) as unknown as typeof DraggableListComponent;
|
|
78
|
+
|
|
79
|
+
export const EmojiSelector = createLazyComponentExport(heavyOptionalModuleFactories.EmojiSelector, {
|
|
80
|
+
defaultProps: EMOJI_SELECTOR_DEFAULT_PROPS,
|
|
81
|
+
}) as unknown as typeof EmojiSelectorComponent;
|
|
82
|
+
|
|
83
|
+
export const GPTChat = createLazyNamedExport(
|
|
84
|
+
heavyOptionalModuleFactories.GPTChat,
|
|
85
|
+
"GPTChat"
|
|
86
|
+
) as unknown as typeof GPTChatComponent;
|
|
87
|
+
|
|
88
|
+
export const GPTMemoryModal = createLazyNamedExport(
|
|
89
|
+
heavyOptionalModuleFactories.GPTMemoryModal,
|
|
90
|
+
"GPTMemoryModal"
|
|
91
|
+
) as unknown as typeof GPTMemoryModalComponent;
|
|
92
|
+
|
|
93
|
+
export const MarkdownEditor = createLazyNamedExport(
|
|
94
|
+
heavyOptionalModuleFactories.MarkdownEditor,
|
|
95
|
+
"MarkdownEditor"
|
|
96
|
+
) as unknown as typeof MarkdownEditorComponent;
|
|
97
|
+
|
|
98
|
+
export const MarkdownEditorField = createLazyNamedExport(
|
|
99
|
+
heavyOptionalModuleFactories.MarkdownEditorField,
|
|
100
|
+
"MarkdownEditorField"
|
|
101
|
+
) as unknown as typeof MarkdownEditorFieldComponent;
|
|
102
|
+
|
|
103
|
+
export const UpgradeRequiredScreen = createLazyNamedExport(
|
|
104
|
+
heavyOptionalModuleFactories.UpgradeRequiredScreen,
|
|
105
|
+
"UpgradeRequiredScreen"
|
|
106
|
+
) as unknown as typeof UpgradeRequiredScreenComponent;
|
|
@@ -60,17 +60,24 @@ describe("LoginScreen", () => {
|
|
|
60
60
|
expect(getByTestId("login-screen-signup-link")).toBeTruthy();
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
it("renders forgot password button when
|
|
63
|
+
it("renders forgot password button when onForgotPassword is provided", () => {
|
|
64
64
|
const {getByTestId} = renderWithTheme(
|
|
65
65
|
<LoginScreen
|
|
66
66
|
fields={defaultFields}
|
|
67
|
-
|
|
67
|
+
onForgotPassword={() => {}}
|
|
68
68
|
onSubmit={mock(() => Promise.resolve())}
|
|
69
69
|
/>
|
|
70
70
|
);
|
|
71
71
|
expect(getByTestId("login-screen-forgot-password")).toBeTruthy();
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
+
it("does not render forgot password without a callback", () => {
|
|
75
|
+
const {queryByTestId} = renderWithTheme(
|
|
76
|
+
<LoginScreen fields={defaultFields} onSubmit={mock(() => Promise.resolve())} />
|
|
77
|
+
);
|
|
78
|
+
expect(queryByTestId("login-screen-forgot-password")).toBeNull();
|
|
79
|
+
});
|
|
80
|
+
|
|
74
81
|
it("renders error message", () => {
|
|
75
82
|
const {getByTestId} = renderWithTheme(
|
|
76
83
|
<LoginScreen
|
|
@@ -29,6 +29,7 @@ import type {LoginScreenProps} from "./loginTypes";
|
|
|
29
29
|
* ]}
|
|
30
30
|
* onSignUpPress={() => router.push("/signup")}
|
|
31
31
|
* onForgotPasswordPress={() => router.push("/forgot-password")}
|
|
32
|
+
// or onForgotPassword={() => router.push("/forgot-password")}
|
|
32
33
|
* />
|
|
33
34
|
* ```
|
|
34
35
|
*/
|
|
@@ -44,6 +45,7 @@ export const LoginScreen: FC<LoginScreenProps> = ({
|
|
|
44
45
|
onSignUpPress,
|
|
45
46
|
forgotPasswordText = "Forgot password?",
|
|
46
47
|
onForgotPasswordPress,
|
|
48
|
+
onForgotPassword,
|
|
47
49
|
testID = "login-screen",
|
|
48
50
|
}) => {
|
|
49
51
|
const [formValues, setFormValues] = useState<Record<string, string>>(() => {
|
|
@@ -54,6 +56,8 @@ export const LoginScreen: FC<LoginScreenProps> = ({
|
|
|
54
56
|
return initial;
|
|
55
57
|
});
|
|
56
58
|
|
|
59
|
+
const onForgotPasswordAction = onForgotPasswordPress ?? onForgotPassword;
|
|
60
|
+
|
|
57
61
|
const handleFieldChange = useCallback((fieldName: string, value: string) => {
|
|
58
62
|
setFormValues((prev) => ({...prev, [fieldName]: value}));
|
|
59
63
|
}, []);
|
|
@@ -121,11 +125,11 @@ export const LoginScreen: FC<LoginScreenProps> = ({
|
|
|
121
125
|
/>
|
|
122
126
|
</Box>
|
|
123
127
|
|
|
124
|
-
{Boolean(
|
|
128
|
+
{Boolean(onForgotPasswordAction) && (
|
|
125
129
|
<Box alignItems="center" marginTop={2}>
|
|
126
130
|
<Button
|
|
127
131
|
disabled={loading}
|
|
128
|
-
onClick={
|
|
132
|
+
onClick={onForgotPasswordAction!}
|
|
129
133
|
testID={`${testID}-forgot-password`}
|
|
130
134
|
text={forgotPasswordText!}
|
|
131
135
|
variant="muted"
|
package/src/login/loginTypes.ts
CHANGED
|
@@ -46,6 +46,8 @@ export interface LoginScreenProps {
|
|
|
46
46
|
forgotPasswordText?: string;
|
|
47
47
|
/** Callback triggered when the forgot password link is pressed. */
|
|
48
48
|
onForgotPasswordPress?: () => void;
|
|
49
|
+
/** Alias for `onForgotPasswordPress`. */
|
|
50
|
+
onForgotPassword?: () => void;
|
|
49
51
|
/** Test ID for the root element. */
|
|
50
52
|
testID?: string;
|
|
51
53
|
}
|
|
@@ -1,9 +1,43 @@
|
|
|
1
|
-
import {describe, expect, it} from "bun:test";
|
|
1
|
+
import {afterEach, describe, expect, it} from "bun:test";
|
|
2
2
|
import {render} from "@testing-library/react-native";
|
|
3
|
+
import {DateTime, Settings} from "luxon";
|
|
3
4
|
|
|
4
5
|
import {TableDate} from "./TableDate";
|
|
5
6
|
|
|
6
7
|
describe("TableDate", () => {
|
|
8
|
+
const freezeNow = (iso: string): void => {
|
|
9
|
+
const millis = DateTime.fromISO(iso).toMillis();
|
|
10
|
+
Settings.now = () => millis;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
Settings.now = () => Date.now();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("pluralizes years, months, and days in the annotation", () => {
|
|
18
|
+
freezeNow("2024-06-20T12:00:00.000Z");
|
|
19
|
+
const {getByText} = render(<TableDate annotated value="2022-03-15T12:00:00.000Z" />);
|
|
20
|
+
expect(getByText("03/15/2022 (2 Years 3 Mos 5 Days)")).toBeTruthy();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("uses singular labels for exactly one year, month, and day", () => {
|
|
24
|
+
freezeNow("2024-06-20T12:00:00.000Z");
|
|
25
|
+
const {getByText} = render(<TableDate annotated value="2023-05-19T12:00:00.000Z" />);
|
|
26
|
+
expect(getByText("05/19/2023 (1 Year 1 Mo 1 Day)")).toBeTruthy();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("omits zero units from the annotation", () => {
|
|
30
|
+
freezeNow("2024-06-20T12:00:00.000Z");
|
|
31
|
+
const {getByText} = render(<TableDate annotated value="2024-06-10T12:00:00.000Z" />);
|
|
32
|
+
expect(getByText("06/10/2024 (10 Days)")).toBeTruthy();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("renders an empty annotation for today's date", () => {
|
|
36
|
+
freezeNow("2024-06-20T12:00:00.000Z");
|
|
37
|
+
const {getByText} = render(<TableDate annotated value="2024-06-20T12:00:00.000Z" />);
|
|
38
|
+
expect(getByText("06/20/2024 ()")).toBeTruthy();
|
|
39
|
+
});
|
|
40
|
+
|
|
7
41
|
it("renders correctly with ISO string date", () => {
|
|
8
42
|
const {toJSON} = render(<TableDate value="2024-01-15T12:00:00.000Z" />);
|
|
9
43
|
expect(toJSON()).toMatchSnapshot();
|