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:
Steve Ruiz 2023-06-07 08:31:00 +01:00 committed by GitHub
parent 2372478556
commit 1531bfa81c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 33 additions and 27 deletions

View file

@ -1,6 +1,6 @@
import { ArrowShapeTool } from '../editor/tools/ArrowShapeTool/ArrowShapeTool'
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 { GeoShapeTool } from '../editor/tools/GeoShapeTool/GeoShapeTool'
import { HandTool } from '../editor/tools/HandTool/HandTool'
@ -14,7 +14,7 @@ import { TextShapeTool } from '../editor/tools/TextShapeTool/TextShapeTool'
/** @public */
export const defaultTools: TLStateNodeConstructor[] = [
HandTool,
EraserShapeTool,
EraserTool,
LaserTool,
DrawShapeTool,
TextShapeTool,

View file

@ -1,6 +1,6 @@
import { Vec2d } from '@tldraw/primitives'
import { createShapeId } from '@tldraw/tlschema'
import { TestEditor } from '../TestEditor'
import { TestEditor } from '../../../test/TestEditor'
let editor: TestEditor

View file

@ -1,5 +1,5 @@
import { DrawShapeTool } from '../../editor/tools/DrawShapeTool/DrawShapeTool'
import { TestEditor } from '../TestEditor'
import { TestEditor } from '../../../test/TestEditor'
import { DrawShapeTool } from './DrawShapeTool'
let editor: TestEditor

View file

@ -1,5 +1,5 @@
import { createShapeId } from '@tldraw/tlschema'
import { TestEditor } from '../TestEditor'
import { TestEditor } from '../../../test/TestEditor'
let editor: TestEditor

View file

@ -4,7 +4,7 @@ import { Erasing } from './children/Erasing'
import { Idle } from './children/Idle'
import { Pointing } from './children/Pointing'
export class EraserShapeTool extends StateNode {
export class EraserTool extends StateNode {
static override id = 'eraser'
static initial = 'idle'
static children = () => [Idle, Pointing, Erasing]

View file

@ -1,5 +1,5 @@
import { BaseBoxShapeTool } from '../../editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'
import { TestEditor } from '../TestEditor'
import { TestEditor } from '../../../test/TestEditor'
import { FrameShapeTool } from './FrameShapeTool'
let editor: TestEditor
@ -10,7 +10,7 @@ afterEach(() => {
editor?.dispose()
})
describe(BaseBoxShapeTool, () => {
describe(FrameShapeTool, () => {
it('Creates frame shapes on click-and-drag, supports undo and redo', () => {
expect(editor.shapesArray.length).toBe(0)

View file

@ -1,5 +1,5 @@
import { GeoShapeTool } from '../../editor/tools/GeoShapeTool/GeoShapeTool'
import { TestEditor } from '../TestEditor'
import { TestEditor } from '../../../test/TestEditor'
import { GeoShapeTool } from './GeoShapeTool'
let editor: TestEditor

View file

@ -1,5 +1,5 @@
import { HandTool } from '../../editor/tools/HandTool/HandTool'
import { createDefaultShapes, TestEditor } from '../TestEditor'
import { createDefaultShapes, TestEditor } from '../../../test/TestEditor'
import { HandTool } from './HandTool'
let editor: TestEditor

View file

@ -0,0 +1,3 @@
describe('Highlight shape tool', () => {
it.todo('tests the highlight shape tool')
})

View file

@ -0,0 +1,3 @@
describe('Laser tool', () => {
it.todo('tests the laser tool')
})

View file

@ -1,6 +1,6 @@
import { assert } from '@tldraw/utils'
import { LineShapeUtil } from '../../editor/shapeutils/LineShapeUtil/LineShapeUtil'
import { TestEditor } from '../TestEditor'
import { TestEditor } from '../../../test/TestEditor'
import { LineShapeUtil } from '../../shapeutils/LineShapeUtil/LineShapeUtil'
let editor: TestEditor

View file

@ -1,5 +1,5 @@
import { NoteShapeTool } from '../../editor/tools/NoteShapeTool/NoteShapeTool'
import { TestEditor } from '../TestEditor'
import { TestEditor } from '../../../test/TestEditor'
import { NoteShapeTool } from './NoteShapeTool'
let editor: TestEditor

View file

@ -1,5 +1,5 @@
import { createShapeId } from '@tldraw/tlschema'
import { TestEditor } from '../TestEditor'
import { TestEditor } from '../../../test/TestEditor'
let editor: TestEditor

View file

@ -1,5 +1,5 @@
import { TextShapeTool } from '../../editor/tools/TextShapeTool/TextShapeTool'
import { TestEditor } from '../TestEditor'
import { TestEditor } from '../../../test/TestEditor'
import { TextShapeTool } from './TextShapeTool'
let editor: TestEditor

View file

@ -1,5 +1,5 @@
import { createShapeId } from '@tldraw/tlschema'
import { TestEditor } from '../TestEditor'
import { TestEditor } from '../../../test/TestEditor'
let editor: TestEditor

View file

@ -14,7 +14,7 @@ import { ArrowShapeUtil } from '../../editor/shapeutils/ArrowShapeUtil/ArrowShap
import { GroupShapeUtil } from '../../editor/shapeutils/GroupShapeUtil/GroupShapeUtil'
import { ArrowShapeTool } from '../../editor/tools/ArrowShapeTool/ArrowShapeTool'
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 { NoteShapeTool } from '../../editor/tools/NoteShapeTool/NoteShapeTool'
import { TestEditor } from '../TestEditor'
@ -1444,7 +1444,7 @@ describe('erasing', () => {
})
it('erases whole groups if you hit one of their shapes', () => {
editor.setSelectedTool(EraserShapeTool.id)
editor.setSelectedTool(EraserTool.id)
// erase D
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', () => {
editor.setSelectedTool(EraserShapeTool.id)
editor.setSelectedTool(EraserTool.id)
editor.pointerDown(35, 5)
expect(editor.erasingIdsSet.size).toBe(0)
@ -1466,7 +1466,7 @@ describe('erasing', () => {
expect(editor.focusLayerId === groupAId).toBe(true)
const groupA = editor.getShapeById(groupAId)!
editor.setSelectedTool(EraserShapeTool.id)
editor.setSelectedTool(EraserTool.id)
// erase B
editor.pointerDown(25, 5, ids.boxB)
@ -1482,7 +1482,7 @@ describe('erasing', () => {
editor.select(ids.boxA)
expect(editor.focusLayerId === groupAId).toBe(true)
editor.setSelectedTool(EraserShapeTool.id)
editor.setSelectedTool(EraserTool.id)
// erase E
editor.pointerDown(5, 25, ids.boxE)