diff --git a/webapp/channels/src/components/CLAUDE.OPTIONAL.md b/webapp/channels/src/components/CLAUDE.OPTIONAL.md index 3c36a25863f..c9cf6016e14 100644 --- a/webapp/channels/src/components/CLAUDE.OPTIONAL.md +++ b/webapp/channels/src/components/CLAUDE.OPTIONAL.md @@ -78,6 +78,7 @@ const intl = useIntl(); - Add/extend RTL tests alongside the component (`*.test.tsx`). See `../tests/react_testing_utils.tsx` for helpers. - Prefer `userEvent` and accessible queries (`getByRole`) over implementation-specific selectors. - Avoid snapshots; assert visible behavior instead. +- **Import Rule**: Never import directly from `@testing-library/react` or `react-dom/test-utils`. All testing utilities (`act`, `screen`, `fireEvent`, `waitFor`, `waitForElementToBeRemoved`, `userEvent`, `renderWithContext`, etc.) must be imported from `tests/react_testing_utils`, which re-exports everything from `@testing-library/react` alongside project-specific helpers. ## Icons - **Menu items and components should use Compass icon components** from `@mattermost/compass-icons/components` (e.g., ``), not raw `` elements. diff --git a/webapp/channels/src/components/__snapshots__/textbox.test.tsx.snap b/webapp/channels/src/components/__snapshots__/textbox.test.tsx.snap index e2795627527..bad50933627 100644 --- a/webapp/channels/src/components/__snapshots__/textbox.test.tsx.snap +++ b/webapp/channels/src/components/__snapshots__/textbox.test.tsx.snap @@ -1,578 +1,118 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing exports[`components/TextBox should match snapshot with additional, optional props 1`] = ` -
+
- +
+
+ some test text +
+
+
-
`; exports[`components/TextBox should match snapshot with required props 1`] = ` -
+
- +
+
+ some test text +
+
+
-
`; exports[`components/TextBox should throw error when new property is too long 1`] = ` -
+
- +
+
+ some test text that exceeds char limit +
+
+
-
`; exports[`components/TextBox should throw error when value is too long 1`] = ` -
+
- +
+
+ some test text that exceeds char limit +
+
+
-
`; diff --git a/webapp/channels/src/components/add_user_to_channel_modal/__snapshots__/add_user_to_channel_modal.test.tsx.snap b/webapp/channels/src/components/add_user_to_channel_modal/__snapshots__/add_user_to_channel_modal.test.tsx.snap index 10e7e90ee6e..cab7e8638dd 100644 --- a/webapp/channels/src/components/add_user_to_channel_modal/__snapshots__/add_user_to_channel_modal.test.tsx.snap +++ b/webapp/channels/src/components/add_user_to_channel_modal/__snapshots__/add_user_to_channel_modal.test.tsx.snap @@ -1,128 +1,97 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing exports[`components/AddUserToChannelModal should match snapshot 1`] = ` - -