-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into sticky-table-header
- Loading branch information
Showing
8 changed files
with
180 additions
and
94 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from 'react' | ||
import VegaLite, { VegaLiteProps } from 'react-vega/lib/VegaLite' | ||
import { Config } from 'vega-lite' | ||
import merge from 'lodash.merge' | ||
import cloneDeep from 'lodash.clonedeep' | ||
import styles from './styles.module.scss' | ||
import { getThemeValue, ThemeProperty } from '../../util/styles' | ||
|
||
export type ZoomedInPlotProps = { | ||
props: VegaLiteProps | ||
} | ||
|
||
export const ZoomedInPlot: React.FC<ZoomedInPlotProps> = ({ | ||
props | ||
}: ZoomedInPlotProps) => ( | ||
<div className={styles.zoomedInPlot} data-testid="zoomed-in-plot"> | ||
<VegaLite | ||
{...merge( | ||
{ ...cloneDeep(props) }, | ||
{ | ||
spec: { encoding: { color: { legend: { disable: false } } } } | ||
} | ||
)} | ||
config={{ | ||
...(props.config as Config), | ||
background: getThemeValue(ThemeProperty.MENU_BACKGROUND) | ||
}} | ||
actions={{ | ||
compiled: false, | ||
editor: false, | ||
export: true, | ||
source: false | ||
}} | ||
/> | ||
</div> | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
import React from 'react' | ||
import { render, cleanup, fireEvent } from '@testing-library/react' | ||
import { Modal } from './Modal' | ||
|
||
describe('Modal', () => { | ||
afterEach(() => { | ||
cleanup() | ||
}) | ||
|
||
it('should call the onClose prop when pressing Escape', () => { | ||
const onClose = jest.fn() | ||
|
||
render(<Modal onClose={onClose} />) | ||
|
||
fireEvent.keyDown(window, { key: 'Escape' }) | ||
|
||
expect(onClose).toHaveBeenCalled() | ||
}) | ||
|
||
it('should not call the onClose prop when pressing other keys', () => { | ||
const onClose = jest.fn() | ||
|
||
render(<Modal onClose={onClose} />) | ||
|
||
fireEvent.keyDown(window, { key: 'Enter' }) | ||
fireEvent.keyDown(window, { key: 'e' }) | ||
fireEvent.keyDown(window, { key: 'Space' }) | ||
fireEvent.keyDown(window, { key: 'Alt' }) | ||
|
||
expect(onClose).not.toHaveBeenCalled() | ||
}) | ||
}) |
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