-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(search-indexes): add search index signals COMPASS-7176 #4972
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e13883b
add search index signals in aggregations
mabaasit 240bf9a
add search index signals in query
mabaasit c9045cd
Merge branch 'main' into COMPASS-7176-search-signals
mabaasit 8a302b6
test
mabaasit 0a3c1b5
clean up
mabaasit b38b97b
stage can be undefined in focus-modal
mabaasit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 20 additions & 25 deletions
45
packages/compass-aggregations/src/components/focus-mode/focus-mode.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,46 @@ | ||
import React from 'react'; | ||
import type { ComponentProps } from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { expect } from 'chai'; | ||
import { Provider } from 'react-redux'; | ||
import sinon from 'sinon'; | ||
|
||
import configureStore from '../../../test/configure-store'; | ||
import { FocusMode } from './focus-mode'; | ||
import FocusMode from './focus-mode'; | ||
import { disableFocusMode, enableFocusMode } from '../../modules/focus-mode'; | ||
|
||
const renderFocusMode = ( | ||
props: Partial<ComponentProps<typeof FocusMode>> = {} | ||
) => { | ||
const renderFocusMode = () => { | ||
const store = configureStore({ | ||
pipeline: [{ $match: { _id: 1 } }, { $limit: 10 }, { $out: 'out' }], | ||
}); | ||
render( | ||
<Provider | ||
store={configureStore({ | ||
pipeline: [{ $match: { _id: 1 } }, { $limit: 10 }, { $out: 'out' }], | ||
})} | ||
> | ||
<FocusMode | ||
isModalOpen={true} | ||
isAutoPreviewEnabled={true} | ||
onCloseModal={() => {}} | ||
{...props} | ||
/> | ||
<Provider store={store}> | ||
<FocusMode /> | ||
</Provider> | ||
); | ||
return store; | ||
}; | ||
|
||
describe('FocusMode', function () { | ||
it('does not show modal when closed', function () { | ||
renderFocusMode({ isModalOpen: false }); | ||
const store = renderFocusMode(); | ||
store.dispatch(disableFocusMode()); | ||
expect(() => { | ||
screen.getByTestId('focus-mode-modal'); | ||
}).to.throw; | ||
}); | ||
|
||
it('shows modal when open', function () { | ||
renderFocusMode({ isModalOpen: true }); | ||
const store = renderFocusMode(); | ||
store.dispatch(enableFocusMode(0)); | ||
expect(screen.getByTestId('focus-mode-modal')).to.exist; | ||
}); | ||
|
||
it('calls onCloseModal when close button is clicked', function () { | ||
const onCloseModal = sinon.spy(); | ||
renderFocusMode({ onCloseModal, isModalOpen: true }); | ||
|
||
expect(onCloseModal).to.not.have.been.called; | ||
it('hides modal when close button is clicked', function () { | ||
const store = renderFocusMode(); | ||
store.dispatch(enableFocusMode(0)); | ||
screen.getByLabelText(/close modal/i).click(); | ||
expect(onCloseModal).to.have.been.calledOnce; | ||
|
||
expect(() => { | ||
screen.getByTestId('focus-mode-modal'); | ||
}).to.throw; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to pass the stage here, if we pass also all stages and stageIndex? Or it can be accessed directly in the FocusModeModalHeader component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The stages we pass to the component are mapped with only index and operator properties. The stage passed here is full stage.