Skip to content

Commit

Permalink
fixed test snapshots and rangeMax.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuznietsov committed Mar 2, 2022
1 parent ddb1a09 commit e5c10d2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jest.mock('@elastic/charts', () => {
});

const chartsThemeService = chartPluginMock.createSetupContract().theme;
const paletteThemeService = chartPluginMock.createSetupContract().palettes;
const formatService = fieldFormatsServiceMock.createStartContract();
const args: GaugeArguments = {
labelMajor: 'Gauge',
Expand Down Expand Up @@ -81,12 +82,13 @@ const createData = (
describe('GaugeComponent', function () {
let wrapperProps: GaugeRenderProps;

beforeAll(() => {
beforeAll(async () => {
wrapperProps = {
data: createData(),
chartsThemeService,
args,
formatFactory: formatService.deserialize,
paletteService: await paletteThemeService.getPalettes(),
};
});

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/vis_types/gauge/public/to_ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export const toExpressionAst: VisToExpressionAst<GaugeVisParams> = (vis, params)
range: percentageMode ? 'percent' : 'number',
continuity: 'none',
gradient: true,
rangeMax: percentageMode ? 100 : Infinity,
rangeMin: 0,
rangeMax: percentageMode ? 100 : stopsWithColors.stop[stopsWithColors.stop.length - 1],
rangeMin: stopsWithColors.stop[0],
});

gauge.addArgument('palette', buildExpression([palette]));
Expand Down

0 comments on commit e5c10d2

Please sign in to comment.