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.

duplicate.command.spec.ts 603B

123456789101112131415161718192021222324
  1. import { TLDrawState } from '~state'
  2. import { mockDocument } from '~test-utils'
  3. describe('Duplicate command', () => {
  4. const tlstate = new TLDrawState()
  5. tlstate.loadDocument(mockDocument)
  6. tlstate.select('rect1')
  7. it('does, undoes and redoes command', () => {
  8. expect(Object.keys(tlstate.getPage().shapes).length).toBe(3)
  9. tlstate.duplicate()
  10. expect(Object.keys(tlstate.getPage().shapes).length).toBe(4)
  11. tlstate.undo()
  12. expect(Object.keys(tlstate.getPage().shapes).length).toBe(3)
  13. tlstate.redo()
  14. expect(Object.keys(tlstate.getPage().shapes).length).toBe(4)
  15. })
  16. })