better
This commit is contained in:
parent
b9485e4097
commit
0c0f08b350
45 changed files with 1565 additions and 1579 deletions
|
|
@ -6,7 +6,7 @@ import { CutDialog } from '../src/components/CutDialog';
|
|||
import { planSkirting } from '../src/lib/skirting';
|
||||
import { skirtingEndLabel } from '../src/lib/cut-list';
|
||||
import { defaultProject } from '../src/lib/defaults';
|
||||
import { dimensionedOutline, flooringTemplate, skirtingEndBoxes } from '../src/lib/cut-preview';
|
||||
import { dimensionedOutline, skirtingEndBoxes } from '../src/lib/cut-preview';
|
||||
import { cutMm, degree } from '../src/lib/format';
|
||||
import type { FlooringPiece, Point, SkirtingPiece } from '../src/lib/types';
|
||||
|
||||
|
|
@ -18,13 +18,23 @@ const floor: FlooringPiece = {
|
|||
polygon: [],
|
||||
length: 600.001,
|
||||
width: 190,
|
||||
blankLength: 600.5,
|
||||
blankWidth: 190,
|
||||
stockId: 'B1',
|
||||
reused: false,
|
||||
cut: true,
|
||||
shaped: false,
|
||||
template: [],
|
||||
template: [
|
||||
{ x: 0, y: 0 },
|
||||
{ x: 600.001, y: 0 },
|
||||
{ x: 600.001, y: 190 },
|
||||
{ x: 0, y: 190 },
|
||||
],
|
||||
factoryLeft: false,
|
||||
factoryRight: false,
|
||||
ripEdge: null,
|
||||
};
|
||||
const template: Point[] = [
|
||||
const template: SkirtingPiece['template'] = [
|
||||
{ x: 18, y: 0 },
|
||||
{ x: 1182, y: 0 },
|
||||
{ x: 1200, y: 18 },
|
||||
|
|
@ -38,6 +48,7 @@ const skirt: SkirtingPiece = {
|
|||
start: { x: 0, y: 0 },
|
||||
end: { x: 1164, y: 0 },
|
||||
length: 1200,
|
||||
blankLength: 1200,
|
||||
backLength: 1164,
|
||||
leftMitre: 45,
|
||||
rightMitre: 45,
|
||||
|
|
@ -45,11 +56,17 @@ const skirt: SkirtingPiece = {
|
|||
rightType: 'external',
|
||||
stockId: 'S1',
|
||||
template,
|
||||
installedTemplate: template,
|
||||
visibleLength: 1200,
|
||||
leftOverlap: 0,
|
||||
rightOverlap: 0,
|
||||
leftBevel: -45,
|
||||
rightBevel: 45,
|
||||
};
|
||||
|
||||
describe('cut shape previews', () => {
|
||||
it('keeps precise geometry while rounding displayed cuts up to half millimetres', () => {
|
||||
const points = flooringTemplate(floor);
|
||||
const points = floor.template;
|
||||
expect(points).toEqual([
|
||||
{ x: 0, y: 0 },
|
||||
{ x: 600.001, y: 0 },
|
||||
|
|
@ -73,6 +90,12 @@ describe('cut shape previews', () => {
|
|||
width: 190.1,
|
||||
blankLength: 597.2,
|
||||
blankWidth: 190.2,
|
||||
template: [
|
||||
{ x: 0, y: 0 },
|
||||
{ x: 597.2, y: 0 },
|
||||
{ x: 597.2, y: 190.1 },
|
||||
{ x: 0, y: 190.1 },
|
||||
],
|
||||
reused: true,
|
||||
};
|
||||
const markup = renderToStaticMarkup(createElement(FlooringPreview, { piece }));
|
||||
|
|
@ -289,8 +312,8 @@ describe('cut shape previews', () => {
|
|||
expect(skirtingEndLabel({ ...piece, rightType: 'internal', rightMitre: 30 }, 'right')).toBe(
|
||||
'Receive cope · wall-fit 30°',
|
||||
);
|
||||
const prepared = piece.template!;
|
||||
const installed = piece.installedTemplate!;
|
||||
const prepared = piece.template;
|
||||
const installed = piece.installedTemplate;
|
||||
expect(prepared[0].x).toBeLessThan(installed[0].x);
|
||||
expect(prepared[3].x).toBeCloseTo(installed[3].x);
|
||||
const compact = renderToStaticMarkup(
|
||||
|
|
|
|||
Loading…
Reference in a new issue