Skip to content

Commit 0caf05a

Browse files
Merge branch 'main' into 214-batch-3-tests
2 parents 90f6b76 + 6e1ad2d commit 0caf05a

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

packages/components/CLAUDE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ If the finding needs real work, open a dedicated issue and link it next to the c
187187
- Main component file: `YourComponent.tsx`
188188
- Types file: `YourComponent.types.ts` (if complex)
189189
- Styles using `EDSStyleSheet.create`
190+
- Test file: `YourComponent.test.tsx` — write it alongside the component, not as a follow-up. See `Divider.test.tsx` for the minimal shape: render via `test-utils` (wraps `@testing-library/react-native` with `EDSProvider`) and assert it renders plus any accessibility basics.
190191
2. Export from `src/index.ts`
191192
3. Add storybook story in `../../apps/storybook/app/(tabs)/YourComponent.tsx`
192193
4. Create developer documentation in `docs/YourComponent.mdx` — run `/document-component` for the full workflow and structure
@@ -217,6 +218,7 @@ If the finding needs real work, open a dedicated issue and link it next to the c
217218
- [ ] Exports TypeScript types for all props
218219
- [ ] Follows existing component patterns (prop naming, structure)
219220
- [ ] Has corresponding storybook story for visual testing
221+
- [ ] Has a `YourComponent.test.tsx` covering rendering and accessibility basics
220222
- [ ] Has developer MDX doc in `docs/` (Features → Usage → Examples → Props → Accessibility → Related components)
221223

222224
## Important Patterns

packages/components/src/components/Divider/Divider.test.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,17 @@ describe("Divider", () => {
2121
marginVertical: 8,
2222
});
2323
});
24+
25+
it("cannot be made accessible by a caller-supplied prop", () => {
26+
render(
27+
<Divider
28+
testID="divider"
29+
accessible={true}
30+
importantForAccessibility="yes"
31+
/>
32+
);
33+
const divider = screen.getByTestId("divider");
34+
expect(divider).toHaveProp("accessible", false);
35+
expect(divider).toHaveProp("importantForAccessibility", "no");
36+
});
2437
});

packages/components/src/components/Divider/Divider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export const Divider = ({ style, ...rest }: DividerProps) => {
1010
return (
1111
<View
1212
style={[styles.divider, style]}
13+
{...rest}
1314
accessible={false}
1415
importantForAccessibility="no"
15-
{...rest}
1616
/>
1717
);
1818
};

0 commit comments

Comments
 (0)