mirror of
https://github.com/apache/superset.git
synced 2026-04-13 13:18:25 +00:00
fix: Handle rendering a single point (#7256)
* fix: Handle rendering a single point * fix: typo
This commit is contained in:
committed by
Beto Dealmeida
parent
7c80cf58eb
commit
2a67e8e457
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
import { max } from 'd3-array';
|
||||
import { getAggFunc } from '../../../../../src/visualizations/deckgl/layers/common';
|
||||
import { getAggFunc, getBounds } from '../../../../../src/visualizations/deckgl/layers/common';
|
||||
|
||||
describe('deckgl layers common', () => {
|
||||
it('getAggFunc', () => {
|
||||
@@ -46,4 +46,65 @@ describe('deckgl layers common', () => {
|
||||
expect(getAggFunc('p95', accessor)(arr)).toEqual(2.9);
|
||||
expect(getAggFunc('p99', accessor)(arr)).toEqual(2.98);
|
||||
});
|
||||
|
||||
describe('getBounds', () => {
|
||||
it('should return valid bounds for multiple points', () => {
|
||||
const points = [
|
||||
[0, 20],
|
||||
[5, 25],
|
||||
[10, 15],
|
||||
];
|
||||
expect(getBounds(points)).toEqual([
|
||||
[0, 15],
|
||||
[10, 25],
|
||||
]);
|
||||
});
|
||||
it('should return valid bounds for single latitude point', () => {
|
||||
const points = [
|
||||
[0, 0],
|
||||
[5, 0],
|
||||
];
|
||||
expect(getBounds(points)).toEqual([
|
||||
[0, -0.25],
|
||||
[5, 0.25],
|
||||
]);
|
||||
});
|
||||
it('should return valid bounds for single longitude point', () => {
|
||||
const points = [
|
||||
[0, 0],
|
||||
[0, 5],
|
||||
];
|
||||
expect(getBounds(points)).toEqual([
|
||||
[-0.25, 0],
|
||||
[0.25, 5],
|
||||
]);
|
||||
});
|
||||
it('should return valid bounds for single point', () => {
|
||||
const points = [
|
||||
[0, 0],
|
||||
];
|
||||
expect(getBounds(points)).toEqual([
|
||||
[-0.25, -0.25],
|
||||
[0.25, 0.25],
|
||||
]);
|
||||
});
|
||||
it('should return valid bounds for point 90, 180', () => {
|
||||
const points = [
|
||||
[180, 90],
|
||||
];
|
||||
expect(getBounds(points)).toEqual([
|
||||
[179.75, 89.75],
|
||||
[180, 90],
|
||||
]);
|
||||
});
|
||||
it('should return valid bounds for point -90, -180', () => {
|
||||
const points = [
|
||||
[-180, -90],
|
||||
];
|
||||
expect(getBounds(points)).toEqual([
|
||||
[-180, -90],
|
||||
[-179.75, -89.75],
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user