From e8e76476b996bd4cd2e23ad6d2259b7f6400a7a3 Mon Sep 17 00:00:00 2001 From: Arthur Almeida Date: Thu, 19 Apr 2018 10:32:06 -0300 Subject: [PATCH] added unit testing to dump unused css selectors --- test/specs/grapesjs/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/specs/grapesjs/index.js b/test/specs/grapesjs/index.js index c4ad136d1..371301cb2 100644 --- a/test/specs/grapesjs/index.js +++ b/test/specs/grapesjs/index.js @@ -376,5 +376,16 @@ describe('GrapesJS', () => { editor = obj.init(config); expect(editor.Commands.get('export-template').test).toEqual(1); }); + + it('Dump unused css classes/selectors', () => { + config.fromElement = 1; + config.storageManager = { type: 0 }; + fixture.innerHTML = documentEl; + const editor = obj.init(config); + const css = editor.getCss({ dumpUnusedSelectors: 1 }); + const protCss = editor.getConfig().protectedCss; + expect(editor.getStyle().length).toEqual(2); + expect(css).toEqual(`${protCss}.test2{color:red;}.test3{color:blue;}`); + }); }); });