From 6ba00f75b6f5e0be038f026ede2c99ac481a78b8 Mon Sep 17 00:00:00 2001 From: Arthur Almeida Date: Thu, 19 Apr 2018 10:59:12 -0300 Subject: [PATCH] unit tests --- test/specs/grapesjs/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/specs/grapesjs/index.js b/test/specs/grapesjs/index.js index 371301cb2..f89d0d666 100644 --- a/test/specs/grapesjs/index.js +++ b/test/specs/grapesjs/index.js @@ -382,7 +382,18 @@ describe('GrapesJS', () => { config.storageManager = { type: 0 }; fixture.innerHTML = documentEl; const editor = obj.init(config); - const css = editor.getCss({ dumpUnusedSelectors: 1 }); + const css = editor.getCss({ dumpUnusedStyles: 1 }); + const protCss = editor.getConfig().protectedCss; + expect(editor.getStyle().length).toEqual(2); + expect(css).toEqual(`${protCss}.test2{color:red;}.test3{color:blue;}`); + }); + + it('Dump unused css classes/selectors using the init option', () => { + config.fromElement = 1; + config.storageManager = { type: 0 }; + fixture.innerHTML = documentEl; + const editor = obj.init({ ...config, dumpUnusedStyles: 1 }); + const css = editor.getCss(); const protCss = editor.getConfig().protectedCss; expect(editor.getStyle().length).toEqual(2); expect(css).toEqual(`${protCss}.test2{color:red;}.test3{color:blue;}`);