Skip to content

Commit

Permalink
fix test error
Browse files Browse the repository at this point in the history
  • Loading branch information
alanlong9278 committed Feb 10, 2020
1 parent cee0f8e commit 9e6c2cb
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
LoopIconSize,
ChoiceInputSize,
ChoiceInputMarginTop,
ChoiceInputMarginBottom,
} from '../../src/constants/ElementSizes';

describe('measureJsonBoundary', () => {
Expand All @@ -34,13 +35,23 @@ describe('measureJsonBoundary', () => {
);
});
it("should return boundary whose size is determined by the data's choices when json.$type is choiceInput", () => {
const data: { [key: string]: any } = {
const data1: { [key: string]: any } = {
$type: ObiTypes.ChoiceInputDetail,
choices: [{ value: '1' }],
};

expect(measureJsonBoundary(data)).toEqual(
new Boundary(InitNodeSize.width, InitNodeSize.height + ChoiceInputSize.height + ChoiceInputMarginTop)
const data2: { [key: string]: any } = {
$type: ObiTypes.ChoiceInputDetail,
choices: [{ value: '1' }, { value: '2' }, { value: '3' }, { value: '4' }, { value: '5' }],
};
expect(measureJsonBoundary(data1)).toEqual(
new Boundary(
InitNodeSize.width,
InitNodeSize.height + ChoiceInputSize.height + ChoiceInputMarginTop + ChoiceInputMarginBottom
)
);
expect(measureJsonBoundary(data2)).toEqual(
new Boundary(InitNodeSize.width, InitNodeSize.height + 4 * (ChoiceInputSize.height + ChoiceInputMarginTop))
);
});
});

0 comments on commit 9e6c2cb

Please sign in to comment.