-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cfc4d21
commit bb478aa
Showing
3 changed files
with
255 additions
and
0 deletions.
There are no files selected for viewing
181 changes: 181 additions & 0 deletions
181
...ublic/classes/sources/es_geo_grid_source/__snapshots__/update_source_editor.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/resolution_editor.test.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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
// @ts-expect-error | ||
import { ResolutionEditor } from './resolution_editor'; | ||
import { GRID_RESOLUTION } from '../../../../common/constants'; | ||
|
||
const defaultProps = { | ||
resolution: GRID_RESOLUTION.COARSE, | ||
onChange: () => {}, | ||
includeSuperFine: false, | ||
}; | ||
|
||
describe('resolution editor', () => { | ||
test('should omit super-fine option', async () => { | ||
const component = shallow(<ResolutionEditor />); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
test('should add super-fine option', async () => { | ||
const component = shallow(<ResolutionEditor includeSuperFine={true} />); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
45 changes: 45 additions & 0 deletions
45
x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/update_source_editor.test.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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
// @ts-expect-error | ||
import { UpdateSourceEditor } from './update_source_editor'; | ||
import { GRID_RESOLUTION, LAYER_TYPE, RENDER_AS } from '../../../../common/constants'; | ||
|
||
const defaultProps = { | ||
currentLayerType: LAYER_TYPE.VECTOR, | ||
indexPatternId: 'foobar', | ||
onChange: () => {}, | ||
metrics: [], | ||
renderAs: RENDER_AS.POINT, | ||
resolution: GRID_RESOLUTION.COARSE, | ||
}; | ||
|
||
describe('source editor geo_grid_source', () => { | ||
describe('default vector layer config', () => { | ||
test('should allow super-fine option', async () => { | ||
const component = shallow(<UpdateSourceEditor {...defaultProps} />); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
describe('should put limitations based on heatmap-rendering selection', () => { | ||
test('should not allow super-fine option for heatmaps', async () => { | ||
const component = shallow( | ||
<UpdateSourceEditor {...defaultProps} currentLayerType={LAYER_TYPE.HEATMAP} /> | ||
); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
test('should disable multiple metrics', async () => { | ||
const component = shallow( | ||
<UpdateSourceEditor {...defaultProps} renderAs={RENDER_AS.HEATMAP} /> | ||
); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |