mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
@@ -16,6 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { JsonObject } from '@superset-ui/core';
|
||||
import {
|
||||
AnnotationLayer,
|
||||
AnnotationOpacity,
|
||||
@@ -25,7 +26,6 @@ import {
|
||||
buildQueryObject,
|
||||
QueryObject,
|
||||
} from '../../src/query';
|
||||
import { JsonObject } from '../../lib';
|
||||
|
||||
describe('buildQueryObject', () => {
|
||||
let query: QueryObject;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
import extractTimegrain from '@superset-ui/core/src/query/extractTimegrain';
|
||||
import { QueryFormData } from '../../lib';
|
||||
import { QueryFormData } from '@superset-ui/core';
|
||||
|
||||
describe('extractTimegrain', () => {
|
||||
const baseFormData: QueryFormData = {
|
||||
|
||||
@@ -44,6 +44,7 @@ describe('AnnotationLayer type guards', () => {
|
||||
value: 'sin(2*x)',
|
||||
style: AnnotationStyle.Solid,
|
||||
show: true,
|
||||
showLabel: false,
|
||||
};
|
||||
const eventAnnotationLayer: EventAnnotationLayer = {
|
||||
annotationType: AnnotationType.Event,
|
||||
@@ -51,6 +52,7 @@ describe('AnnotationLayer type guards', () => {
|
||||
value: 1,
|
||||
style: AnnotationStyle.Solid,
|
||||
show: true,
|
||||
showLabel: false,
|
||||
sourceType: AnnotationSourceType.Native,
|
||||
};
|
||||
const intervalAnnotationLayer: IntervalAnnotationLayer = {
|
||||
@@ -60,6 +62,7 @@ describe('AnnotationLayer type guards', () => {
|
||||
value: 1,
|
||||
style: AnnotationStyle.Solid,
|
||||
show: true,
|
||||
showLabel: false,
|
||||
};
|
||||
const timeseriesAnnotationLayer: TimeseriesAnnotationLayer = {
|
||||
annotationType: AnnotationType.Timeseries,
|
||||
@@ -68,6 +71,7 @@ describe('AnnotationLayer type guards', () => {
|
||||
value: 1,
|
||||
style: AnnotationStyle.Solid,
|
||||
show: true,
|
||||
showLabel: false,
|
||||
};
|
||||
const tableAnnotationLayer: TableAnnotationLayer = {
|
||||
annotationType: AnnotationType.Interval,
|
||||
@@ -76,6 +80,7 @@ describe('AnnotationLayer type guards', () => {
|
||||
value: 1,
|
||||
style: AnnotationStyle.Solid,
|
||||
show: true,
|
||||
showLabel: false,
|
||||
};
|
||||
const timeseriesAnnotationResult: TimeseriesAnnotationResult = [
|
||||
{
|
||||
|
||||
@@ -28,22 +28,22 @@ describe('smartDateDetailedFormatter', () => {
|
||||
});
|
||||
|
||||
it('shows only year when 1st day of the year', () => {
|
||||
expect(formatter(new Date('2020-01-01 0:00:00'))).toBe('2020');
|
||||
expect(formatter(new Date('2020-01-01T00:00:00.000+00:00'))).toBe('2020');
|
||||
});
|
||||
|
||||
it('shows full date when a regular date', () => {
|
||||
expect(formatter(new Date('2020-03-01 00:00:00'))).toBe('2020-03-01');
|
||||
expect(formatter(new Date('2020-03-01T00:00:00.000+00:00'))).toBe('2020-03-01');
|
||||
});
|
||||
|
||||
it('shows full date including time of day without seconds when hour precision', () => {
|
||||
expect(formatter(new Date('2020-03-01 13:00:00'))).toBe('2020-03-01 13:00');
|
||||
expect(formatter(new Date('2020-03-01T13:00:00.000+00:00'))).toBe('2020-03-01 13:00');
|
||||
});
|
||||
|
||||
it('shows full date including time of day when minute precision', () => {
|
||||
expect(formatter(new Date('2020-03-10 13:10:00'))).toBe('2020-03-10 13:10');
|
||||
expect(formatter(new Date('2020-03-10T13:10:00.000+00:00'))).toBe('2020-03-10 13:10');
|
||||
});
|
||||
|
||||
it('shows full date including time of day when subsecond precision', () => {
|
||||
expect(formatter(new Date('2020-03-10 13:10:00.1'))).toBe('2020-03-10 13:10:00.100');
|
||||
expect(formatter(new Date('2020-03-10T13:10:00.100+00:00'))).toBe('2020-03-10 13:10:00.100');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -33,6 +33,8 @@ export { default as EchartsFunnelChartPlugin } from './Funnel';
|
||||
export { default as EchartsTreeChartPlugin } from './Tree';
|
||||
export { default as EchartsTreemapChartPlugin } from './Treemap';
|
||||
|
||||
export * from './types';
|
||||
|
||||
/**
|
||||
* Note: this file exports the default export from EchartsTimeseries.tsx.
|
||||
* If you want to export multiple visualization modules, you will need to
|
||||
|
||||
@@ -132,3 +132,5 @@ export const DEFAULT_TITLE_FORM_DATA: EchartsTitleFormData = {
|
||||
yAxisTitleMargin: 0,
|
||||
yAxisTitlePosition: 'Top',
|
||||
};
|
||||
|
||||
export * from './Timeseries/types';
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
} from '../../src/utils/series';
|
||||
import { LegendOrientation, LegendType } from '../../src/types';
|
||||
import { defaultLegendPadding } from '../../src/defaults';
|
||||
import { NULL_STRING } from '../../lib/constants';
|
||||
import { NULL_STRING } from '../../src/constants';
|
||||
|
||||
describe('extractTimeseriesSeries', () => {
|
||||
it('should generate a valid ECharts timeseries series object', () => {
|
||||
|
||||
Reference in New Issue
Block a user