-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(api): auotFit sizeOf width > auto width > default width (#6013)
* fix(api): auotFit sizeOf width > auto width > default width * fix(api): auotFit sizeOf width > auto width > default width --------- Co-authored-by: wb-xcf804241 <[email protected]>
- Loading branch information
1 parent
039716f
commit 0f992d2
Showing
8 changed files
with
3,308 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { chartAutoFitHeight as render } from '../plots/api'; | ||
import { createNodeGCanvas } from './utils/createNodeGCanvas'; | ||
import { sleep } from './utils/sleep'; | ||
import { kebabCase } from './utils/kebabCase'; | ||
import './utils/useSnapshotMatchers'; | ||
|
||
describe('chart.options.autoFit', () => { | ||
const dir = `${__dirname}/snapshots/api/${kebabCase(render.name)}`; | ||
const canvas = createNodeGCanvas(800, 500); | ||
|
||
it('chart({ autoFit: true, height: 200 }) should fit parent container width and custom height', async () => { | ||
const { finished } = render({ | ||
canvas, | ||
container: document.createElement('div'), | ||
}); | ||
await finished; | ||
await sleep(20); | ||
await expect(canvas).toMatchDOMSnapshot(dir, 'step0'); | ||
}); | ||
|
||
afterAll(() => { | ||
canvas?.destroy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { chartAutoFitWidth as render } from '../plots/api'; | ||
import { createNodeGCanvas } from './utils/createNodeGCanvas'; | ||
import { sleep } from './utils/sleep'; | ||
import { kebabCase } from './utils/kebabCase'; | ||
import './utils/useSnapshotMatchers'; | ||
|
||
describe('chart.options.autoFit', () => { | ||
const dir = `${__dirname}/snapshots/api/${kebabCase(render.name)}`; | ||
const canvas = createNodeGCanvas(800, 500); | ||
|
||
it('chart({ autoFit: true, width: 200 }) should fit parent container height and custom width', async () => { | ||
const { finished } = render({ | ||
canvas, | ||
container: document.createElement('div'), | ||
}); | ||
|
||
await finished; | ||
await sleep(20); | ||
await expect(canvas).toMatchDOMSnapshot(dir, 'step0'); | ||
}); | ||
|
||
afterAll(() => { | ||
canvas?.destroy(); | ||
}); | ||
}); |
Oops, something went wrong.