test: update unit test snapshot

This commit is contained in:
chenshenhai 2023-03-18 22:11:16 +08:00
parent 5a5b4708e1
commit b187d42341
3 changed files with 282 additions and 30 deletions

View file

@ -228,8 +228,8 @@ exports[`@idraw/board scroll 2`] = `
},
{
"props": {
"x": 2240,
"y": 1520,
"x": 2220,
"y": 1541,
},
"transform": [
1,
@ -245,9 +245,9 @@ exports[`@idraw/board scroll 2`] = `
"props": {
"cpx1": 2400,
"cpx2": 2400,
"cpy1": 1520,
"cpy2": 1600,
"radius": 40,
"cpy1": 1541,
"cpy2": 1581,
"radius": 20,
},
"transform": [
1,
@ -263,9 +263,9 @@ exports[`@idraw/board scroll 2`] = `
"props": {
"cpx1": 2400,
"cpx2": 2200,
"cpy1": 1600,
"cpy2": 1600,
"radius": 40,
"cpy1": 1581,
"cpy2": 1581,
"radius": 20,
},
"transform": [
1,
@ -281,9 +281,9 @@ exports[`@idraw/board scroll 2`] = `
"props": {
"cpx1": 2200,
"cpx2": 2200,
"cpy1": 1600,
"cpy2": 1520,
"radius": 40,
"cpy1": 1581,
"cpy2": 1541,
"radius": 20,
},
"transform": [
1,
@ -299,9 +299,9 @@ exports[`@idraw/board scroll 2`] = `
"props": {
"cpx1": 2200,
"cpx2": 2400,
"cpy1": 1520,
"cpy2": 1520,
"radius": 40,
"cpy1": 1541,
"cpy2": 1541,
"radius": 20,
},
"transform": [
1,
@ -337,6 +337,132 @@ exports[`@idraw/board scroll 2`] = `
],
"type": "fill",
},
{
"props": {
"path": [
{
"props": {},
"transform": [
1,
0,
0,
1,
0,
0,
],
"type": "beginPath",
},
{
"props": {
"x": 2220,
"y": 1541,
},
"transform": [
1,
0,
0,
1,
0,
0,
],
"type": "moveTo",
},
{
"props": {
"cpx1": 2400,
"cpx2": 2400,
"cpy1": 1541,
"cpy2": 1581,
"radius": 20,
},
"transform": [
1,
0,
0,
1,
0,
0,
],
"type": "arcTo",
},
{
"props": {
"cpx1": 2400,
"cpx2": 2200,
"cpy1": 1581,
"cpy2": 1581,
"radius": 20,
},
"transform": [
1,
0,
0,
1,
0,
0,
],
"type": "arcTo",
},
{
"props": {
"cpx1": 2200,
"cpx2": 2200,
"cpy1": 1581,
"cpy2": 1541,
"radius": 20,
},
"transform": [
1,
0,
0,
1,
0,
0,
],
"type": "arcTo",
},
{
"props": {
"cpx1": 2200,
"cpx2": 2400,
"cpy1": 1541,
"cpy2": 1541,
"radius": 20,
},
"transform": [
1,
0,
0,
1,
0,
0,
],
"type": "arcTo",
},
{
"props": {},
"transform": [
1,
0,
0,
1,
0,
0,
],
"type": "closePath",
},
],
},
"transform": [
1,
0,
0,
1,
0,
0,
],
"type": "stroke",
},
{
"props": {
"height": 1600,
@ -372,7 +498,7 @@ exports[`@idraw/board scroll 2`] = `
},
{
"props": {
"x": 2360,
"x": 2361,
"y": 1400,
},
"transform": [
@ -387,11 +513,11 @@ exports[`@idraw/board scroll 2`] = `
},
{
"props": {
"cpx1": 2400,
"cpx2": 2400,
"cpx1": 2381,
"cpx2": 2381,
"cpy1": 1400,
"cpy2": 1600,
"radius": 40,
"radius": 20,
},
"transform": [
1,
@ -405,11 +531,11 @@ exports[`@idraw/board scroll 2`] = `
},
{
"props": {
"cpx1": 2400,
"cpx2": 2320,
"cpx1": 2381,
"cpx2": 2341,
"cpy1": 1600,
"cpy2": 1600,
"radius": 40,
"radius": 20,
},
"transform": [
1,
@ -423,11 +549,11 @@ exports[`@idraw/board scroll 2`] = `
},
{
"props": {
"cpx1": 2320,
"cpx2": 2320,
"cpx1": 2341,
"cpx2": 2341,
"cpy1": 1600,
"cpy2": 1400,
"radius": 40,
"radius": 20,
},
"transform": [
1,
@ -441,11 +567,11 @@ exports[`@idraw/board scroll 2`] = `
},
{
"props": {
"cpx1": 2320,
"cpx2": 2400,
"cpx1": 2341,
"cpx2": 2381,
"cpy1": 1400,
"cpy2": 1400,
"radius": 40,
"radius": 20,
},
"transform": [
1,
@ -481,5 +607,131 @@ exports[`@idraw/board scroll 2`] = `
],
"type": "fill",
},
{
"props": {
"path": [
{
"props": {},
"transform": [
1,
0,
0,
1,
0,
0,
],
"type": "beginPath",
},
{
"props": {
"x": 2361,
"y": 1400,
},
"transform": [
1,
0,
0,
1,
0,
0,
],
"type": "moveTo",
},
{
"props": {
"cpx1": 2381,
"cpx2": 2381,
"cpy1": 1400,
"cpy2": 1600,
"radius": 20,
},
"transform": [
1,
0,
0,
1,
0,
0,
],
"type": "arcTo",
},
{
"props": {
"cpx1": 2381,
"cpx2": 2341,
"cpy1": 1600,
"cpy2": 1600,
"radius": 20,
},
"transform": [
1,
0,
0,
1,
0,
0,
],
"type": "arcTo",
},
{
"props": {
"cpx1": 2341,
"cpx2": 2341,
"cpy1": 1600,
"cpy2": 1400,
"radius": 20,
},
"transform": [
1,
0,
0,
1,
0,
0,
],
"type": "arcTo",
},
{
"props": {
"cpx1": 2341,
"cpx2": 2381,
"cpy1": 1400,
"cpy2": 1400,
"radius": 20,
},
"transform": [
1,
0,
0,
1,
0,
0,
],
"type": "arcTo",
},
{
"props": {},
"transform": [
1,
0,
0,
1,
0,
0,
],
"type": "closePath",
},
],
},
"transform": [
1,
0,
0,
1,
0,
0,
],
"type": "stroke",
},
]
`;

View file

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import Board from '../src';
import { getData } from './data';
@ -14,7 +15,7 @@ describe('@idraw/board', () => {
devicePixelRatio: 4,
canScroll: true,
scrollConfig: {
lineWidth: 20,
width: 20,
color: '#666666'
}
};
@ -63,6 +64,6 @@ describe('@idraw/board', () => {
expect(displayCalls).toMatchSnapshot();
const scrollLineWidth = board.getScrollLineWidth();
expect(scrollLineWidth).toStrictEqual(opts.scrollConfig.lineWidth);
expect(scrollLineWidth).toStrictEqual(opts.scrollConfig.width);
});
});

View file

@ -202,7 +202,6 @@ export class Scroller {
}
private _getOpts(opts: TypeOptions): TypePrivateOptions {
console.log('opts ====', opts);
const options: TypePrivateOptions = {
...opts,
...{