123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- import { ShapeType } from 'types'
- import TestState from '../test-utils'
-
- describe('draw shape', () => {
- const tt = new TestState()
- tt.resetDocumentState().save()
-
- describe('creating draws', () => {
- it('creates shape', () => {
- tt.reset().restore().send('SELECTED_DRAW_TOOL')
-
- expect(tt.state.isIn('draw.creating')).toBe(true)
-
- tt.startClick('canvas').movePointerBy([100, 100]).stopClick('canvas')
-
- const id = tt.getSortedPageShapeIds()[0]
-
- tt.assertShapeType(id, ShapeType.Draw)
- })
-
- it('creates shapes when pointing a shape', () => {
- tt.reset().restore().send('SELECTED_DRAW_TOOL').send('TOGGLED_TOOL_LOCK')
-
- tt.startClick('canvas').movePointerBy([100, 100]).stopClick('canvas')
- tt.startClick('canvas').movePointerBy([-200, 100]).stopClick('canvas')
-
- expect(tt.getSortedPageShapeIds()).toHaveLength(2)
- })
-
- it('creates shapes when shape locked', () => {
- tt.reset()
- .restore()
- .createShape(
- {
- type: ShapeType.Rectangle,
- point: [0, 0],
- size: [100, 100],
- childIndex: 1,
- },
- 'rect1'
- )
- .send('SELECTED_DRAW_TOOL')
-
- tt.startClick('rect1').movePointerBy([100, 100]).stopClick('canvas')
-
- expect(tt.getSortedPageShapeIds()).toHaveLength(2)
- })
-
- it('cancels shape while creating', () => {
- // TODO
- null
- })
- })
-
- it('moves shape', () => {
- // TODO
- null
- })
-
- it('rotates shape', () => {
- // TODO
- null
- })
-
- it('rotates shape in a group', () => {
- // TODO
- null
- })
-
- it('measures shape bounds', () => {
- // TODO
- null
- })
-
- it('measures shape rotated bounds', () => {
- // TODO
- null
- })
-
- it('transforms single shape', () => {
- // TODO
- null
- })
-
- it('transforms in a group', () => {
- // TODO
- null
- })
-
- /* -------------------- Specific -------------------- */
-
- it('closes the shape when the start and end points are near enough', () => {
- // TODO
- null
- })
-
- it('remains closed after resizing up', () => {
- // TODO
- null
- })
- })
|