Skip to content

Commit 77480a8

Browse files
committed
Fixed spinner tests
#1531
1 parent fdd34ee commit 77480a8

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

packages/dashboard-core-plugins/src/panels/ChartPanel.test.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jest.mock('@deephaven/dashboard', () => ({
2020
},
2121
}));
2222

23-
const MockChart = jest.fn(() => null);
23+
const MockChart: React.FC & jest.Mock = jest.fn(() => null);
2424

2525
jest.mock('@deephaven/chart', () => {
2626
const { forwardRef } = jest.requireActual('react');
@@ -106,17 +106,16 @@ function callErrorFunction() {
106106

107107
function expectLoading(container) {
108108
expect(
109-
container.querySelector("[data-icon='circle-large']")
109+
container.querySelector('[role=progressbar].loading-spinner-large')
110110
).toBeInTheDocument();
111-
expect(container.querySelector("[data-icon='loading']")).toBeInTheDocument();
112111
}
113112

114113
function expectNotLoading(container) {
115114
expect(
116115
container.querySelector("[data-icon='outline']")
117116
).not.toBeInTheDocument();
118117
expect(
119-
container.querySelector("[data-icon='loading']")
118+
container.querySelector('[role=progressbar].loading-spinner-large')
120119
).not.toBeInTheDocument();
121120
}
122121

packages/dashboard-core-plugins/src/panels/IrisGridPanel.test.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { Container } from '@deephaven/golden-layout';
99
import { Workspace } from '@deephaven/redux';
1010
import { IrisGridPanel } from './IrisGridPanel';
1111

12-
const MockIrisGrid = jest.fn(() => null);
12+
const MockIrisGrid: React.FC & jest.Mock = jest.fn(() => null);
1313

1414
jest.mock('@deephaven/iris-grid', () => {
1515
const { forwardRef } = jest.requireActual('react');
@@ -84,10 +84,9 @@ function makeIrisGridPanelWrapper(
8484
async function expectLoading(container) {
8585
await waitFor(() =>
8686
expect(
87-
container.querySelector("[data-icon='circle-large']")
87+
container.querySelector('[role=progressbar].loading-spinner-large')
8888
).toBeInTheDocument()
8989
);
90-
expect(container.querySelector("[data-icon='loading']")).toBeInTheDocument();
9190
}
9291

9392
async function expectNotLoading(container) {
@@ -97,7 +96,7 @@ async function expectNotLoading(container) {
9796
).not.toBeInTheDocument()
9897
);
9998
expect(
100-
container.querySelector("[data-icon='loading']")
99+
container.querySelector('[role=progressbar].loading-spinner-large')
101100
).not.toBeInTheDocument();
102101
}
103102

@@ -127,7 +126,7 @@ it('shows the loading spinner until grid is ready', async () => {
127126
const tablePromise = Promise.resolve(table);
128127
const makeModel = makeMakeModel(tablePromise);
129128

130-
expect.assertions(6);
129+
expect.assertions(4);
131130
const { container } = makeIrisGridPanelWrapper(makeModel);
132131

133132
await expectLoading(container);

0 commit comments

Comments
 (0)