mirror of https://github.com/artf/grapesjs.git
3 changed files with 60 additions and 9 deletions
@ -0,0 +1,35 @@ |
|||||
|
import OpenLayers from '../../../../src/commands/view/OpenLayers'; |
||||
|
|
||||
|
describe('OpenLayers command', () => { |
||||
|
test('should show layers container when opened', () => { |
||||
|
const command = new OpenLayers({}); |
||||
|
const trigger = jest.fn(() => ({ trigger })); |
||||
|
const panel = { set: jest.fn(() => ({ trigger })) }; |
||||
|
const render = jest.fn(() => document.createElement('div')); |
||||
|
const editor = { |
||||
|
LayerManager: { |
||||
|
getConfig: jest.fn(() => ({})), |
||||
|
render, |
||||
|
}, |
||||
|
Panels: { |
||||
|
getPanel: jest.fn(() => panel), |
||||
|
addPanel: jest.fn(), |
||||
|
}, |
||||
|
} as any; |
||||
|
|
||||
|
command.run(editor); |
||||
|
|
||||
|
expect(panel.set).toHaveBeenCalled(); |
||||
|
expect(command.layers?.style.display).toBe('block'); |
||||
|
}); |
||||
|
|
||||
|
test('stop should hide layers container', () => { |
||||
|
const command = new OpenLayers({}); |
||||
|
command.layers = document.createElement('div'); |
||||
|
command.layers.style.display = 'block'; |
||||
|
|
||||
|
command.stop(); |
||||
|
|
||||
|
expect(command.layers.style.display).toBe('none'); |
||||
|
}); |
||||
|
}); |
||||
Loading…
Reference in new issue