update editor tests (#1547)
This PR renames our test files for tools. ### Change Type - [x] `tests` — Changes to any testing-related code only (will not publish a new version)
This commit is contained in:
parent
2372478556
commit
1531bfa81c
20 changed files with 33 additions and 27 deletions
|
@ -1,6 +1,6 @@
|
||||||
import { ArrowShapeTool } from '../editor/tools/ArrowShapeTool/ArrowShapeTool'
|
import { ArrowShapeTool } from '../editor/tools/ArrowShapeTool/ArrowShapeTool'
|
||||||
import { DrawShapeTool } from '../editor/tools/DrawShapeTool/DrawShapeTool'
|
import { DrawShapeTool } from '../editor/tools/DrawShapeTool/DrawShapeTool'
|
||||||
import { EraserShapeTool } from '../editor/tools/EraserShapeTool/EraserShapeTool'
|
import { EraserTool } from '../editor/tools/EraserTool/EraserTool'
|
||||||
import { FrameShapeTool } from '../editor/tools/FrameShapeTool/FrameShapeTool'
|
import { FrameShapeTool } from '../editor/tools/FrameShapeTool/FrameShapeTool'
|
||||||
import { GeoShapeTool } from '../editor/tools/GeoShapeTool/GeoShapeTool'
|
import { GeoShapeTool } from '../editor/tools/GeoShapeTool/GeoShapeTool'
|
||||||
import { HandTool } from '../editor/tools/HandTool/HandTool'
|
import { HandTool } from '../editor/tools/HandTool/HandTool'
|
||||||
|
@ -14,7 +14,7 @@ import { TextShapeTool } from '../editor/tools/TextShapeTool/TextShapeTool'
|
||||||
/** @public */
|
/** @public */
|
||||||
export const defaultTools: TLStateNodeConstructor[] = [
|
export const defaultTools: TLStateNodeConstructor[] = [
|
||||||
HandTool,
|
HandTool,
|
||||||
EraserShapeTool,
|
EraserTool,
|
||||||
LaserTool,
|
LaserTool,
|
||||||
DrawShapeTool,
|
DrawShapeTool,
|
||||||
TextShapeTool,
|
TextShapeTool,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Vec2d } from '@tldraw/primitives'
|
import { Vec2d } from '@tldraw/primitives'
|
||||||
import { createShapeId } from '@tldraw/tlschema'
|
import { createShapeId } from '@tldraw/tlschema'
|
||||||
import { TestEditor } from '../TestEditor'
|
import { TestEditor } from '../../../test/TestEditor'
|
||||||
|
|
||||||
let editor: TestEditor
|
let editor: TestEditor
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { DrawShapeTool } from '../../editor/tools/DrawShapeTool/DrawShapeTool'
|
import { TestEditor } from '../../../test/TestEditor'
|
||||||
import { TestEditor } from '../TestEditor'
|
import { DrawShapeTool } from './DrawShapeTool'
|
||||||
|
|
||||||
let editor: TestEditor
|
let editor: TestEditor
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { createShapeId } from '@tldraw/tlschema'
|
import { createShapeId } from '@tldraw/tlschema'
|
||||||
import { TestEditor } from '../TestEditor'
|
import { TestEditor } from '../../../test/TestEditor'
|
||||||
|
|
||||||
let editor: TestEditor
|
let editor: TestEditor
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Erasing } from './children/Erasing'
|
||||||
import { Idle } from './children/Idle'
|
import { Idle } from './children/Idle'
|
||||||
import { Pointing } from './children/Pointing'
|
import { Pointing } from './children/Pointing'
|
||||||
|
|
||||||
export class EraserShapeTool extends StateNode {
|
export class EraserTool extends StateNode {
|
||||||
static override id = 'eraser'
|
static override id = 'eraser'
|
||||||
static initial = 'idle'
|
static initial = 'idle'
|
||||||
static children = () => [Idle, Pointing, Erasing]
|
static children = () => [Idle, Pointing, Erasing]
|
|
@ -1,5 +1,5 @@
|
||||||
import { BaseBoxShapeTool } from '../../editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'
|
import { TestEditor } from '../../../test/TestEditor'
|
||||||
import { TestEditor } from '../TestEditor'
|
import { FrameShapeTool } from './FrameShapeTool'
|
||||||
|
|
||||||
let editor: TestEditor
|
let editor: TestEditor
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ afterEach(() => {
|
||||||
editor?.dispose()
|
editor?.dispose()
|
||||||
})
|
})
|
||||||
|
|
||||||
describe(BaseBoxShapeTool, () => {
|
describe(FrameShapeTool, () => {
|
||||||
it('Creates frame shapes on click-and-drag, supports undo and redo', () => {
|
it('Creates frame shapes on click-and-drag, supports undo and redo', () => {
|
||||||
expect(editor.shapesArray.length).toBe(0)
|
expect(editor.shapesArray.length).toBe(0)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { GeoShapeTool } from '../../editor/tools/GeoShapeTool/GeoShapeTool'
|
import { TestEditor } from '../../../test/TestEditor'
|
||||||
import { TestEditor } from '../TestEditor'
|
import { GeoShapeTool } from './GeoShapeTool'
|
||||||
|
|
||||||
let editor: TestEditor
|
let editor: TestEditor
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { HandTool } from '../../editor/tools/HandTool/HandTool'
|
import { createDefaultShapes, TestEditor } from '../../../test/TestEditor'
|
||||||
import { createDefaultShapes, TestEditor } from '../TestEditor'
|
import { HandTool } from './HandTool'
|
||||||
|
|
||||||
let editor: TestEditor
|
let editor: TestEditor
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
describe('Highlight shape tool', () => {
|
||||||
|
it.todo('tests the highlight shape tool')
|
||||||
|
})
|
|
@ -0,0 +1,3 @@
|
||||||
|
describe('Laser tool', () => {
|
||||||
|
it.todo('tests the laser tool')
|
||||||
|
})
|
|
@ -1,6 +1,6 @@
|
||||||
import { assert } from '@tldraw/utils'
|
import { assert } from '@tldraw/utils'
|
||||||
import { LineShapeUtil } from '../../editor/shapeutils/LineShapeUtil/LineShapeUtil'
|
import { TestEditor } from '../../../test/TestEditor'
|
||||||
import { TestEditor } from '../TestEditor'
|
import { LineShapeUtil } from '../../shapeutils/LineShapeUtil/LineShapeUtil'
|
||||||
|
|
||||||
let editor: TestEditor
|
let editor: TestEditor
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { NoteShapeTool } from '../../editor/tools/NoteShapeTool/NoteShapeTool'
|
import { TestEditor } from '../../../test/TestEditor'
|
||||||
import { TestEditor } from '../TestEditor'
|
import { NoteShapeTool } from './NoteShapeTool'
|
||||||
|
|
||||||
let editor: TestEditor
|
let editor: TestEditor
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { createShapeId } from '@tldraw/tlschema'
|
import { createShapeId } from '@tldraw/tlschema'
|
||||||
import { TestEditor } from '../TestEditor'
|
import { TestEditor } from '../../../test/TestEditor'
|
||||||
|
|
||||||
let editor: TestEditor
|
let editor: TestEditor
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { TextShapeTool } from '../../editor/tools/TextShapeTool/TextShapeTool'
|
import { TestEditor } from '../../../test/TestEditor'
|
||||||
import { TestEditor } from '../TestEditor'
|
import { TextShapeTool } from './TextShapeTool'
|
||||||
|
|
||||||
let editor: TestEditor
|
let editor: TestEditor
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { createShapeId } from '@tldraw/tlschema'
|
import { createShapeId } from '@tldraw/tlschema'
|
||||||
import { TestEditor } from '../TestEditor'
|
import { TestEditor } from '../../../test/TestEditor'
|
||||||
|
|
||||||
let editor: TestEditor
|
let editor: TestEditor
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { ArrowShapeUtil } from '../../editor/shapeutils/ArrowShapeUtil/ArrowShap
|
||||||
import { GroupShapeUtil } from '../../editor/shapeutils/GroupShapeUtil/GroupShapeUtil'
|
import { GroupShapeUtil } from '../../editor/shapeutils/GroupShapeUtil/GroupShapeUtil'
|
||||||
import { ArrowShapeTool } from '../../editor/tools/ArrowShapeTool/ArrowShapeTool'
|
import { ArrowShapeTool } from '../../editor/tools/ArrowShapeTool/ArrowShapeTool'
|
||||||
import { DrawShapeTool } from '../../editor/tools/DrawShapeTool/DrawShapeTool'
|
import { DrawShapeTool } from '../../editor/tools/DrawShapeTool/DrawShapeTool'
|
||||||
import { EraserShapeTool } from '../../editor/tools/EraserShapeTool/EraserShapeTool'
|
import { EraserTool } from '../../editor/tools/EraserTool/EraserTool'
|
||||||
import { LineShapeTool } from '../../editor/tools/LineShapeTool/LineShapeTool'
|
import { LineShapeTool } from '../../editor/tools/LineShapeTool/LineShapeTool'
|
||||||
import { NoteShapeTool } from '../../editor/tools/NoteShapeTool/NoteShapeTool'
|
import { NoteShapeTool } from '../../editor/tools/NoteShapeTool/NoteShapeTool'
|
||||||
import { TestEditor } from '../TestEditor'
|
import { TestEditor } from '../TestEditor'
|
||||||
|
@ -1444,7 +1444,7 @@ describe('erasing', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('erases whole groups if you hit one of their shapes', () => {
|
it('erases whole groups if you hit one of their shapes', () => {
|
||||||
editor.setSelectedTool(EraserShapeTool.id)
|
editor.setSelectedTool(EraserTool.id)
|
||||||
|
|
||||||
// erase D
|
// erase D
|
||||||
editor.pointerDown(65, 5, ids.boxD)
|
editor.pointerDown(65, 5, ids.boxD)
|
||||||
|
@ -1455,7 +1455,7 @@ describe('erasing', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('does not erase whole groups if you do not hit on one of their shapes', () => {
|
it('does not erase whole groups if you do not hit on one of their shapes', () => {
|
||||||
editor.setSelectedTool(EraserShapeTool.id)
|
editor.setSelectedTool(EraserTool.id)
|
||||||
|
|
||||||
editor.pointerDown(35, 5)
|
editor.pointerDown(35, 5)
|
||||||
expect(editor.erasingIdsSet.size).toBe(0)
|
expect(editor.erasingIdsSet.size).toBe(0)
|
||||||
|
@ -1466,7 +1466,7 @@ describe('erasing', () => {
|
||||||
expect(editor.focusLayerId === groupAId).toBe(true)
|
expect(editor.focusLayerId === groupAId).toBe(true)
|
||||||
const groupA = editor.getShapeById(groupAId)!
|
const groupA = editor.getShapeById(groupAId)!
|
||||||
|
|
||||||
editor.setSelectedTool(EraserShapeTool.id)
|
editor.setSelectedTool(EraserTool.id)
|
||||||
|
|
||||||
// erase B
|
// erase B
|
||||||
editor.pointerDown(25, 5, ids.boxB)
|
editor.pointerDown(25, 5, ids.boxB)
|
||||||
|
@ -1482,7 +1482,7 @@ describe('erasing', () => {
|
||||||
editor.select(ids.boxA)
|
editor.select(ids.boxA)
|
||||||
expect(editor.focusLayerId === groupAId).toBe(true)
|
expect(editor.focusLayerId === groupAId).toBe(true)
|
||||||
|
|
||||||
editor.setSelectedTool(EraserShapeTool.id)
|
editor.setSelectedTool(EraserTool.id)
|
||||||
|
|
||||||
// erase E
|
// erase E
|
||||||
editor.pointerDown(5, 25, ids.boxE)
|
editor.pointerDown(5, 25, ids.boxE)
|
||||||
|
|
Loading…
Reference in a new issue