From 608d33e16fd22f317f36f88a5e02a531fddb784f Mon Sep 17 00:00:00 2001 From: Arthur Almeida Date: Sat, 30 Sep 2017 12:13:10 -0300 Subject: [PATCH] added test to check if the a custom plugin can overrides a default command --- test/specs/grapesjs/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/specs/grapesjs/index.js b/test/specs/grapesjs/index.js index 813e237c5..0dd725512 100644 --- a/test/specs/grapesjs/index.js +++ b/test/specs/grapesjs/index.js @@ -229,6 +229,22 @@ describe('GrapesJS', () => { expect(editor.getDevice()).toEqual('Tablet'); }); + it('Init new editor with custom plugin override default commands', () => { + var editor, + pluginName = 'test-plugin-opts'; + + obj.plugins.add(pluginName, (edt, opts) => { + let cmdm = edt.Commands; + // Overwrite export template + cmdm.add('export-template', {test: 1}); + }); + config.plugins = [pluginName]; + + editor = obj.init(config); + editor.Commands.init() + expect(editor.Commands.get('export-template').test).toEqual(1); + }); + }); });