Merge pull request #71 from tldraw/chore/small-test-adjustments
test: use jest's .todo method for TODO tests
This commit is contained in:
commit
e738018448
18 changed files with 40 additions and 48 deletions
|
@ -15,7 +15,9 @@ To support this project (and gain access to the project while it is in developme
|
|||
|
||||
## Documentation
|
||||
|
||||
In progress! Check the README files in packages/core and packages/tldraw.
|
||||
In progress! Check the README files in [packages/core](packages/core/README.md) and [packages/tldraw](packages/tldraw/README.md).
|
||||
|
||||
## Examples
|
||||
|
||||
- [@tldraw/core example](https://codesandbox.io/s/tldraw-core-example-88c74)
|
||||
- [@tldraw/tldraw example](https://codesandbox.io/s/tldraw-example-n539u)
|
||||
|
@ -24,7 +26,7 @@ In progress! Check the README files in packages/core and packages/tldraw.
|
|||
|
||||
### The tldraw packages
|
||||
|
||||
To work on the packages (@tldraw/core or @tldraw/tldraw), you'll want to run the (extremely fast) package dev server.
|
||||
To work on the packages (@tldraw/core or @tldraw/tldraw), you'll want to run the (extremely fast) dev server.
|
||||
|
||||
1. Download or clone the repository.
|
||||
|
||||
|
@ -46,7 +48,6 @@ To work on the packages (@tldraw/core or @tldraw/tldraw), you'll want to run the
|
|||
|
||||
4. Open the local site at `https://localhost:5000`.
|
||||
|
||||
|
||||
### The tldraw app
|
||||
|
||||
To work on the app itself (that embeds @tldraw/tldraw), run the Next.js app. This won't directly respond to changes to packages, so for concurrent package dev work be sure to use the package dev server instead. (This is being worked on.)
|
||||
|
|
|
@ -3,7 +3,7 @@ import { mockDocument, mockUtils } from '+test'
|
|||
import { render } from '@testing-library/react'
|
||||
import { Renderer } from './renderer'
|
||||
|
||||
describe('context menu', () => {
|
||||
describe('renderer', () => {
|
||||
test('mounts component without crashing', () => {
|
||||
render(
|
||||
<Renderer
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as React from 'react'
|
|||
import { mockUtils, renderWithSvg } from '+test'
|
||||
import { Shape } from './shape'
|
||||
|
||||
describe('handles', () => {
|
||||
describe('shape', () => {
|
||||
test('mounts component without crashing', () => {
|
||||
renderWithSvg(
|
||||
<Shape
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as React from 'react'
|
||||
import { Menu } from './menu'
|
||||
import { mockDocument, renderWithContext } from '~test'
|
||||
import { renderWithContext } from '~test'
|
||||
|
||||
describe('menu menu', () => {
|
||||
describe('menu', () => {
|
||||
test('mounts component without crashing', () => {
|
||||
renderWithContext(<Menu />)
|
||||
})
|
||||
|
|
|
@ -21,7 +21,7 @@ describe('Align command', () => {
|
|||
expect(tlstate.getShape('rect2').point).toEqual([100, 0])
|
||||
})
|
||||
|
||||
it('aligns left', () => {
|
||||
it('aligns top', () => {
|
||||
tlstate.loadDocument(mockDocument)
|
||||
tlstate.selectAll()
|
||||
tlstate.align(AlignType.Top)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { TLDrawState } from '~state'
|
||||
import { mockDocument } from '~test'
|
||||
|
||||
describe('Duplicate page', () => {
|
||||
describe('Duplicate page command', () => {
|
||||
const tlstate = new TLDrawState()
|
||||
|
||||
it('does, undoes and redoes command', () => {
|
||||
|
|
|
@ -2,7 +2,7 @@ import { TLDrawState } from '~state'
|
|||
import { mockDocument } from '~test'
|
||||
import type { RectangleShape } from '~types'
|
||||
|
||||
describe('Stretch command', () => {
|
||||
describe('Flip command', () => {
|
||||
const tlstate = new TLDrawState()
|
||||
|
||||
it('does, undoes and redoes command', () => {
|
||||
|
@ -29,7 +29,7 @@ describe('Stretch command', () => {
|
|||
expect(tlstate.getShape<RectangleShape>('rect1').point).toStrictEqual([100, 0])
|
||||
})
|
||||
|
||||
it('distributes vertically', () => {
|
||||
it('flips vertically', () => {
|
||||
tlstate.loadDocument(mockDocument)
|
||||
tlstate.select('rect1', 'rect2')
|
||||
tlstate.flipVertical()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { TLDrawState } from '~state'
|
||||
import { mockDocument } from '~test'
|
||||
|
||||
describe('Edit page', () => {
|
||||
describe('Rename page command', () => {
|
||||
const tlstate = new TLDrawState()
|
||||
|
||||
it('does, undoes and redoes command', () => {
|
||||
|
|
|
@ -30,7 +30,7 @@ describe('Stretch command', () => {
|
|||
expect(tlstate.getShape<RectangleShape>('rect2').size).toStrictEqual([200, 100])
|
||||
})
|
||||
|
||||
it('distributes horizontally', () => {
|
||||
it('stretches horizontally', () => {
|
||||
tlstate.loadDocument(mockDocument)
|
||||
tlstate.select('rect1', 'rect2')
|
||||
tlstate.stretch(StretchType.Horizontal)
|
||||
|
@ -41,7 +41,7 @@ describe('Stretch command', () => {
|
|||
expect(tlstate.getShape<RectangleShape>('rect2').size).toStrictEqual([200, 100])
|
||||
})
|
||||
|
||||
it('distributes vertically', () => {
|
||||
it('stretches vertically', () => {
|
||||
tlstate.loadDocument(mockDocument)
|
||||
tlstate.select('rect1', 'rect2')
|
||||
tlstate.stretch(StretchType.Vertical)
|
||||
|
|
|
@ -3,7 +3,7 @@ import { TLDrawState } from '~state'
|
|||
import { mockDocument } from '~test'
|
||||
import { ArrowShape, Decoration, TLDrawShape } from '~types'
|
||||
|
||||
describe('Handle command', () => {
|
||||
describe('Toggle decoration command', () => {
|
||||
const tlstate = new TLDrawState()
|
||||
|
||||
it('does, undoes and redoes command', () => {
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Utils } from '@tldraw/core'
|
|||
|
||||
const doc = Utils.deepClone(mockDocument)
|
||||
|
||||
describe('Move command', () => {
|
||||
describe('Update command', () => {
|
||||
const tlstate = new TLDrawState()
|
||||
|
||||
it('does, undoes and redoes command', () => {
|
||||
|
|
|
@ -159,12 +159,8 @@ describe('Arrow session', () => {
|
|||
expect(tlstate.getShape<ArrowShape>('arrow1').handles.end.point).toStrictEqual([85, 85])
|
||||
})
|
||||
|
||||
it('updates the arrow when bound on both sides', () => {
|
||||
// TODO
|
||||
})
|
||||
it.todo('updates the arrow when bound on both sides')
|
||||
|
||||
it('snaps the bend to zero when dragging the bend handle toward the center', () => {
|
||||
// TODO
|
||||
})
|
||||
it.todo('snaps the bend to zero when dragging the bend handle toward the center')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -2,7 +2,7 @@ import { TLDrawState } from '~state'
|
|||
import { mockDocument } from '~test'
|
||||
import { ColorStyle, DashStyle, SizeStyle, TLDrawShapeType, TLDrawStatus } from '~types'
|
||||
|
||||
describe('Transform session', () => {
|
||||
describe('Draw session', () => {
|
||||
const tlstate = new TLDrawState()
|
||||
|
||||
it('begins, updates and completes session', () => {
|
||||
|
|
|
@ -2,7 +2,7 @@ import { TLDrawState } from '~state'
|
|||
import { mockDocument } from '~test'
|
||||
import { TLDrawStatus } from '~types'
|
||||
|
||||
describe('Brush session', () => {
|
||||
describe('Rotate session', () => {
|
||||
const tlstate = new TLDrawState()
|
||||
|
||||
it('begins, updates and completes session', () => {
|
||||
|
|
|
@ -2,7 +2,7 @@ import { TLDrawState } from '~state'
|
|||
import { mockDocument } from '~test'
|
||||
import { ArrowShape, TLDrawShapeType, TLDrawStatus } from '~types'
|
||||
|
||||
describe('Brush session', () => {
|
||||
describe('Translate session', () => {
|
||||
const tlstate = new TLDrawState()
|
||||
|
||||
it('begins, updates and completes session', () => {
|
||||
|
@ -173,13 +173,7 @@ describe('Brush session', () => {
|
|||
// expect(tlstate.getShape<ArrowShape>('arrow1').handles.start.bindingId).toBe(undefined)
|
||||
})
|
||||
|
||||
// it('clones a shape with a parent shape', () => {
|
||||
// tlstate.loadDocument(mockDocument)
|
||||
// // TODO
|
||||
// })
|
||||
// it.todo('clones a shape with a parent shape')
|
||||
|
||||
// it('clones a shape with children', () => {
|
||||
// tlstate.loadDocument(mockDocument)
|
||||
// // TODO
|
||||
// })
|
||||
// it.todo('clones a shape with children')
|
||||
})
|
||||
|
|
|
@ -115,21 +115,13 @@ describe('TLDrawState', () => {
|
|||
expect(tlstate.appState.status.current).toBe('idle')
|
||||
})
|
||||
|
||||
it('deletes shapes if cancelled during creating', () => {
|
||||
// TODO
|
||||
})
|
||||
it.todo('deletes shapes if cancelled during creating')
|
||||
|
||||
it('deletes shapes on undo after creating', () => {
|
||||
// TODO
|
||||
})
|
||||
it.todo('deletes shapes on undo after creating')
|
||||
|
||||
it('re-creates shapes on undo after creating', () => {
|
||||
// TODO
|
||||
})
|
||||
it.todo('re-creates shapes on redo after creating')
|
||||
|
||||
it('selects all', () => {
|
||||
// TODO
|
||||
})
|
||||
it.todo('selects all')
|
||||
|
||||
// Single click on a selected shape to select just that shape
|
||||
|
||||
|
|
|
@ -2726,6 +2726,15 @@
|
|||
"@babel/runtime" "^7.12.5"
|
||||
"@testing-library/dom" "^8.0.0"
|
||||
|
||||
"@tldraw/core@^0.0.53":
|
||||
version "0.0.53"
|
||||
resolved "https://registry.yarnpkg.com/@tldraw/core/-/core-0.0.53.tgz#2db2b27df441169e452e0aa07570adca8b06b582"
|
||||
integrity sha512-hxZIUR3Sm320tvGW5lWEKfw1QJhe6mJu7IrG5ka5G3slusqaY3cQY9EafFqH07yEXul2MU2RENIQus7fh+Gwcg==
|
||||
dependencies:
|
||||
deepmerge "^4.2.2"
|
||||
ismobilejs "^1.1.1"
|
||||
react-use-gesture "^9.1.3"
|
||||
|
||||
"@tootallnate/once@1":
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
|
||||
|
|
Loading…
Reference in a new issue