Skip to content

Commit f285a73

Browse files
fix(compass-crud): expanded docs retains state after switching tabs COMPASS-7318 (#5137)
* fix: expanded docs retains state post tab switch moved the expanded state of the document/element to HadronDocument/HadronElement * moved from normal docs to hadron docs in the store * minor refactor * refactor related to HadronDocument and HadronElement * added options to expand/collapse docs for a stage preview * added e2e tests for the expanding / collapsing of documents * refactor: related to React convention for callbacks and types
1 parent 411e5d6 commit f285a73

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1273
-248
lines changed

package-lock.json

Lines changed: 215 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/compass-aggregations/src/components/focus-mode/focus-mode-stage-preview.spec.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { type ComponentProps } from 'react';
2+
import HadronDocument from 'hadron-document';
23
import type { Document } from 'mongodb';
34
import { render, screen, within } from '@testing-library/react';
45
import { expect } from 'chai';
@@ -34,6 +35,8 @@ const renderFocusModePreview = (
3435
stageOperator={null}
3536
documents={null}
3637
isMissingAtlasOnlyStageSupport={false}
38+
onExpand={() => {}}
39+
onCollapse={() => {}}
3740
{...props}
3841
/>
3942
</Provider>
@@ -42,14 +45,14 @@ const renderFocusModePreview = (
4245

4346
describe('FocusModeStagePreview', function () {
4447
it('renders stage input', function () {
45-
render(<InputPreview />);
48+
render(<InputPreview onExpand={() => {}} onCollapse={() => {}} />);
4649
const preview = screen.getByTestId('focus-mode-stage-preview');
4750
expect(preview).to.exist;
4851
expect(within(preview).getByText(/stage input/i)).to.exist;
4952
});
5053

5154
it('renders stage output', function () {
52-
render(<OutputPreview />);
55+
render(<OutputPreview onExpand={() => {}} onCollapse={() => {}} />);
5356
const preview = screen.getByTestId('focus-mode-stage-preview');
5457
expect(preview).to.exist;
5558
expect(within(preview).getByText(/stage output/i)).to.exist;
@@ -67,7 +70,10 @@ describe('FocusModeStagePreview', function () {
6770
it('renders list of documents', function () {
6871
renderFocusModePreview({
6972
isLoading: false,
70-
documents: [{ _id: 12345 }, { _id: 54321 }],
73+
documents: [
74+
new HadronDocument({ _id: 12345 }),
75+
new HadronDocument({ _id: 54321 }),
76+
],
7177
});
7278
const preview = screen.getByTestId('focus-mode-stage-preview');
7379
expect(within(preview).getByText(/12345/i)).to.exist;

0 commit comments

Comments
 (0)