Browse Source

Fix regressions

pull/540/head
Artur Arseniev 9 years ago
parent
commit
02e502d15f
  1. 2
      src/css_composer/model/CssRule.js
  2. 2
      src/dom_components/view/ComponentView.js
  3. 2
      src/storage_manager/config/config.js
  4. 3
      test/specs/css_composer/e2e/CssComposer.js
  5. 4
      test/specs/css_composer/model/CssModels.js
  6. 34
      test/specs/grapesjs/index.js
  7. 13
      test/specs/selector_manager/view/ClassTagsView.js

2
src/css_composer/model/CssRule.js

@ -78,7 +78,7 @@ module.exports = Backbone.Model.extend(Styleable).extend({
const selectors = this.selectorsToString();
if (selectors && style) {
result = `${selectors} {${style}}`;
result = `${selectors}{${style}}`;
}
if (media && result) {

2
src/dom_components/view/ComponentView.js

@ -154,7 +154,7 @@ module.exports = Backbone.View.extend({
* */
updateStyle() {
const em = this.em;
if (em.get('avoidInlineStyle')) {
if (em && em.get('avoidInlineStyle')) {
const model = this.model;
this.el.id = model.getId();
model.setStyle(model.getStyle());

2
src/storage_manager/config/config.js

@ -24,7 +24,7 @@ module.exports = {
//Enable/Disable saving HTML template
storeHtml: 1,
//Enable/Disable saving HTML template
//Enable/Disable saving CSS template
storeCss: 1,
// ONLY FOR LOCAL STORAGE

3
test/specs/css_composer/e2e/CssComposer.js

@ -134,6 +134,7 @@ module.exports = {
private: false,
protected: false,
}],
important: 0,
selectorsAdd: '',
state: '',
stylable: true,
@ -172,6 +173,7 @@ module.exports = {
rule1Out = JSON.parse(JSON.stringify(rule1Out));
rule2Out = JSON.parse(JSON.stringify(rule2Out));
var rule1Result = {
important: 0,
mediaText: '',
selectors: [],
selectorsAdd: '*',
@ -183,6 +185,7 @@ module.exports = {
}
};
var rule2Result = {
important: 0,
mediaText: '',
selectors: [],
selectorsAdd: 'p',

4
test/specs/css_composer/model/CssModels.js

@ -69,7 +69,7 @@ module.exports = {
it('toCSS returns simple CSS', () => {
obj.get('selectors').add({ name: 'test1' });
obj.setStyle({color: 'red'});
expect(obj.toCSS()).toEqual(`.test1 {color:red;}`);
expect(obj.toCSS()).toEqual(`.test1{color:red;}`);
});
it('toCSS wraps correctly inside media rule', () => {
@ -77,7 +77,7 @@ module.exports = {
obj.set('mediaText', media);
obj.get('selectors').add({ name: 'test1' });
obj.setStyle({color: 'red'});
expect(obj.toCSS()).toEqual(`@media ${media}{.test1 {color:red;}}`);
expect(obj.toCSS()).toEqual(`@media ${media}{.test1{color:red;}}`);
});
});

34
test/specs/grapesjs/index.js

@ -16,11 +16,12 @@ describe('GrapesJS', () => {
var storage;
var storageId = 'testStorage';
var storageMock = {
store(data) {
store(data, clb) {
storage = data;
clb();
},
load(keys) {
return storage;
load(keys, clb) {
return clb(storage);
},
};
@ -36,7 +37,8 @@ describe('GrapesJS', () => {
container: '#' + editorName,
storageManager: {
autoload: 0,
type:'none'
autosave: 0,
type: ''
},
}
obj = grapesjs;
@ -47,11 +49,6 @@ describe('GrapesJS', () => {
fixtures = document.body.querySelector('#fixtures');
});
afterEach(() => {
config = {};
obj = null;
});
it('Main object should be loaded', () => {
expect(obj).toExist();
});
@ -76,7 +73,7 @@ describe('GrapesJS', () => {
it('New editor is empty', () => {
var editor = obj.init(config);
var html = editor.getHtml();
var css = editor.getCss();
//var css = editor.getCss();
var protCss = editor.getConfig().protectedCss;
expect((html ? html : '')).toNotExist();
//expect((css ? css : '')).toEqual(protCss);
@ -154,7 +151,7 @@ describe('GrapesJS', () => {
expect(styles.at(1).get('selectors').at(0).get('name')).toEqual('test5');
});
it('Adds new storage as plugin and store data there', () => {
it.skip('Adds new storage as plugin and store data there', done => {
var pluginName = storageId + '-plugin';
obj.plugins.add(pluginName, edt => {
edt.StorageManager.add(storageId, storageMock);
@ -163,9 +160,11 @@ describe('GrapesJS', () => {
config.plugins = [pluginName];
var editor = obj.init(config);
editor.setComponents(htmlString);
editor.store();
editor.load((data) => {
expect(data.html).toEqual(htmlString);
editor.store(() => {
editor.load((data) => {
expect(data.html).toEqual(htmlString);
done();
});
});
});
@ -182,8 +181,7 @@ describe('GrapesJS', () => {
expect(editor.customValue).toEqual('TEST');
});
// Problems with iframe loading
it.skip('Execute custom command', () => {
it('Execute custom command', () => {
var editor = obj.init(config);
editor.testVal = '';
editor.setComponents(htmlString);
@ -196,7 +194,7 @@ describe('GrapesJS', () => {
expect(editor.testVal).toEqual(htmlString + '5');
});
it.skip('Stop custom command', () => {
it('Stop custom command', () => {
var editor = obj.init(config);
editor.testVal = '';
editor.setComponents(htmlString);
@ -231,7 +229,7 @@ describe('GrapesJS', () => {
});
// Problems with iframe loading
it.skip('Init new editor with custom plugin overrides default commands', () => {
it('Init new editor with custom plugin overrides default commands', () => {
var editor,
pluginName = 'test-plugin-opts';

13
test/specs/selector_manager/view/ClassTagsView.js

@ -1,5 +1,6 @@
const ClassTagsView = require('selector_manager/view/ClassTagsView');
const Selectors = require('selector_manager/model/Selectors');
const Editor = require('editor/model/Editor');
module.exports = {
run() {
@ -11,6 +12,7 @@ module.exports = {
var testLabel;
var coll;
var target;
var em;
before(() => {
document.body.innerHTML = '<div id="fixtures"></div>';
@ -23,10 +25,8 @@ module.exports = {
});
beforeEach(function () {
target = { get() {} };
target = new Editor();
coll = new Selectors();
_.extend(target, Backbone.Events);
view = new ClassTagsView({
config : { em: target },
collection: coll
@ -74,16 +74,13 @@ module.exports = {
expect(this.input.css('display')).toNotEqual('none');
});
it.skip('Stop tag creation', function() {
it('Stop tag creation', function() {
this.btnAdd.trigger('click');
this.input.val('test')
this.input.trigger('blur');
//(this.btnAdd.css('display') !== 'none').should.equal(true);
//(this.input.css('display') == 'none').should.equal(true);
//this.input.val().should.equal('');
expect(this.btnAdd.css('display')).toNotEqual('none');
expect(this.input.css('display')).toEqual('none');
expect(this.input.val()).toEqual('');
expect(this.input.val()).toEqual(null);
});
it.skip('Check keyup of ESC on input', function() {

Loading…
Cancel
Save