Skip to content

Commit e7568ce

Browse files
committed
add tests for the Accelerator button
1 parent 8dc16a7 commit e7568ce

File tree

2 files changed

+743
-1
lines changed

2 files changed

+743
-1
lines changed

src/accelerators/AcceleratorButton.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,19 @@ function saveAcceleratorsToMetadata(
5555

5656
/**
5757
* React component for the accelerator selector
58+
*
59+
* Exported for testing purposes. This allows tests to directly test the component's
60+
* behavior without requiring the widget wrapper (AcceleratorSelectorWidget), which
61+
* is just a thin wrapper that calls render(). Testing the component directly:
62+
* - Simplifies test setup and maintenance
63+
* - Allows better isolation of component logic
64+
* - Is a common pattern in React testing (used by Material-UI, Ant Design, etc.)
65+
* - Still tests behavior, not implementation details
66+
*
67+
* The widget wrapper adds minimal logic (just CSS class and render call), so testing
68+
* the component directly provides the same coverage with less complexity.
5869
*/
59-
const AcceleratorSelector: React.FC<IAcceleratorSelectorProps> = ({
70+
export const AcceleratorSelector: React.FC<IAcceleratorSelectorProps> = ({
6071
sessionContext,
6172
notebookPanel,
6273
translator

0 commit comments

Comments
 (0)