-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 2021_04_07-add_debug_state_partition
- Loading branch information
Showing
22 changed files
with
460 additions
and
25 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
Binary file added
BIN
+4.85 KB
...ories-bar-chart-test-use-default-group-domain-visually-looks-correct-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+27 KB
...all-stories-test-cases-add-custom-description-visually-looks-correct-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+19.7 KB
...l-stories-test-cases-legend-scroll-bar-sizing-visually-looks-correct-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.58 KB
(98%)
...-tests-for-all-stories-treemap-mid-two-layers-visually-looks-correct-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,76 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { Store } from 'redux'; | ||
|
||
import { MockGlobalSpec, MockSeriesSpec } from '../../../mocks/specs'; | ||
import { MockStore } from '../../../mocks/store/store'; | ||
import { GlobalChartState } from '../../../state/chart_state'; | ||
import { getSettingsSpecSelector } from '../../../state/selectors/get_settings_specs'; | ||
|
||
describe('custom description for screen readers', () => { | ||
let store: Store<GlobalChartState>; | ||
beforeEach(() => { | ||
store = MockStore.default(); | ||
MockStore.addSpecs( | ||
[ | ||
MockSeriesSpec.bar({ | ||
data: [ | ||
{ x: 1, y: 10 }, | ||
{ x: 2, y: 5 }, | ||
], | ||
}), | ||
MockGlobalSpec.settings(), | ||
], | ||
store, | ||
); | ||
}); | ||
it('should test defaults', () => { | ||
const state = store.getState(); | ||
const { description, useDefaultSummary } = getSettingsSpecSelector(state); | ||
expect(description).toBeUndefined(); | ||
expect(useDefaultSummary).toBeTrue(); | ||
}); | ||
it('should allow user to set a custom description for chart', () => { | ||
MockStore.addSpecs( | ||
[ | ||
MockGlobalSpec.settings({ | ||
description: 'This is sample Kibana data', | ||
}), | ||
], | ||
store, | ||
); | ||
const state = store.getState(); | ||
const { description } = getSettingsSpecSelector(state); | ||
expect(description).toBe('This is sample Kibana data'); | ||
}); | ||
it('should be able to disable generated descriptions', () => { | ||
MockStore.addSpecs( | ||
[ | ||
MockGlobalSpec.settings({ | ||
useDefaultSummary: false, | ||
}), | ||
], | ||
store, | ||
); | ||
const state = store.getState(); | ||
const { useDefaultSummary } = getSettingsSpecSelector(state); | ||
expect(useDefaultSummary).toBe(false); | ||
}); | ||
}); |
94 changes: 94 additions & 0 deletions
94
src/chart_types/xy_chart/state/selectors/get_api_scale_configs.test.ts
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,94 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { MockGlobalSpec, MockSeriesSpec } from '../../../../mocks/specs/specs'; | ||
import { MockStore } from '../../../../mocks/store/store'; | ||
import { DEFAULT_GLOBAL_ID } from '../../utils/specs'; | ||
import { computeSeriesGeometriesSelector } from './compute_series_geometries'; | ||
import { getScaleConfigsFromSpecsSelector } from './get_api_scale_configs'; | ||
|
||
describe('GroupIds and useDefaultGroupId', () => { | ||
it('use the specified useDefaultGroupId to compute scale configs', () => { | ||
const store = MockStore.default(); | ||
MockStore.addSpecs( | ||
[ | ||
MockSeriesSpec.bar({ | ||
groupId: 'other', | ||
useDefaultGroupDomain: 'a different one', | ||
}), | ||
], | ||
store, | ||
); | ||
const scaleConfigs = getScaleConfigsFromSpecsSelector(store.getState()); | ||
expect(scaleConfigs.y['a different one']).toBeDefined(); | ||
}); | ||
|
||
it('have 2 different y domains with 2 groups', () => { | ||
const store = MockStore.default(); | ||
MockStore.addSpecs( | ||
[ | ||
MockSeriesSpec.bar({ id: 'one' }), | ||
MockSeriesSpec.bar({ | ||
id: 'two', | ||
groupId: 'other', | ||
useDefaultGroupDomain: 'a different one', | ||
}), | ||
], | ||
store, | ||
); | ||
const scaleConfigs = getScaleConfigsFromSpecsSelector(store.getState()); | ||
expect(Object.keys(scaleConfigs.y)).toHaveLength(2); | ||
expect(scaleConfigs.y['a different one']).toBeDefined(); | ||
expect(scaleConfigs.y[DEFAULT_GLOBAL_ID]).toBeDefined(); | ||
}); | ||
|
||
it('have 2 different y domains with 3 groups', () => { | ||
const store = MockStore.default({ width: 120, height: 100, left: 0, top: 0 }); | ||
MockStore.addSpecs( | ||
[ | ||
MockGlobalSpec.settingsNoMargins(), | ||
MockSeriesSpec.bar({ id: 'one', data: [{ x: 1, y: 10 }] }), | ||
MockSeriesSpec.bar({ | ||
id: 'two', | ||
groupId: 'other', | ||
useDefaultGroupDomain: 'a different one', | ||
data: [{ x: 1, y: 10 }], | ||
}), | ||
MockSeriesSpec.bar({ | ||
id: 'three', | ||
groupId: 'another again', | ||
useDefaultGroupDomain: 'a different one', | ||
data: [{ x: 1, y: 10 }], | ||
}), | ||
], | ||
store, | ||
); | ||
const scaleConfigs = getScaleConfigsFromSpecsSelector(store.getState()); | ||
expect(Object.keys(scaleConfigs.y)).toHaveLength(2); | ||
expect(scaleConfigs.y['a different one']).toBeDefined(); | ||
expect(scaleConfigs.y[DEFAULT_GLOBAL_ID]).toBeDefined(); | ||
|
||
const geoms = computeSeriesGeometriesSelector(store.getState()); | ||
const { bars } = geoms.geometries; | ||
expect(bars).toHaveLength(3); | ||
expect(bars[0].value[0].width).toBe(40); | ||
expect(bars[1].value[0].width).toBe(40); | ||
expect(bars[2].value[0].width).toBe(40); | ||
}); | ||
}); |
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.