mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 10:35:11 +00:00
fix missing FocusScope in button tests
This commit is contained in:
committed by
David Lechner
parent
2d968381c4
commit
5389d59842
@@ -3,6 +3,7 @@
|
||||
|
||||
import { act, cleanup } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { FocusScope } from 'react-aria';
|
||||
import { testRender } from '../../../../test';
|
||||
import { toggleBluetooth } from '../../../ble/actions';
|
||||
import BluetoothButton from './BluetoothButton';
|
||||
@@ -13,7 +14,9 @@ afterEach(() => {
|
||||
|
||||
it('should dispatch action when clicked', async () => {
|
||||
const [user, button, dispatch] = testRender(
|
||||
<BluetoothButton id="test-bluetooth-button" />,
|
||||
<FocusScope>
|
||||
<BluetoothButton id="test-bluetooth-button" />
|
||||
</FocusScope>,
|
||||
);
|
||||
|
||||
await act(() => user.click(button.getByRole('button', { name: 'Bluetooth' })));
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import { act, cleanup } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { FocusScope } from 'react-aria';
|
||||
import { testRender } from '../../../../test';
|
||||
import { hubStartRepl } from '../../../hub/actions';
|
||||
import { HubRuntimeState } from '../../../hub/reducers';
|
||||
@@ -13,9 +14,14 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
it('should dispatch action when clicked', async () => {
|
||||
const [user, button, dispatch] = testRender(<ReplButton id="test-repl-button" />, {
|
||||
hub: { hasRepl: true, runtime: HubRuntimeState.Idle },
|
||||
});
|
||||
const [user, button, dispatch] = testRender(
|
||||
<FocusScope>
|
||||
<ReplButton id="test-repl-button" />
|
||||
</FocusScope>,
|
||||
{
|
||||
hub: { hasRepl: true, runtime: HubRuntimeState.Idle },
|
||||
},
|
||||
);
|
||||
|
||||
await act(() => user.click(button.getByRole('button', { name: 'REPL' })));
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import { act, cleanup } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { FocusScope } from 'react-aria';
|
||||
import { testRender, uuid } from '../../../../test';
|
||||
import { FileFormat } from '../../../ble-pybricks-service/protocol';
|
||||
import { downloadAndRun } from '../../../hub/actions';
|
||||
@@ -14,13 +15,18 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
it('should dispatch action when clicked', async () => {
|
||||
const [user, button, dispatch] = testRender(<RunButton id="test-run-button" />, {
|
||||
editor: { activeFileUuid: uuid(0) },
|
||||
hub: {
|
||||
runtime: HubRuntimeState.Idle,
|
||||
preferredFileFormat: FileFormat.MultiMpy6,
|
||||
const [user, button, dispatch] = testRender(
|
||||
<FocusScope>
|
||||
<RunButton id="test-run-button" />
|
||||
</FocusScope>,
|
||||
{
|
||||
editor: { activeFileUuid: uuid(0) },
|
||||
hub: {
|
||||
runtime: HubRuntimeState.Idle,
|
||||
preferredFileFormat: FileFormat.MultiMpy6,
|
||||
},
|
||||
},
|
||||
});
|
||||
);
|
||||
|
||||
await act(() => user.click(button.getByRole('button', { name: 'Run' })));
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import { act, cleanup } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { FocusScope } from 'react-aria';
|
||||
import { testRender } from '../../../../test';
|
||||
import { hubStopUserProgram } from '../../../hub/actions';
|
||||
import { HubRuntimeState } from '../../../hub/reducers';
|
||||
@@ -13,9 +14,14 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
it('should dispatch action when clicked', async () => {
|
||||
const [user, button, dispatch] = testRender(<StopButton id="test-stop-button" />, {
|
||||
hub: { runtime: HubRuntimeState.Running },
|
||||
});
|
||||
const [user, button, dispatch] = testRender(
|
||||
<FocusScope>
|
||||
<StopButton id="test-stop-button" />
|
||||
</FocusScope>,
|
||||
{
|
||||
hub: { runtime: HubRuntimeState.Running },
|
||||
},
|
||||
);
|
||||
|
||||
await act(() => user.click(button.getByRole('button', { name: 'Stop' })));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user