Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
thiloSchlemmer committed Jan 23, 2025
1 parent beedad6 commit 7602eff
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class DrawToolContent extends AbstractToolContent {
collapsedInfo: null,
collapsedStyle: null,
description: null,
statistic: null,
selectedStyle: null,
mode: null,
validGeometry: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { $injector } from '../../../../../src/injection';
import { DrawToolContent } from '../../../../../src/modules/toolbox/components/drawToolContent/DrawToolContent';
import { AbstractToolContent } from '../../../../../src/modules/toolbox/components/toolContainer/AbstractToolContent';
import { drawReducer } from '../../../../../src/store/draw/draw.reducer';
import { setMode, setSelectedStyle, setStyle, setType } from '../../../../../src/store/draw/draw.action';
import { setMode, setSelectedStyle, setStatistic, setStyle, setType } from '../../../../../src/store/draw/draw.action';
import { EventLike } from '../../../../../src/utils/storeUtils';
import { modalReducer } from '../../../../../src/store/modal/modal.reducer';
import { IconResult } from '../../../../../src/services/IconService';
Expand Down Expand Up @@ -39,6 +39,8 @@ describe('DrawToolContent', () => {
reset: null
};

const defaultStatistic = { coordinate: null, azimuth: null, length: null, area: null };

const StyleOptionTemplate = {
symbolSrc: null,
scale: 0.5,
Expand Down Expand Up @@ -94,6 +96,7 @@ describe('DrawToolContent', () => {
type: null,
style: null,
description: null,
statistic: null,
selectedStyle: null,
mode: null,
validGeometry: null,
Expand Down Expand Up @@ -550,6 +553,20 @@ describe('DrawToolContent', () => {
expect(sanitizeSpy).toHaveBeenCalled();
});

it('sets the statistics in geometry-info, after statistic changes', async () => {
const element = await setup({ ...drawDefaultState, statistic: { defaultStatistic }, style: StyleOptionTemplate });
const actualStatistic = { ...defaultStatistic, length: 42 };
setType('line');
let geometryInfo = element.shadowRoot.querySelector('ba-geometry-info');
expect(geometryInfo).toBeTruthy();

setStatistic(actualStatistic);
geometryInfo = element.shadowRoot.querySelector('ba-geometry-info');

expect(element.getModel().statistic).toBe(actualStatistic);
expect(geometryInfo.statistics).toBe(actualStatistic);
});

it('sets the style-inputs for symbol-tool', async () => {
const style = { symbolSrc: null, color: '#f00ba3', scale: 'medium' };
const element = await setup({ ...drawDefaultState, style });
Expand Down Expand Up @@ -752,7 +769,7 @@ describe('DrawToolContent', () => {
expect(element.shadowRoot.querySelectorAll('.collapse-content:not(.iscollapse) ').length).toBe(0);
});

it('resets the measurement', async () => {
it('resets the drawing', async () => {
const element = await setup({ ...drawDefaultState, mode: 'draw', type: 'marker' });
const resetButton = element.shadowRoot.querySelector('#cancel-button');

Expand Down

0 comments on commit 7602eff

Please sign in to comment.