Skip to content

Commit

Permalink
add tests update storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
camray committed Jul 6, 2022
1 parent 3ff8fe7 commit 33b3fe5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/victory-core/src/victory-util/textsize.test.ts
Expand Up @@ -16,6 +16,15 @@ describe("victory-util/textsize", () => {
});

describe("approximateWidth", () => {
const { window } = global;
beforeAll(() => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete global.window;
});
afterAll(() => {
global.window = window;
});
it("return zero width when no style", () => {
expect(TextSize.approximateTextSize(testString).width).toEqual(0);
});
Expand Down
20 changes: 20 additions & 0 deletions stories/victory-label.stories.js
Expand Up @@ -415,6 +415,26 @@ export const LineHeight = () => {
/>
}
/>
<VictoryScatter
{...defaultScatterProps}
labelComponent={
<VictoryLabel
lineHeight={[2, 1, 3]}
text={["测试汉字", "不在正常的 ASCII 范围内", "最后一行"]}
backgroundStyle={[{ stroke: "blue", fill: "none" }]}
/>
}
/>
<VictoryScatter
{...defaultScatterProps}
labelComponent={
<VictoryLabel
lineHeight={[2, 1, 3]}
text={["اختبار اللغات التي تُقرأ من اليمين إلى اليسار", "مثل العربية", "هناك أكثر من ذلك بكثير"]}
backgroundStyle={[{ stroke: "blue", fill: "none" }]}
/>
}
/>
</div>
);
};
Expand Down

0 comments on commit 33b3fe5

Please sign in to comment.