From f28afa90c0e2873fc077fae55881270381dc6ea3 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Wed, 4 Aug 2021 10:48:09 +0200 Subject: [PATCH] Add headless style test --- test/specs/grapesjs/headless.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/specs/grapesjs/headless.js b/test/specs/grapesjs/headless.js index 462438ef5..95f32fd12 100644 --- a/test/specs/grapesjs/headless.js +++ b/test/specs/grapesjs/headless.js @@ -34,6 +34,16 @@ describe('GrapesJS Headless', () => { expect(editor.getCss()).toBe(editor.getConfig().protectedCss); // same as default }); - test('Add styles', () => {}); + test('Add styles', () => { + const res = editor.addStyle({ + selectors: [{ name: 'gjs-row' }], + style: { color: 'red' } + }); + expect(res.length).toBe(1); + const rule = res[0]; + const result = '.gjs-row{color:red;}'; + expect(rule.toCSS()).toBe(result); + expect(editor.Selectors.getAll().length).toBe(1); // 1 selector is created + }); }); });