|
|
|
@ -9,6 +9,7 @@ describe('Editor', () => { |
|
|
|
beforeEach(() => { |
|
|
|
editor = new Editor(); |
|
|
|
editor.init(); |
|
|
|
editor.getModel().loadOnStart(); |
|
|
|
}); |
|
|
|
|
|
|
|
afterEach(() => { |
|
|
|
@ -24,7 +25,7 @@ describe('Editor', () => { |
|
|
|
const allKeys = keys(all); |
|
|
|
// By default 1 wrapper components is created
|
|
|
|
expect(allKeys.length).toBe(initComps); |
|
|
|
expect(allKeys[0]).toBe('wrapper'); |
|
|
|
expect(all[allKeys[0]].get('type')).toBe('wrapper'); |
|
|
|
}); |
|
|
|
|
|
|
|
test('Has no CSS rules', () => { |
|
|
|
@ -41,7 +42,7 @@ describe('Editor', () => { |
|
|
|
const wrapper = editor.getWrapper(); |
|
|
|
const style = editor.getStyle(); |
|
|
|
const frame = editor.Canvas.getFrame(); |
|
|
|
expect(wrapper).toBe(frame.get('root')); |
|
|
|
expect(wrapper).toBe(frame.getComponent()); |
|
|
|
expect(style).toBe(frame.get('styles')); |
|
|
|
}); |
|
|
|
|
|
|
|
@ -72,7 +73,6 @@ describe('Editor', () => { |
|
|
|
}); |
|
|
|
|
|
|
|
test('Components are correctly tracked with UndoManager', () => { |
|
|
|
editor.Components.postLoad(); // Init UndoManager
|
|
|
|
const all = editor.Components.allById(); |
|
|
|
const um = editor.UndoManager; |
|
|
|
const umStack = um.getStack(); |
|
|
|
@ -88,7 +88,6 @@ describe('Editor', () => { |
|
|
|
}); |
|
|
|
|
|
|
|
test('Components are correctly tracked with UndoManager and mutiple operations', () => { |
|
|
|
editor.Components.postLoad(); // Init UndoManager
|
|
|
|
const all = editor.Components.allById(); |
|
|
|
const um = editor.UndoManager; |
|
|
|
const umStack = um.getStack(); |
|
|
|
@ -106,12 +105,11 @@ describe('Editor', () => { |
|
|
|
.components() |
|
|
|
.at(0) |
|
|
|
.remove(); // Remove 1 component
|
|
|
|
// UM registers 2 identical remove undoTypes as Backbone triggers remove from the
|
|
|
|
// collection and the model
|
|
|
|
expect(umStack.length).toBe(3); |
|
|
|
|
|
|
|
expect(umStack.length).toBe(2); |
|
|
|
expect(keys(all).length).toBe(3 + initComps); |
|
|
|
wrapper.empty(); |
|
|
|
expect(umStack.length).toBe(4); |
|
|
|
expect(umStack.length).toBe(3); |
|
|
|
expect(keys(all).length).toBe(initComps); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|