You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rotate.command.spec.ts 605B

123456789101112131415161718192021222324
  1. import { TLDrawState } from '~state'
  2. import { mockDocument } from '~test-utils'
  3. describe('Rotate command', () => {
  4. const tlstate = new TLDrawState()
  5. tlstate.loadDocument(mockDocument)
  6. tlstate.select('rect1')
  7. it('does, undoes and redoes command', () => {
  8. expect(tlstate.getShape('rect1').rotation).toBe(undefined)
  9. tlstate.rotate()
  10. expect(tlstate.getShape('rect1').rotation).toBe(Math.PI * (6 / 4))
  11. tlstate.undo()
  12. expect(tlstate.getShape('rect1').rotation).toBe(undefined)
  13. tlstate.redo()
  14. expect(tlstate.getShape('rect1').rotation).toBe(Math.PI * (6 / 4))
  15. })
  16. })