Skip to content

Commit c42deb1

Browse files
authored
Merge pull request #1826 from vulongphan/update/add-test-for-stop-button
test that stopSketch is called when a sketch is playing and user click stop button
2 parents 481f80e + ae255b1 commit c42deb1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

client/modules/IDE/components/Toolbar.unit.test.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@ describe('<ToolbarComponent />', () => {
9292
await waitFor(() => expect(props.saveProject).not.toHaveBeenCalled());
9393
});
9494

95+
it('sketch is stopped when stop button is clicked', async () => {
96+
const props = renderComponent({ isPlaying: true });
97+
98+
const stopButton = screen.getByLabelText('Stop sketch');
99+
100+
fireEvent.click(stopButton);
101+
102+
await waitFor(() => expect(props.stopSketch).toHaveBeenCalled());
103+
});
104+
95105
it('sketch is started when play button is clicked', async () => {
96106
const props = renderComponent();
97107
const playButton = screen.getByLabelText('Play only visual sketch');

0 commit comments

Comments
 (0)