diff --git a/rtl-spec/components/editors-non-ideal-state.spec.tsx b/rtl-spec/components/editors-non-ideal-state.spec.tsx
index 19fe2d9d0d..29d5e84f1d 100644
--- a/rtl-spec/components/editors-non-ideal-state.spec.tsx
+++ b/rtl-spec/components/editors-non-ideal-state.spec.tsx
@@ -1,9 +1,12 @@
-import { mount } from 'enzyme';
+import React from 'react';
-import { renderNonIdealState } from '../../src/renderer/components/editors-non-ideal-state';
+import { render } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+
+import { RenderNonIdealState } from '../../src/renderer/components/editors-non-ideal-state';
import { EditorMosaic } from '../../src/renderer/editor-mosaic';
-describe('renderNonIdealState()', () => {
+describe('RenderNonIdealState component', () => {
let editorMosaic: EditorMosaic;
beforeEach(() => {
@@ -11,13 +14,20 @@ describe('renderNonIdealState()', () => {
});
it('renders a non-ideal state', () => {
- expect(renderNonIdealState({} as EditorMosaic)).toMatchSnapshot();
+ const { getByText } = render(
+ ,
+ );
+
+ expect(getByText('Reset editors')).toBeInTheDocument();
});
- it('handles a click', () => {
+ it('handles a click', async () => {
const resetLayoutSpy = jest.spyOn(editorMosaic, 'resetLayout');
- const wrapper = mount(renderNonIdealState(editorMosaic));
- wrapper.find('button').simulate('click');
+ const { getByRole } = render(
+ ,
+ );
+ await userEvent.click(getByRole('button'));
+
expect(resetLayoutSpy).toHaveBeenCalledTimes(1);
});
});
diff --git a/src/renderer/components/editors-non-ideal-state.tsx b/src/renderer/components/editors-non-ideal-state.tsx
index 386b6a8f6a..f58ba35081 100644
--- a/src/renderer/components/editors-non-ideal-state.tsx
+++ b/src/renderer/components/editors-non-ideal-state.tsx
@@ -4,7 +4,13 @@ import { Button, NonIdealState } from '@blueprintjs/core';
import { EditorMosaic } from '../editor-mosaic';
-export function renderNonIdealState(editorMosaic: EditorMosaic) {
+type RenderNonIdealStateProps = {
+ editorMosaic: EditorMosaic;
+};
+
+export function RenderNonIdealState({
+ editorMosaic,
+}: RenderNonIdealStateProps) {
const resolveButton = (