diff --git a/test/main.test.js b/test/main.test.js index ddbb4ae840..c534670187 100644 --- a/test/main.test.js +++ b/test/main.test.js @@ -2,7 +2,7 @@ import grapesjs from './../src'; describe('Main', () => { describe('Startup', () => { - it('Main object should be loaded', () => { + test('Main object should be loaded', () => { expect(grapesjs).toBeTruthy(); }); }); diff --git a/test/specs/asset_manager/index.js b/test/specs/asset_manager/index.js index 2a043a4eb1..ebd0050a23 100644 --- a/test/specs/asset_manager/index.js +++ b/test/specs/asset_manager/index.js @@ -35,20 +35,20 @@ describe('Asset Manager', () => { obj = null; }); - it('Object exists', () => { + test('Object exists', () => { expect(obj).toExist(); }); - it('No assets inside', () => { + test('No assets inside', () => { expect(obj.getAll().length).toEqual(0); }); - it('Add new asset', () => { + test('Add new asset', () => { obj.add(imgObj); expect(obj.getAll().length).toEqual(1); }); - it('Added asset has correct data', () => { + test('Added asset has correct data', () => { obj.add(imgObj); var asset = obj.get(imgObj.src); expect(asset.get('width')).toEqual(imgObj.width); @@ -56,14 +56,14 @@ describe('Asset Manager', () => { expect(asset.get('type')).toEqual(imgObj.type); }); - it('Add asset with src', () => { + test('Add asset with src', () => { obj.add(imgObj.src); var asset = obj.get(imgObj.src); expect(asset.get('type')).toEqual('image'); expect(asset.get('src')).toEqual(imgObj.src); }); - it('Add asset with more src', () => { + test('Add asset with more src', () => { obj.add([imgObj.src, imgObj.src + '2']); expect(obj.getAll().length).toEqual(2); var asset1 = obj.getAll().at(0); @@ -72,13 +72,13 @@ describe('Asset Manager', () => { expect(asset2.get('src')).toEqual(imgObj.src + '2'); }); - it('Remove asset', () => { + test('Remove asset', () => { obj.add(imgObj); obj.remove(imgObj.src); expect(obj.getAll().length).toEqual(0); }); - it('Render assets', () => { + test('Render assets', () => { obj.add(imgObj); expect(obj.render()).toExist(); }); @@ -103,7 +103,7 @@ describe('Asset Manager', () => { storageManager = null; }); - it('Store and load data', () => { + test('Store and load data', () => { obj.add(imgObj); obj.store(); obj.remove(imgObj.src); diff --git a/test/specs/asset_manager/model/Asset.js b/test/specs/asset_manager/model/Asset.js index 091c887a88..f65f5162bf 100644 --- a/test/specs/asset_manager/model/Asset.js +++ b/test/specs/asset_manager/model/Asset.js @@ -3,11 +3,11 @@ var Asset = require('asset_manager/model/Asset'); module.exports = { run() { describe('Asset', () => { - it('Object exists', () => { + test('Object exists', () => { expect(Asset).toExist(); }); - it('Has default values', () => { + test('Has default values', () => { var obj = new Asset({}); expect(obj.get('type')).toNotExist(); expect(obj.get('src')).toNotExist(); @@ -15,14 +15,14 @@ module.exports = { expect(obj.getFilename()).toNotExist(); }); - it('Test getFilename', () => { + test('Test getFilename', () => { var obj = new Asset({ type: 'image', src: 'ch/eck/t.e.s.t' }); expect(obj.getFilename()).toEqual('t.e.s.t'); var obj = new Asset({ type: 'image', src: 'ch/eck/1234abc' }); expect(obj.getFilename()).toEqual('1234abc'); }); - it('Test getExtension', () => { + test('Test getExtension', () => { var obj = new Asset({ type: 'image', src: 'ch/eck/t.e.s.t' }); expect(obj.getExtension()).toEqual('t'); var obj = new Asset({ type: 'image', src: 'ch/eck/1234abc.' }); diff --git a/test/specs/asset_manager/model/AssetImage.js b/test/specs/asset_manager/model/AssetImage.js index 25409a43fd..81c9ebf8af 100644 --- a/test/specs/asset_manager/model/AssetImage.js +++ b/test/specs/asset_manager/model/AssetImage.js @@ -3,11 +3,11 @@ var AssetImage = require('asset_manager/model/AssetImage'); module.exports = { run() { describe('AssetImage', () => { - it('Object exists', () => { + test('Object exists', () => { expect(AssetImage).toExist(); }); - it('Has default values', () => { + test('Has default values', () => { var obj = new AssetImage({}); expect(obj.get('type')).toEqual('image'); expect(obj.get('src')).toNotExist(); diff --git a/test/specs/asset_manager/model/Assets.js b/test/specs/asset_manager/model/Assets.js index 545ec30136..77d0553407 100644 --- a/test/specs/asset_manager/model/Assets.js +++ b/test/specs/asset_manager/model/Assets.js @@ -13,11 +13,11 @@ module.exports = { obj = null; }); - it('Object exists', () => { + test('Object exists', () => { expect(obj).toExist(); }); - it('Collection is empty', () => { + test('Collection is empty', () => { expect(obj.length).toEqual(0); }); }); diff --git a/test/specs/asset_manager/view/AssetImageView.js b/test/specs/asset_manager/view/AssetImageView.js index 58acceda48..5919d035b1 100644 --- a/test/specs/asset_manager/view/AssetImageView.js +++ b/test/specs/asset_manager/view/AssetImageView.js @@ -7,7 +7,7 @@ module.exports = { let obj; describe('AssetImageView', () => { - beforeEach(function() { + beforeEach(() => { var coll = new Assets(); var model = coll.add({ type: 'image', src: '/test' }); obj = new AssetImageView({ @@ -19,40 +19,40 @@ module.exports = { document.body.querySelector('#fixtures').appendChild(obj.render().el); }); - afterEach(function() { + afterEach(() => { obj = null; document.body.innerHTML = ''; }); - it('Object exists', () => { + test('Object exists', () => { expect(AssetImageView).toExist(); }); describe('Asset should be rendered correctly', () => { - it('Has preview box', function() { + test('Has preview box', () => { var $asset = obj.$el; expect($asset.find('.preview').length).toEqual(1); }); - it('Has meta box', function() { + test('Has meta box', () => { var $asset = obj.$el; expect($asset.find('.meta').length).toEqual(1); }); - it('Has close button', function() { + test('Has close button', () => { var $asset = obj.$el; expect($asset.find('[data-toggle=asset-remove]').length).toEqual(1); }); }); - it('Could be selected', function() { + test('Could be selected', () => { var spy = expect.spyOn(obj, 'updateTarget'); obj.$el.trigger('click'); expect(obj.$el.attr('class')).toInclude('highlight'); expect(spy).toHaveBeenCalled(); }); - it('Could be chosen', function() { + test('Could be chosen', () => { sinon.stub(obj, 'updateTarget'); var spy = expect.spyOn(obj, 'updateTarget'); obj.$el.trigger('dblclick'); @@ -60,7 +60,7 @@ module.exports = { //obj.updateTarget.calledOnce.should.equal(true); }); - it('Could be removed', function() { + test('Could be removed', () => { var spy = sinon.spy(); obj.model.on('remove', spy); obj.onRemove({ stopImmediatePropagation() {} }); diff --git a/test/specs/asset_manager/view/AssetView.js b/test/specs/asset_manager/view/AssetView.js index 677cdf3889..3de289f0d7 100644 --- a/test/specs/asset_manager/view/AssetView.js +++ b/test/specs/asset_manager/view/AssetView.js @@ -5,29 +5,35 @@ var Assets = require('asset_manager/model/Assets'); module.exports = { run() { describe('AssetView', () => { - beforeEach(function() { + let testContext; + + beforeEach(() => { + testContext = {}; + }); + + beforeEach(() => { var coll = new Assets(); var model = coll.add({ src: 'test' }); - this.view = new AssetView({ + testContext.view = new AssetView({ config: {}, model }); document.body.innerHTML = '
'; document.body .querySelector('#fixtures') - .appendChild(this.view.render().el); + .appendChild(testContext.view.render().el); }); - afterEach(function() { - this.view.remove(); + afterEach(() => { + testContext.view.remove(); }); - it('Object exists', () => { + test('Object exists', () => { expect(AssetView).toExist(); }); - it('Has correct prefix', function() { - expect(this.view.pfx).toEqual(''); + test('Has correct prefix', () => { + expect(testContext.view.pfx).toEqual(''); }); }); } diff --git a/test/specs/asset_manager/view/AssetsView.js b/test/specs/asset_manager/view/AssetsView.js index 3a1bdb8433..31538716b3 100644 --- a/test/specs/asset_manager/view/AssetsView.js +++ b/test/specs/asset_manager/view/AssetsView.js @@ -8,7 +8,7 @@ module.exports = { var obj; var coll; - beforeEach(function() { + beforeEach(() => { coll = new Assets([]); obj = new AssetsView({ config: {}, @@ -22,43 +22,43 @@ module.exports = { document.body.querySelector('#fixtures').appendChild(obj.el); }); - afterEach(function() { + afterEach(() => { obj.collection.reset(); }); - it('Object exists', () => { + test('Object exists', () => { expect(AssetsView).toExist(); }); - it('Collection is empty', function() { + test('Collection is empty', () => { expect(obj.getAssetsEl().innerHTML).toNotExist(); }); - it('Add new asset', function() { + test('Add new asset', () => { sinon.stub(obj, 'addAsset'); coll.add({ src: 'test' }); expect(obj.addAsset.calledOnce).toEqual(true); }); - it('Render new asset', function() { + test('Render new asset', () => { coll.add({ src: 'test' }); expect(obj.getAssetsEl().innerHTML).toExist(); }); - it('Render correctly new image asset', function() { + test('Render correctly new image asset', () => { coll.add({ type: 'image', src: 'test' }); var asset = obj.getAssetsEl().firstChild; expect(asset.tagName).toEqual('DIV'); expect(asset.innerHTML).toExist(); }); - it('Clean collection from asset', function() { + test('Clean collection from asset', () => { var model = coll.add({ src: 'test' }); coll.remove(model); expect(obj.getAssetsEl().innerHTML).toNotExist(); }); - it('Deselect works', function() { + test('Deselect works', () => { coll.add([{}, {}]); var $asset = obj.$el.children().first(); $asset.attr('class', obj.pfx + 'highlight'); @@ -66,15 +66,15 @@ module.exports = { expect($asset.attr('class')).toNotExist(); }); - it('Returns not empty assets element', () => { + test('Returns not empty assets element', () => { expect(obj.getAssetsEl()).toExist(); }); - it('Returns not empty url input', () => { + test('Returns not empty url input', () => { expect(obj.getAddInput()).toExist(); }); - it('Add image asset from input string', () => { + test('Add image asset from input string', () => { obj.getAddInput().value = 'test'; obj.handleSubmit({ preventDefault() {} diff --git a/test/specs/asset_manager/view/FileUploader.js b/test/specs/asset_manager/view/FileUploader.js index b7a381b806..6680a3c780 100644 --- a/test/specs/asset_manager/view/FileUploader.js +++ b/test/specs/asset_manager/view/FileUploader.js @@ -5,38 +5,38 @@ module.exports = { describe('File Uploader', () => { let obj; - beforeEach(function() { + beforeEach(() => { obj = new FileUploader({ config: {} }); document.body.innerHTML = '
'; document.body.querySelector('#fixtures').appendChild(obj.render().el); }); - afterEach(function() { + afterEach(() => { obj.remove(); }); - it('Object exists', () => { + test('Object exists', () => { expect(FileUploader).toExist(); }); - it('Has correct prefix', function() { + test('Has correct prefix', () => { expect(obj.pfx).toNotExist(); }); describe('Should be rendered correctly', () => { - it('Has title', function() { + test('Has title', () => { expect(obj.$el.find('#title').length).toEqual(1); }); - it('Title is empty', function() { + test('Title is empty', () => { expect(obj.$el.find('#title').html()).toEqual(''); }); - it('Has file input', function() { + test('Has file input', () => { expect(obj.$el.find('input[type=file]').length).toEqual(1); }); - it('File input is enabled', function() { + test('File input is enabled', () => { expect(obj.$el.find('input[type=file]').prop('disabled')).toEqual( true ); @@ -44,7 +44,7 @@ module.exports = { }); describe('Interprets configurations correctly', () => { - it('Has correct title', () => { + test('Has correct title', () => { var view = new FileUploader({ config: { uploadText: 'Test' @@ -54,7 +54,7 @@ module.exports = { expect(view.$el.find('#title').html()).toEqual('Test'); }); - it('Could be disabled', () => { + test('Could be disabled', () => { var view = new FileUploader({ config: { disableUpload: true, @@ -67,7 +67,7 @@ module.exports = { ); }); - it('Handles embedAsBase64 parameter', () => { + test('Handles embedAsBase64 parameter', () => { var view = new FileUploader({ config: { embedAsBase64: true diff --git a/test/specs/block_manager/index.js b/test/specs/block_manager/index.js index 3f242729ae..04ff88f881 100644 --- a/test/specs/block_manager/index.js +++ b/test/specs/block_manager/index.js @@ -21,48 +21,48 @@ describe('BlockManager', () => { obj = null; }); - it('Object exists', () => { + test('Object exists', () => { expect(obj).toExist(); }); - it('No blocks inside', () => { + test('No blocks inside', () => { expect(obj.getAll().length).toEqual(0); }); - it('No categories inside', () => { + test('No categories inside', () => { expect(obj.getCategories().length).toEqual(0); }); - it('Add new block', () => { + test('Add new block', () => { var model = obj.add(idTest, optsTest); expect(obj.getAll().length).toEqual(1); }); - it('Added block has correct data', () => { + test('Added block has correct data', () => { var model = obj.add(idTest, optsTest); expect(model.get('label')).toEqual(optsTest.label); expect(model.get('content')).toEqual(optsTest.content); }); - it('Add block with attributes', () => { + test('Add block with attributes', () => { optsTest.attributes = { class: 'test' }; var model = obj.add(idTest, optsTest); expect(model.get('attributes').class).toEqual('test'); }); - it('The id of the block is unique', () => { + test('The id of the block is unique', () => { var model = obj.add(idTest, optsTest); var model2 = obj.add(idTest, { other: 'test' }); expect(model).toEqual(model2); }); - it('Get block by id', () => { + test('Get block by id', () => { var model = obj.add(idTest, optsTest); var model2 = obj.get(idTest); expect(model).toEqual(model2); }); - it('Render blocks', () => { + test('Render blocks', () => { obj.render(); expect(obj.getContainer()).toExist(); }); diff --git a/test/specs/block_manager/view/BlocksView.js b/test/specs/block_manager/view/BlocksView.js index b956a2c900..59b6cddd3a 100644 --- a/test/specs/block_manager/view/BlocksView.js +++ b/test/specs/block_manager/view/BlocksView.js @@ -23,22 +23,22 @@ module.exports = { view.collection.reset(); }); - it('The container is not empty', () => { + test('The container is not empty', () => { expect(view.el.outerHTML).toExist(); }); - it('No children inside', () => { + test('No children inside', () => { expect(view.getBlocksEl().children.length).toEqual(0); }); - it('Render children on add', () => { + test('Render children on add', () => { model.add({}); expect(view.getBlocksEl().children.length).toEqual(1); model.add([{}, {}]); expect(view.getBlocksEl().children.length).toEqual(3); }); - it('Destroy children on remove', () => { + test('Destroy children on remove', () => { model.add([{}, {}]); expect(view.getBlocksEl().children.length).toEqual(2); model.at(0).destroy(); @@ -64,11 +64,11 @@ module.exports = { .appendChild(view.render().el); }); - it('Render children', () => { + test('Render children', () => { expect(view.getBlocksEl().children.length).toEqual(2); }); - it('Render container', () => { + test('Render container', () => { expect(view.getBlocksEl().getAttribute('class')).toEqual( ppfx + 'blocks-c' ); diff --git a/test/specs/code_manager/index.js b/test/specs/code_manager/index.js index 39f514268f..c2ba569733 100644 --- a/test/specs/code_manager/index.js +++ b/test/specs/code_manager/index.js @@ -13,24 +13,24 @@ describe('Code Manager', () => { obj = null; }); - it('Object exists', () => { + test('Object exists', () => { expect(CodeManager).toExist(); }); - it('No code generators inside', () => { + test('No code generators inside', () => { expect(obj.getGenerators()).toEqual({}); }); - it('No code viewers inside', () => { + test('No code viewers inside', () => { expect(obj.getViewers()).toEqual({}); }); - it('Add and get code generator', () => { + test('Add and get code generator', () => { obj.addGenerator('test', 'gen'); expect(obj.getGenerator('test')).toEqual('gen'); }); - it('Add and get code viewer', () => { + test('Add and get code viewer', () => { obj.addViewer('test', 'view'); expect(obj.getViewer('test')).toEqual('view'); }); diff --git a/test/specs/code_manager/model/CodeModels.js b/test/specs/code_manager/model/CodeModels.js index 8ad18e2c12..6f99ebc02d 100644 --- a/test/specs/code_manager/model/CodeModels.js +++ b/test/specs/code_manager/model/CodeModels.js @@ -31,16 +31,16 @@ module.exports = { obj = null; }); - it('Build correctly one component', () => { + test('Build correctly one component', () => { expect(obj.build(comp)).toEqual(''); }); - it('Build correctly empty component inside', () => { + test('Build correctly empty component inside', () => { var m1 = comp.get('components').add({}); expect(obj.build(comp)).toEqual('
'); }); - it('Build correctly not empty component inside', () => { + test('Build correctly not empty component inside', () => { var m1 = comp.get('components').add({ tagName: 'article', attributes: { @@ -53,7 +53,7 @@ module.exports = { ); }); - it('Build correctly component with classes', () => { + test('Build correctly component with classes', () => { var m1 = comp.get('components').add({ tagName: 'article', attributes: { @@ -93,16 +93,16 @@ module.exports = { obj = null; }); - it('Build correctly one component', () => { + test('Build correctly one component', () => { expect(obj.build(comp)).toEqual(''); }); - it('Build correctly empty component inside', () => { + test('Build correctly empty component inside', () => { var m1 = comp.get('components').add({ tagName: 'article' }); expect(obj.build(comp)).toEqual(''); }); - it('Build correctly component with style inside', () => { + test('Build correctly component with style inside', () => { var m1 = comp.get('components').add({ tagName: 'article', style: { @@ -115,7 +115,7 @@ module.exports = { ); }); - it('Build correctly component with class styled', () => { + test('Build correctly component with class styled', () => { var m1 = comp.get('components').add({ tagName: 'article' }); var cls1 = m1.get('classes').add({ name: 'class1' }); @@ -128,7 +128,7 @@ module.exports = { ); }); - it('Build correctly component styled with class and state', () => { + test('Build correctly component styled with class and state', () => { var m1 = comp.get('components').add({ tagName: 'article' }); var cls1 = m1.get('classes').add({ name: 'class1' }); @@ -142,7 +142,7 @@ module.exports = { ); }); - it('Build correctly with more classes', () => { + test('Build correctly with more classes', () => { var m1 = comp.get('components').add({ tagName: 'article' }); var cls1 = m1.get('classes').add({ name: 'class1' }); var cls2 = m1.get('classes').add({ name: 'class2' }); @@ -156,7 +156,7 @@ module.exports = { ); }); - it('Build rules with mixed classes', () => { + test('Build rules with mixed classes', () => { var m1 = comp.get('components').add({ tagName: 'article' }); var cls1 = m1.get('classes').add({ name: 'class1' }); var cls2 = m1.get('classes').add({ name: 'class2' }); @@ -171,7 +171,7 @@ module.exports = { ); }); - it('Build rules with only not class based selectors', () => { + test('Build rules with only not class based selectors', () => { var cssc = newCssComp(); var rule = cssc.add([]); rule.set('style', { prop1: 'value1', prop2: 'value2' }); @@ -182,7 +182,7 @@ module.exports = { ); }); - it('Build correctly with class styled out', () => { + test('Build correctly with class styled out', () => { var m1 = comp.get('components').add({ tagName: 'article' }); var cls1 = m1.get('classes').add({ name: 'class1' }); var cls2 = m1.get('classes').add({ name: 'class2' }); @@ -198,7 +198,7 @@ module.exports = { ); }); - it('Rule with media query', () => { + test('Rule with media query', () => { var m1 = comp.get('components').add({ tagName: 'article' }); var cls1 = m1.get('classes').add({ name: 'class1' }); var cls2 = m1.get('classes').add({ name: 'class2' }); @@ -213,7 +213,7 @@ module.exports = { ); }); - it('Rules mixed with media queries', () => { + test('Rules mixed with media queries', () => { var m1 = comp.get('components').add({ tagName: 'article' }); var cls1 = m1.get('classes').add({ name: 'class1' }); var cls2 = m1.get('classes').add({ name: 'class2' }); @@ -240,7 +240,7 @@ module.exports = { ); }); - it('Avoid useless code', () => { + test('Avoid useless code', () => { var m1 = comp.get('components').add({ tagName: 'article' }); var cls1 = m1.get('classes').add({ name: 'class1' }); @@ -252,14 +252,14 @@ module.exports = { expect(obj.build(comp, { cssc })).toEqual(''); }); - it('Render correctly a rule without avoidInlineStyle option', () => { + test('Render correctly a rule without avoidInlineStyle option', () => { comp.setStyle({ color: 'red' }); const id = comp.getId(); const result = `#${id}{color:red;}`; expect(obj.build(comp, { cssc: cc })).toEqual(result); }); - it('Render correctly a rule with avoidInlineStyle option', () => { + test('Render correctly a rule with avoidInlineStyle option', () => { em.getConfig().avoidInlineStyle = 1; comp = new Component( {}, @@ -274,7 +274,7 @@ module.exports = { expect(obj.build(comp, { cssc: cc, em })).toEqual(result); }); - it('Render correctly a rule with avoidInlineStyle and state', () => { + test('Render correctly a rule with avoidInlineStyle and state', () => { em.getConfig().avoidInlineStyle = 1; const state = 'hover'; comp.config.avoidInlineStyle = 1; @@ -285,7 +285,7 @@ module.exports = { expect(obj.build(comp, { cssc: cc, em })).toEqual(result); }); - it('Render correctly a rule with avoidInlineStyle and w/o state', () => { + test('Render correctly a rule with avoidInlineStyle and w/o state', () => { em.getConfig().avoidInlineStyle = 1; const state = 'hover'; comp.config.avoidInlineStyle = 1; diff --git a/test/specs/commands/index.js b/test/specs/commands/index.js index 46ce61755b..b9e45cdc2c 100644 --- a/test/specs/commands/index.js +++ b/test/specs/commands/index.js @@ -14,17 +14,17 @@ describe('Commands', () => { obj = null; }); - it('No commands inside', () => { + test('No commands inside', () => { expect(obj.get('test')).toEqual(null); }); - it('Push new command', () => { + test('Push new command', () => { var comm = { test: 'test' }; obj.add('test', comm); expect(obj.get('test').test).toEqual('test'); }); - it('Load default commands at init', () => { + test('Load default commands at init', () => { expect(obj.get('select-comp')).toNotEqual(null); expect(obj.get('create-comp')).toNotEqual(null); expect(obj.get('delete-comp')).toNotEqual(null); @@ -50,12 +50,12 @@ describe('Commands', () => { expect(obj.get('drag')).toNotEqual(null); }); - it('Default commands after loadDefaultCommands', () => { + test('Default commands after loadDefaultCommands', () => { obj.loadDefaultCommands(); expect(obj.get('select-comp')).toNotEqual(null); }); - it('Commands module should not have toLoad property', () => { + test('Commands module should not have toLoad property', () => { expect(obj.toLoad).toEqual(null); }); }); diff --git a/test/specs/commands/model/CommandModels.js b/test/specs/commands/model/CommandModels.js index fd94204e25..fccbab4956 100644 --- a/test/specs/commands/model/CommandModels.js +++ b/test/specs/commands/model/CommandModels.js @@ -14,7 +14,7 @@ module.exports = { obj = null; }); - it('Has id property', () => { + test('Has id property', () => { expect(obj.has('id')).toEqual(true); }); }); @@ -30,7 +30,7 @@ module.exports = { obj = null; }); - it('Object is ok', () => { + test('Object is ok', () => { expect(obj).toExist(); }); }); diff --git a/test/specs/commands/view/CommandAbstract.js b/test/specs/commands/view/CommandAbstract.js index 33c6959df4..9f4eee9fa6 100644 --- a/test/specs/commands/view/CommandAbstract.js +++ b/test/specs/commands/view/CommandAbstract.js @@ -20,7 +20,7 @@ module.exports = { editor = null; }); - it('callRun returns result when no "abort" option specified', () => { + test('callRun returns result when no "abort" option specified', () => { const runStub = sinon.stub(command, 'run').returns('result'); const result = command.callRun(editor); @@ -40,7 +40,7 @@ module.exports = { expect(runStub.calledOnce).toEqual(true); }); - it('callRun returns undefined when "abort" option is specified', () => { + test('callRun returns undefined when "abort" option is specified', () => { const runStub = sinon.stub(command, 'run').returns('result'); const result = command.callRun(editor, { abort: true }); @@ -59,7 +59,7 @@ module.exports = { expect(runStub.notCalled).toEqual(true); }); - it('callStop returns result', () => { + test('callStop returns result', () => { const stopStub = sinon.stub(command, 'stop').returns('stopped'); const result = command.callStop(editor); diff --git a/test/specs/css_composer/e2e/CssComposer.js b/test/specs/css_composer/e2e/CssComposer.js index 99a4e9f8b7..1cc37dbd4f 100644 --- a/test/specs/css_composer/e2e/CssComposer.js +++ b/test/specs/css_composer/e2e/CssComposer.js @@ -13,7 +13,7 @@ module.exports = { var rulesSet; var rulesSet2; - before(() => { + beforeAll(() => { fixtures = $('#fixtures'); fixture = $('
'); }); @@ -53,11 +53,11 @@ module.exports = { clsm = null; }); - after(() => { + afterAll(() => { fixture.remove(); }); - it('Rules are correctly imported from default property', () => { + test('Rules are correctly imported from default property', () => { var gj = grapesjs.init({ stylePrefix: '', storageManager: { autoload: 0, type: 'none' }, @@ -70,7 +70,7 @@ module.exports = { expect(cls.length).toEqual(3); }); - it('New rule adds correctly the class inside selector manager', () => { + test('New rule adds correctly the class inside selector manager', () => { var rules = cssc.getAll(); rules.add({ selectors: [{ name: 'test1', private: true }] }); var rule = clsm.getAll().at(0); @@ -78,7 +78,7 @@ module.exports = { expect(rule.get('private')).toEqual(true); }); - it('New rules are correctly imported inside selector manager', () => { + test('New rules are correctly imported inside selector manager', () => { var rules = cssc.getAll(); rulesSet.forEach(item => { rules.add(item); @@ -90,7 +90,7 @@ module.exports = { expect(cls.at(2).get('name')).toEqual('test3'); }); - it('Add rules from the new component added as a string with style tag', () => { + test('Add rules from the new component added as a string with style tag', () => { var comps = domc.getComponents(); var rules = cssc.getAll(); comps.add( @@ -100,13 +100,13 @@ module.exports = { expect(rules.length).toEqual(2); }); - it('Add raw rule objects with addCollection', () => { + test('Add raw rule objects with addCollection', () => { cssc.addCollection(rulesSet); expect(cssc.getAll().length).toEqual(3); expect(clsm.getAll().length).toEqual(3); }); - it('Add raw rule objects twice with addCollection do not duplucate rules', () => { + test('Add raw rule objects twice with addCollection do not duplucate rules', () => { var rulesSet2Copy = JSON.parse(JSON.stringify(rulesSet2)); var coll1 = cssc.addCollection(rulesSet2); var coll2 = cssc.addCollection(rulesSet2Copy); @@ -115,7 +115,7 @@ module.exports = { expect(coll1).toEqual(coll2); }); - it('Extend css rule style, if requested', () => { + test('Extend css rule style, if requested', () => { var style1 = { color: 'red', width: '10px' }; var style2 = { height: '20px', width: '20px' }; var rule1 = { @@ -163,7 +163,7 @@ module.exports = { expect(ruleOut).toEqual(ruleResult); }); - it('Do not extend with different selectorsAdd', () => { + test('Do not extend with different selectorsAdd', () => { var style1 = { color: 'red', width: '10px' }; var style2 = { height: '20px', width: '20px' }; var rule1 = { @@ -212,7 +212,7 @@ module.exports = { expect(rule2Out).toEqual(rule2Result); }); - it('Add raw rule objects with width via addCollection', () => { + test('Add raw rule objects with width via addCollection', () => { var coll1 = cssc.addCollection(rulesSet2); expect(coll1[2].get('mediaText')).toEqual(rulesSet2[2].mediaText); }); diff --git a/test/specs/css_composer/index.js b/test/specs/css_composer/index.js index 79d416291e..d65b48fd17 100644 --- a/test/specs/css_composer/index.js +++ b/test/specs/css_composer/index.js @@ -42,38 +42,38 @@ describe('Css Composer', () => { obj = null; }); - it('Object exists', () => { + test('Object exists', () => { expect(CssComposer).toExist(); }); - it('storageKey returns array', () => { + test('storageKey returns array', () => { expect(obj.storageKey() instanceof Array).toEqual(true); }); - it('storageKey returns correct composition', () => { + test('storageKey returns correct composition', () => { setSmConfig(); expect(obj.storageKey()).toEqual(['css', 'styles']); }); - it('Store data', () => { + test('Store data', () => { setSmConfig(); setEm(); var expected = { css: 'testCss', styles: '[]' }; expect(obj.store(1)).toEqual(expected); }); - it('Rules are empty', () => { + test('Rules are empty', () => { expect(obj.getAll().length).toEqual(0); }); - it('Create new rule with correct selectors', () => { + test('Create new rule with correct selectors', () => { var sel = new obj.Selectors(); var s1 = sel.add({ name: 'test1' }); var rule = obj.add(sel.models); expect(rule.get('selectors').at(0)).toEqual(s1); }); - it('Create new rule correctly', () => { + test('Create new rule correctly', () => { var sel = new obj.Selectors(); var s1 = sel.add({ name: 'test1' }); var rule = obj.add(sel.models, 'state1', 'width1'); @@ -81,7 +81,7 @@ describe('Css Composer', () => { expect(rule.get('mediaText')).toEqual('width1'); }); - it('Add rule to collection', () => { + test('Add rule to collection', () => { var sel = new obj.Selectors([{ name: 'test1' }]); var rule = obj.add(sel.models); expect(obj.getAll().length).toEqual(1); @@ -95,14 +95,14 @@ describe('Css Composer', () => { ).toEqual('test1'); }); - it('Returns correct rule with the same selector', () => { + test('Returns correct rule with the same selector', () => { var sel = new obj.Selectors([{ name: 'test1' }]); var rule1 = obj.add(sel.models); var rule2 = obj.get(sel.models); expect(rule1).toEqual(rule2); }); - it('Returns correct rule with the same selectors', () => { + test('Returns correct rule with the same selectors', () => { var sel1 = new obj.Selectors([{ name: 'test1' }]); var rule1 = obj.add(sel1.models); @@ -113,7 +113,7 @@ describe('Css Composer', () => { expect(rule3).toEqual(rule2); }); - it('Do not create multiple rules with the same name selectors', () => { + test('Do not create multiple rules with the same name selectors', () => { var sel1 = new obj.Selectors([{ name: 'test21' }, { name: 'test22' }]); var rule1 = obj.add(sel1.models); @@ -122,7 +122,7 @@ describe('Css Composer', () => { expect(rule2).toEqual(rule1); }); - it("Don't duplicate rules", () => { + test("Don't duplicate rules", () => { var sel = new obj.Selectors([]); var s1 = sel.add({ name: 'test1' }); var s2 = sel.add({ name: 'test2' }); @@ -134,7 +134,7 @@ describe('Css Composer', () => { expect(rule2).toEqual(rule1); }); - it('Returns correct rule with the same mixed selectors', () => { + test('Returns correct rule with the same mixed selectors', () => { var sel = new obj.Selectors([]); var s1 = sel.add({ name: 'test1' }); var s2 = sel.add({ name: 'test2' }); @@ -144,7 +144,7 @@ describe('Css Composer', () => { expect(rule2).toEqual(rule1); }); - it('Returns correct rule with the same selectors and state', () => { + test('Returns correct rule with the same selectors and state', () => { var sel = new obj.Selectors([]); var s1 = sel.add({ name: 'test1' }); var s2 = sel.add({ name: 'test2' }); @@ -154,7 +154,7 @@ describe('Css Composer', () => { expect(rule2).toEqual(rule1); }); - it('Returns correct rule with the same selectors, state and width', () => { + test('Returns correct rule with the same selectors, state and width', () => { var sel = new obj.Selectors([]); var s1 = sel.add({ name: 'test1' }); var rule1 = obj.add([s1], 'hover', '1'); @@ -162,11 +162,11 @@ describe('Css Composer', () => { expect(rule2).toEqual(rule1); }); - it('Renders correctly', () => { + test('Renders correctly', () => { expect(obj.render()).toExist(); }); - it('Create a rule with id selector by using setIdRule()', () => { + test('Create a rule with id selector by using setIdRule()', () => { const name = 'test'; obj.setIdRule(name, { color: 'red' }); expect(obj.getAll().length).toEqual(1); @@ -181,7 +181,7 @@ describe('Css Composer', () => { ); }); - it('Create a rule with id selector and state by using setIdRule()', () => { + test('Create a rule with id selector and state by using setIdRule()', () => { const name = 'test'; const state = 'hover'; obj.setIdRule(name, { color: 'red' }, { state }); @@ -190,7 +190,7 @@ describe('Css Composer', () => { expect(rule.selectorsToString()).toEqual(`#${name}:${state}`); }); - it('Create a rule with class selector by using setClassRule()', () => { + test('Create a rule with class selector by using setClassRule()', () => { const name = 'test'; obj.setClassRule(name, { color: 'red' }); expect(obj.getAll().length).toEqual(1); @@ -199,7 +199,7 @@ describe('Css Composer', () => { expect(rule.styleToString()).toEqual(`color:red;`); }); - it('Create a rule with class selector and state by using setClassRule()', () => { + test('Create a rule with class selector and state by using setClassRule()', () => { const name = 'test'; const state = 'hover'; obj.setClassRule(name, { color: 'red' }, { state }); diff --git a/test/specs/css_composer/model/CssModels.js b/test/specs/css_composer/model/CssModels.js index 8817413c63..b0c28704f6 100644 --- a/test/specs/css_composer/model/CssModels.js +++ b/test/specs/css_composer/model/CssModels.js @@ -16,29 +16,29 @@ module.exports = { obj = null; }); - it('Has selectors property', () => { + test('Has selectors property', () => { expect(obj.has('selectors')).toEqual(true); }); - it('Has style property', () => { + test('Has style property', () => { expect(obj.has('style')).toEqual(true); }); - it('Has state property', () => { + test('Has state property', () => { expect(obj.has('state')).toEqual(true); }); - it('No default selectors', () => { + test('No default selectors', () => { expect(obj.get('selectors').length).toEqual(0); }); - it('Compare returns true with the same selectors', () => { + test('Compare returns true with the same selectors', () => { var s1 = obj.get('selectors').add({ name: 'test1' }); var s2 = obj.get('selectors').add({ name: 'test2' }); expect(obj.compare([s1, s2])).toEqual(true); }); - it('Compare with different state', () => { + test('Compare with different state', () => { var s1 = obj.get('selectors').add({ name: 'test1' }); var s2 = obj.get('selectors').add({ name: 'test2' }); obj.set('state', 'hover'); @@ -46,7 +46,7 @@ module.exports = { expect(obj.compare([s1, s2], 'hover')).toEqual(true); }); - it('Compare with different mediaText', () => { + test('Compare with different mediaText', () => { var s1 = obj.get('selectors').add({ name: 'test1' }); var s2 = obj.get('selectors').add({ name: 'test2' }); obj.set('state', 'hover'); @@ -56,23 +56,23 @@ module.exports = { expect(obj.compare([s2, s1], 'hover', '1000')).toEqual(true); }); - it('toCSS returns empty if there is no style', () => { + test('toCSS returns empty if there is no style', () => { var s1 = obj.get('selectors').add({ name: 'test1' }); expect(obj.toCSS()).toEqual(''); }); - it('toCSS returns empty if there is no selectors', () => { + test('toCSS returns empty if there is no selectors', () => { obj.setStyle({ color: 'red' }); expect(obj.toCSS()).toEqual(''); }); - it('toCSS returns simple CSS', () => { + test('toCSS returns simple CSS', () => { obj.get('selectors').add({ name: 'test1' }); obj.setStyle({ color: 'red' }); expect(obj.toCSS()).toEqual(`.test1{color:red;}`); }); - it('toCSS wraps correctly inside media rule', () => { + test('toCSS wraps correctly inside media rule', () => { const media = '(max-width: 768px)'; obj.set('atRuleType', 'media'); obj.set('mediaText', media); @@ -81,7 +81,7 @@ module.exports = { expect(obj.toCSS()).toEqual(`@media ${media}{.test1{color:red;}}`); }); - it('toCSS with a generic at-rule', () => { + test('toCSS with a generic at-rule', () => { obj.set('atRuleType', 'supports'); obj.get('selectors').add({ name: 'test1' }); obj.setStyle({ 'font-family': 'Open Sans' }); @@ -90,14 +90,14 @@ module.exports = { ); }); - it('toCSS with a generic single at-rule', () => { + test('toCSS with a generic single at-rule', () => { obj.set('atRuleType', 'font-face'); obj.set('singleAtRule', 1); obj.setStyle({ 'font-family': 'Sans' }); expect(obj.toCSS()).toEqual(`@font-face{font-family:Sans;}`); }); - it('toCSS with a generic at-rule and condition', () => { + test('toCSS with a generic at-rule and condition', () => { obj.set('atRuleType', 'font-face'); obj.set('mediaText', 'some-condition'); obj.get('selectors').add({ name: 'test1' }); @@ -109,7 +109,7 @@ module.exports = { }); describe('CssRules', () => { - it('Creates collection item correctly', () => { + test('Creates collection item correctly', () => { var c = new CssRules(); var m = c.add({}); expect(m instanceof CssRule).toEqual(true); @@ -117,7 +117,7 @@ module.exports = { }); describe('Selectors', () => { - it('Creates collection item correctly', () => { + test('Creates collection item correctly', () => { var c = new Selectors(); var m = c.add({}); expect(m instanceof Selector).toEqual(true); diff --git a/test/specs/css_composer/view/CssRuleView.js b/test/specs/css_composer/view/CssRuleView.js index 4827eab81d..d9b886796b 100644 --- a/test/specs/css_composer/view/CssRuleView.js +++ b/test/specs/css_composer/view/CssRuleView.js @@ -7,7 +7,7 @@ module.exports = { let obj; let fixtures; - beforeEach(function() { + beforeEach(() => { var m = new CssRule(); obj = new CssRuleView({ model: m @@ -21,15 +21,15 @@ module.exports = { obj.model.destroy(); }); - it('Object exists', () => { + test('Object exists', () => { expect(CssRuleView).toExist(); }); - it('Empty style inside', function() { + test('Empty style inside', () => { expect(fixtures.innerHTML).toEqual(''); }); - it('On update of style always empty as there is no selectors', function() { + test('On update of style always empty as there is no selectors', () => { obj.model.set('style', { prop: 'value' }); expect(fixtures.innerHTML).toEqual(''); }); @@ -54,29 +54,29 @@ module.exports = { objReg.model.destroy(); }); - it('Empty with no style', () => { + test('Empty with no style', () => { expect(objReg.$el.html()).toEqual(''); }); - it('Not empty on update of style', () => { + test('Not empty on update of style', () => { objReg.model.set('style', { prop: 'value' }); expect(objReg.$el.html()).toEqual('.test1.test2{prop:value;}'); }); - it('State correctly rendered', () => { + test('State correctly rendered', () => { objReg.model.set('style', { prop: 'value' }); objReg.model.set('state', 'hover'); expect(objReg.$el.html()).toEqual('.test1.test2:hover{prop:value;}'); }); - it('State render changes on update', () => { + test('State render changes on update', () => { objReg.model.set('style', { prop: 'value' }); objReg.model.set('state', 'hover'); objReg.model.set('state', ''); expect(objReg.$el.html()).toEqual('.test1.test2{prop:value;}'); }); - it('Render media queries', () => { + test('Render media queries', () => { objReg.model.set('style', { prop: 'value' }); objReg.model.set('mediaText', '(max-width: 999px)'); expect(objReg.$el.html()).toEqual( @@ -84,7 +84,7 @@ module.exports = { ); }); - it('Empty on clear', () => { + test('Empty on clear', () => { objReg.model.set('style', { prop: 'value' }); objReg.model.set('style', {}); expect(objReg.$el.html()).toEqual(''); diff --git a/test/specs/css_composer/view/CssRulesView.js b/test/specs/css_composer/view/CssRulesView.js index 7a9c3710c1..d547f74239 100644 --- a/test/specs/css_composer/view/CssRulesView.js +++ b/test/specs/css_composer/view/CssRulesView.js @@ -25,7 +25,7 @@ module.exports = { } ]; - beforeEach(function() { + beforeEach(() => { const col = new CssRules([]); obj = new CssRulesView({ collection: col, @@ -45,11 +45,11 @@ module.exports = { obj.collection.reset(); }); - it('Object exists', () => { + test('Object exists', () => { expect(CssRulesView).toExist(); }); - it('Collection is empty. Styles structure bootstraped', () => { + test('Collection is empty. Styles structure bootstraped', () => { expect(obj.$el.html()).toExist(); const foundStylesContainers = obj.$el.find('div'); expect(foundStylesContainers.length).toEqual(devices.length); @@ -68,13 +68,13 @@ module.exports = { }); }); - it('Add new rule', () => { + test('Add new rule', () => { sinon.stub(obj, 'addToCollection'); obj.collection.add({}); expect(obj.addToCollection.calledOnce).toExist(true); }); - it('Add correctly rules with different media queries', () => { + test('Add correctly rules with different media queries', () => { const foundStylesContainers = obj.$el.find('div'); const rules = [ { @@ -98,7 +98,7 @@ module.exports = { expect(stylesCont.children.length).toEqual(rules.length); }); - it('Render new rule', () => { + test('Render new rule', () => { obj.collection.add({}); expect(obj.$el.find(`#${prefix}`).html()).toExist(); }); diff --git a/test/specs/device_manager/index.js b/test/specs/device_manager/index.js index 304814daf5..91cf611030 100644 --- a/test/specs/device_manager/index.js +++ b/test/specs/device_manager/index.js @@ -17,44 +17,44 @@ describe('DeviceManager', () => { obj = null; }); - it('Object exists', () => { + test('Object exists', () => { expect(obj).toExist(); }); - it('No device inside', () => { + test('No device inside', () => { var coll = obj.getAll(); expect(coll.length).toEqual(0); }); - it('Add new device', () => { + test('Add new device', () => { var model = obj.add(testNameDevice, testWidthDevice); expect(obj.getAll().length).toEqual(1); }); - it('Added device has correct data', () => { + test('Added device has correct data', () => { var model = obj.add(testNameDevice, testWidthDevice); expect(model.get('name')).toEqual(testNameDevice); expect(model.get('width')).toEqual(testWidthDevice); }); - it('Add device width options', () => { + test('Add device width options', () => { var model = obj.add(testNameDevice, testWidthDevice, { opt: 'value' }); expect(model.get('opt')).toEqual('value'); }); - it('The name of the device is unique', () => { + test('The name of the device is unique', () => { var model = obj.add(testNameDevice, testWidthDevice); var model2 = obj.add(testNameDevice, '2px'); expect(model).toEqual(model2); }); - it('Get device by name', () => { + test('Get device by name', () => { var model = obj.add(testNameDevice, testWidthDevice); var model2 = obj.get(testNameDevice); expect(model).toEqual(model2); }); - it('Render devices', () => { + test('Render devices', () => { expect(obj.render()).toExist(); }); }); diff --git a/test/specs/device_manager/view/DevicesView.js b/test/specs/device_manager/view/DevicesView.js index b1dbe64023..1e782f1a7c 100644 --- a/test/specs/device_manager/view/DevicesView.js +++ b/test/specs/device_manager/view/DevicesView.js @@ -23,15 +23,15 @@ module.exports = { view.collection.reset(); }); - it('The content is not empty', () => { + test('The content is not empty', () => { expect(view.el.innerHTML).toExist(); }); - it('No options without devices', () => { + test('No options without devices', () => { expect(view.getOptions()).toEqual(''); }); - it('Render new button', () => { + test('Render new button', () => { view.collection.add({}); expect(view.$el.html()).toExist(); }); @@ -50,13 +50,13 @@ module.exports = { .appendChild(view.render().el); }); - it('Update device on select change', () => { + test('Update device on select change', () => { view.$el.find('select').val('test2'); view.updateDevice(); expect(view.config.em.get('device')).toEqual('test2'); }); - it('Render options', () => { + test('Render options', () => { expect(view.getOptions()).toEqual( '' ); diff --git a/test/specs/dom_components/index.js b/test/specs/dom_components/index.js index 82435294de..32abc9236c 100644 --- a/test/specs/dom_components/index.js +++ b/test/specs/dom_components/index.js @@ -58,15 +58,15 @@ describe('DOM Components', () => { obj = null; }); - it('Object exists', () => { + test('Object exists', () => { expect(DomComponents).toExist(); }); - it('storageKey returns array', () => { + test('storageKey returns array', () => { expect(obj.storageKey() instanceof Array).toEqual(true); }); - it('storageKey returns correct composition', () => { + test('storageKey returns correct composition', () => { config.stm = { getConfig() { return { @@ -78,7 +78,7 @@ describe('DOM Components', () => { expect(obj.storageKey()).toEqual(['html', 'components']); }); - it('Store data', () => { + test('Store data', () => { setSmConfig(); setEm(); //obj.getWrapper().get('components').add({}); @@ -89,7 +89,7 @@ describe('DOM Components', () => { expect(obj.store(1)).toEqual(expected); }); - it.skip('Store and load data', () => { + test.skip('Store and load data', () => { setSmConfig(); setEm(); const comps = new Components({}, {}); @@ -98,29 +98,29 @@ describe('DOM Components', () => { expect(obj.load()).toEqual([{ test: 1 }]); }); - it('Wrapper exists', () => { + test('Wrapper exists', () => { expect(obj.getWrapper()).toExist(); }); - it('No components inside', () => { + test('No components inside', () => { expect(obj.getComponents().length).toEqual(0); }); - it('Add new component', () => { + test('Add new component', () => { var comp = obj.addComponent({}); expect(obj.getComponents().length).toEqual(1); }); - it('Add more components at once', () => { + test('Add more components at once', () => { var comp = obj.addComponent([{}, {}]); expect(obj.getComponents().length).toEqual(2); }); - it('Render wrapper', () => { + test('Render wrapper', () => { expect(obj.render()).toExist(); }); - it('Import propertly components and styles with the same ids', () => { + test('Import propertly components and styles with the same ids', () => { obj = em.get('DomComponents'); const cc = em.get('CssComposer'); const id = 'idtest'; diff --git a/test/specs/dom_components/model/Component.js b/test/specs/dom_components/model/Component.js index a1d702cad2..6146ef074a 100644 --- a/test/specs/dom_components/model/Component.js +++ b/test/specs/dom_components/model/Component.js @@ -33,11 +33,11 @@ module.exports = { obj = null; }); - it('Has no children', () => { + test('Has no children', () => { expect(obj.get('components').length).toEqual(0); }); - it('Clones correctly', () => { + test('Clones correctly', () => { var sAttr = obj.attributes; var cloned = obj.clone(); var eAttr = cloned.attributes; @@ -48,7 +48,7 @@ module.exports = { expect(sAttr.length).toEqual(eAttr.length); }); - it('Clones correctly with traits', () => { + test('Clones correctly with traits', () => { obj .get('traits') .at(0) @@ -68,7 +68,7 @@ module.exports = { expect(obj.get('stylable')).toEqual(true); }); - it('Sets attributes correctly from traits', () => { + test('Sets attributes correctly from traits', () => { obj.set('traits', [ { label: 'Title', @@ -83,21 +83,21 @@ module.exports = { expect(obj.get('attributes')).toEqual({ title: 'The title' }); }); - it('Has expected name', () => { + test('Has expected name', () => { expect(obj.getName()).toEqual('Box'); }); - it('Has expected name 2', () => { + test('Has expected name 2', () => { obj.cid = 'c999'; obj.set('type', 'testType'); expect(obj.getName()).toEqual('TestType'); }); - it('Component toHTML', () => { + test('Component toHTML', () => { expect(obj.toHTML()).toEqual('
'); }); - it('Component toHTML with attributes', () => { + test('Component toHTML with attributes', () => { obj = new Component({ tagName: 'article', attributes: { @@ -110,7 +110,7 @@ module.exports = { ); }); - it('Component toHTML with value-less attribute', () => { + test('Component toHTML with value-less attribute', () => { obj = new Component({ tagName: 'div', attributes: { @@ -120,7 +120,7 @@ module.exports = { expect(obj.toHTML()).toEqual('
'); }); - it('Component toHTML with classes', () => { + test('Component toHTML with classes', () => { obj = new Component({ tagName: 'article' }); @@ -132,13 +132,13 @@ module.exports = { ); }); - it('Component toHTML with children', () => { + test('Component toHTML with children', () => { obj = new Component({ tagName: 'article' }, compOpts); obj.get('components').add({ tagName: 'span' }); expect(obj.toHTML()).toEqual('
'); }); - it('Component toHTML with more children', () => { + test('Component toHTML with more children', () => { obj = new Component({ tagName: 'article' }, compOpts); obj.get('components').add([{ tagName: 'span' }, { tagName: 'div' }]); expect(obj.toHTML()).toEqual( @@ -146,12 +146,12 @@ module.exports = { ); }); - it('Component toHTML with no closing tag', () => { + test('Component toHTML with no closing tag', () => { obj = new Component({ void: 1 }); expect(obj.toHTML()).toEqual('
'); }); - it('Component toHTML with quotes in attribute', () => { + test('Component toHTML with quotes in attribute', () => { obj = new Component(); let attrs = obj.get('attributes'); attrs['data-test'] = '"value"'; @@ -161,7 +161,7 @@ module.exports = { ); }); - it('Manage correctly boolean attributes', () => { + test('Manage correctly boolean attributes', () => { obj = new Component(); obj.set('attributes', { 'data-test': 'value', @@ -174,19 +174,19 @@ module.exports = { ); }); - it('Component parse empty div', () => { + test('Component parse empty div', () => { var el = document.createElement('div'); obj = Component.isComponent(el); expect(obj).toEqual({ tagName: 'div' }); }); - it('Component parse span', () => { + test('Component parse span', () => { var el = document.createElement('span'); obj = Component.isComponent(el); expect(obj).toEqual({ tagName: 'span' }); }); - it('setClass single class string', () => { + test('setClass single class string', () => { obj.setClass('class1'); const result = obj.get('classes').models; expect(result.length).toEqual(1); @@ -194,73 +194,73 @@ module.exports = { expect(result[0].get('name')).toEqual('class1'); }); - it('setClass multiple class string', () => { + test('setClass multiple class string', () => { obj.setClass('class1 class2'); const result = obj.get('classes').models; expect(result.length).toEqual(2); }); - it('setClass single class array', () => { + test('setClass single class array', () => { obj.setClass(['class1']); const result = obj.get('classes').models; expect(result.length).toEqual(1); }); - it('setClass multiple class array', () => { + test('setClass multiple class array', () => { obj.setClass(['class1', 'class2']); const result = obj.get('classes').models; expect(result.length).toEqual(2); }); - it('addClass multiple array', () => { + test('addClass multiple array', () => { obj.addClass(['class1', 'class2']); const result = obj.get('classes').models; expect(result.length).toEqual(2); }); - it('addClass avoid same name classes', () => { + test('addClass avoid same name classes', () => { obj.addClass(['class1', 'class2']); obj.addClass(['class1', 'class3']); const result = obj.get('classes').models; expect(result.length).toEqual(3); }); - it('removeClass by string', () => { + test('removeClass by string', () => { obj.addClass(['class1', 'class2']); obj.removeClass('class2'); const result = obj.get('classes').models; expect(result.length).toEqual(1); }); - it('removeClass by string with multiple classes', () => { + test('removeClass by string with multiple classes', () => { obj.addClass(['class1', 'class2']); obj.removeClass('class2 class1'); const result = obj.get('classes').models; expect(result.length).toEqual(0); }); - it('removeClass by array', () => { + test('removeClass by array', () => { obj.addClass(['class1', 'class2']); obj.removeClass(['class1', 'class2']); const result = obj.get('classes').models; expect(result.length).toEqual(0); }); - it('removeClass do nothing with undefined classes', () => { + test('removeClass do nothing with undefined classes', () => { obj.addClass(['class1', 'class2']); obj.removeClass(['class3']); const result = obj.get('classes').models; expect(result.length).toEqual(2); }); - it('removeClass actually removes classes from attributes', () => { + test('removeClass actually removes classes from attributes', () => { obj.addClass('class1'); obj.removeClass('class1'); const result = obj.getAttributes(); expect(result.class).toEqual(undefined); }); - it('setAttributes', () => { + test('setAttributes', () => { obj.setAttributes({ id: 'test', 'data-test': 'value', @@ -279,20 +279,20 @@ module.exports = { }); }); - it('setAttributes overwrites correctly', () => { + test('setAttributes overwrites correctly', () => { obj.setAttributes({ id: 'test', 'data-test': 'value' }); obj.setAttributes({ 'data-test': 'value2' }); expect(obj.getAttributes()).toEqual({ 'data-test': 'value2' }); }); - it('append() returns always an array', () => { + test('append() returns always an array', () => { let result = obj.append('text1'); expect(result.length).toEqual(1); result = obj.append('text1
text2
'); expect(result.length).toEqual(2); }); - it('append() new components as string', () => { + test('append() new components as string', () => { obj.append('text1
text2
'); const comps = obj.components(); expect(comps.length).toEqual(2); @@ -300,7 +300,7 @@ module.exports = { expect(comps.models[1].get('tagName')).toEqual('div'); }); - it('append() new components as Objects', () => { + test('append() new components as Objects', () => { obj.append([{}, {}]); const comps = obj.components(); expect(comps.length).toEqual(2); @@ -308,7 +308,7 @@ module.exports = { expect(comps.length).toEqual(3); }); - it('components() set new collection', () => { + test('components() set new collection', () => { obj.append([{}, {}]); obj.components('test
'); const result = obj.components(); @@ -316,7 +316,7 @@ module.exports = { expect(result.models[0].get('tagName')).toEqual('span'); }); - it('Propagate properties to children', () => { + test('Propagate properties to children', () => { obj.append({ propagate: 'removable' }); const result = obj.components(); const newObj = result.models[0]; @@ -328,7 +328,7 @@ module.exports = { expect(child.get('propagate')).toEqual(['removable']); }); - it('Ability to stop/change propagation chain', () => { + test('Ability to stop/change propagation chain', () => { obj.append({ removable: false, draggable: false, @@ -379,20 +379,20 @@ module.exports = { obj = null; }); - it('Has src property', () => { + test('Has src property', () => { expect(obj.has('src')).toEqual(true); }); - it('Not droppable', () => { + test('Not droppable', () => { expect(obj.get('droppable')).toEqual(false); }); - it('ComponentImage toHTML', () => { + test('ComponentImage toHTML', () => { obj = new ComponentImage(); expect(obj.toHTML()).toEqual(''); }); - it('Component toHTML with attributes', () => { + test('Component toHTML with attributes', () => { obj = new ComponentImage({ attributes: { alt: 'AltTest' }, src: 'testPath' @@ -400,19 +400,19 @@ module.exports = { expect(obj.toHTML()).toEqual('AltTest'); }); - it('Refuse not img element', () => { + test('Refuse not img element', () => { var el = document.createElement('div'); obj = ComponentImage.isComponent(el); expect(obj).toEqual(''); }); - it('Component parse img element', () => { + test('Component parse img element', () => { var el = document.createElement('img'); obj = ComponentImage.isComponent(el); expect(obj).toEqual({ type: 'image' }); }); - it('Component parse img element with src', () => { + test('Component parse img element with src', () => { var el = document.createElement('img'); el.src = 'http://localhost/'; obj = ComponentImage.isComponent(el); @@ -429,15 +429,15 @@ module.exports = { obj = null; }); - it('Has content property', () => { + test('Has content property', () => { expect(obj.has('content')).toEqual(true); }); - it('Not droppable', () => { + test('Not droppable', () => { expect(obj.get('droppable')).toEqual(false); }); - it('Component toHTML with attributes', () => { + test('Component toHTML with attributes', () => { obj = new ComponentText({ attributes: { 'data-test': 'value' }, content: 'test content' @@ -451,24 +451,24 @@ module.exports = { describe('Link Component', () => { const aEl = document.createElement('a'); - it('Component parse link element', () => { + test('Component parse link element', () => { obj = ComponentLink.isComponent(aEl); expect(obj).toEqual({ type: 'link' }); }); - it('Component parse link element with text content', () => { + test('Component parse link element with text content', () => { aEl.innerHTML = 'some text here '; obj = ComponentLink.isComponent(aEl); expect(obj).toEqual({ type: 'link' }); }); - it('Component parse link element with not only text content', () => { + test('Component parse link element with not only text content', () => { aEl.innerHTML = '
Some
text
here
'; obj = ComponentLink.isComponent(aEl); expect(obj).toEqual({ type: 'link' }); }); - it('Component parse link element with only not text content', () => { + test('Component parse link element with only not text content', () => { aEl.innerHTML = `
Some
text
here
`; @@ -476,7 +476,7 @@ module.exports = { expect(obj).toEqual({ type: 'link', editable: 0 }); }); - it('Link element with only an image inside is not editable', () => { + test('Link element with only an image inside is not editable', () => { aEl.innerHTML = ''; obj = ComponentLink.isComponent(aEl); expect(obj).toEqual({ type: 'link', editable: 0 }); @@ -484,7 +484,7 @@ module.exports = { }); describe('Map Component', () => { - it('Component parse map iframe', () => { + test('Component parse map iframe', () => { var src = 'https://maps.google.com/maps?&q=London,UK&z=11&t=q&output=embed'; var el = $(''); @@ -492,7 +492,7 @@ module.exports = { expect(obj).toEqual({ type: 'map', src }); }); - it('Component parse not map iframe', () => { + test('Component parse not map iframe', () => { var el = $( '' ); @@ -502,21 +502,21 @@ module.exports = { }); describe('Video Component', () => { - it('Component parse video', () => { + test('Component parse video', () => { var src = 'http://localhost/'; var el = $(''); obj = ComponentVideo.isComponent(el.get(0)); expect(obj).toEqual({ type: 'video', src }); }); - it('Component parse youtube video iframe', () => { + test('Component parse youtube video iframe', () => { var src = 'http://www.youtube.com/embed/jNQXAC9IVRw?'; var el = $('