mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 18:46:17 +00:00
fix breaking changes for user-event v14
This commit is contained in:
committed by
David Lechner
parent
4299b36e6c
commit
883807b4b4
@@ -7,7 +7,7 @@ import Toolbar from './Toolbar';
|
||||
|
||||
describe('toolbar', () => {
|
||||
it('should have bluetooth button', () => {
|
||||
const [toolbar] = testRender(<Toolbar />);
|
||||
const [, toolbar] = testRender(<Toolbar />);
|
||||
|
||||
const runButton = toolbar.getByRole('button', { name: 'Bluetooth' });
|
||||
|
||||
@@ -15,7 +15,7 @@ describe('toolbar', () => {
|
||||
});
|
||||
|
||||
it('should have flash button', () => {
|
||||
const [toolbar] = testRender(<Toolbar />);
|
||||
const [, toolbar] = testRender(<Toolbar />);
|
||||
|
||||
const runButton = toolbar.getByRole('button', { name: 'Flash' });
|
||||
|
||||
@@ -23,7 +23,7 @@ describe('toolbar', () => {
|
||||
});
|
||||
|
||||
it('should have run button', () => {
|
||||
const [toolbar] = testRender(<Toolbar />);
|
||||
const [, toolbar] = testRender(<Toolbar />);
|
||||
|
||||
const runButton = toolbar.getByRole('button', { name: 'Run' });
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('toolbar', () => {
|
||||
});
|
||||
|
||||
it('should have stop button', () => {
|
||||
const [toolbar] = testRender(<Toolbar />);
|
||||
const [, toolbar] = testRender(<Toolbar />);
|
||||
|
||||
const runButton = toolbar.getByRole('button', { name: 'Stop' });
|
||||
|
||||
@@ -39,7 +39,7 @@ describe('toolbar', () => {
|
||||
});
|
||||
|
||||
it('should have repl button', () => {
|
||||
const [toolbar] = testRender(<Toolbar />);
|
||||
const [, toolbar] = testRender(<Toolbar />);
|
||||
|
||||
const runButton = toolbar.getByRole('button', { name: 'REPL' });
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@ afterEach(() => {
|
||||
cleanup();
|
||||
});
|
||||
|
||||
it('should dispatch action when clicked', () => {
|
||||
const [button, dispatch] = testRender(
|
||||
it('should dispatch action when clicked', async () => {
|
||||
const [user, button, dispatch] = testRender(
|
||||
<BluetoothButton id="test-bluetooth-button" />,
|
||||
);
|
||||
|
||||
button.getByRole('button', { name: 'Bluetooth' }).click();
|
||||
await user.click(button.getByRole('button', { name: 'Bluetooth' }));
|
||||
|
||||
expect(dispatch).toHaveBeenCalledWith(toggleBluetooth());
|
||||
});
|
||||
|
||||
@@ -11,10 +11,10 @@ afterEach(() => {
|
||||
cleanup();
|
||||
});
|
||||
|
||||
it('should dispatch action when clicked', () => {
|
||||
const [button, dispatch] = testRender(<FlashButton id="test-flash-button" />);
|
||||
it('should dispatch action when clicked', async () => {
|
||||
const [user, button, dispatch] = testRender(<FlashButton id="test-flash-button" />);
|
||||
|
||||
button.getByRole('button', { name: 'Flash' }).click();
|
||||
await user.click(button.getByRole('button', { name: 'Flash' }));
|
||||
|
||||
expect(dispatch).toHaveBeenCalledWith(flashFirmware(null, false, ''));
|
||||
});
|
||||
|
||||
@@ -12,12 +12,12 @@ afterEach(() => {
|
||||
cleanup();
|
||||
});
|
||||
|
||||
it('should dispatch action when clicked', () => {
|
||||
const [button, dispatch] = testRender(<ReplButton id="test-repl-button" />, {
|
||||
it('should dispatch action when clicked', async () => {
|
||||
const [user, button, dispatch] = testRender(<ReplButton id="test-repl-button" />, {
|
||||
hub: { runtime: HubRuntimeState.Idle },
|
||||
});
|
||||
|
||||
button.getByRole('button', { name: 'REPL' }).click();
|
||||
await user.click(button.getByRole('button', { name: 'REPL' }));
|
||||
|
||||
expect(dispatch).toHaveBeenCalledWith(repl());
|
||||
});
|
||||
|
||||
@@ -12,13 +12,13 @@ afterEach(() => {
|
||||
cleanup();
|
||||
});
|
||||
|
||||
it('should dispatch action when clicked', () => {
|
||||
const [button, dispatch] = testRender(<RunButton id="test-run-button" />, {
|
||||
it('should dispatch action when clicked', async () => {
|
||||
const [user, button, dispatch] = testRender(<RunButton id="test-run-button" />, {
|
||||
editor: { isReady: true },
|
||||
hub: { runtime: HubRuntimeState.Idle },
|
||||
});
|
||||
|
||||
button.getByRole('button', { name: 'Run' }).click();
|
||||
await user.click(button.getByRole('button', { name: 'Run' }));
|
||||
|
||||
expect(dispatch).toHaveBeenCalledWith(downloadAndRun());
|
||||
});
|
||||
|
||||
@@ -12,12 +12,12 @@ afterEach(() => {
|
||||
cleanup();
|
||||
});
|
||||
|
||||
it('should dispatch action when clicked', () => {
|
||||
const [button, dispatch] = testRender(<StopButton id="test-stop-button" />, {
|
||||
it('should dispatch action when clicked', async () => {
|
||||
const [user, button, dispatch] = testRender(<StopButton id="test-stop-button" />, {
|
||||
hub: { runtime: HubRuntimeState.Running },
|
||||
});
|
||||
|
||||
button.getByRole('button', { name: 'Stop' }).click();
|
||||
await user.click(button.getByRole('button', { name: 'Stop' }));
|
||||
|
||||
expect(dispatch).toHaveBeenCalledWith(stop());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user