mirror of https://github.com/artf/grapesjs.git
nocodeframeworkdrag-and-dropsite-buildersite-generatortemplate-builderui-builderweb-builderweb-builder-frameworkwebsite-builderno-codepage-builder
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.7 KiB
82 lines
2.7 KiB
define(function(require, exports, module){
|
|
'use strict';
|
|
var Selectors = require('undefined');
|
|
var Selector = require('SelectorManager/model/Selector');
|
|
|
|
module.exports = {
|
|
run : function(){
|
|
describe('CssRule', function() {
|
|
|
|
beforeEach(function () {
|
|
this.obj = new CssRule();
|
|
});
|
|
|
|
afterEach(function () {
|
|
delete this.obj;
|
|
});
|
|
|
|
it('Has selectors property', function() {
|
|
this.obj.has('selectors').should.equal(true);
|
|
});
|
|
|
|
it('Has style property', function() {
|
|
this.obj.has('style').should.equal(true);
|
|
});
|
|
|
|
it('Has state property', function() {
|
|
this.obj.has('state').should.equal(true);
|
|
});
|
|
|
|
it('No default selectors', function() {
|
|
this.obj.get('selectors').length.should.equal(0);
|
|
});
|
|
|
|
it('Compare returns true with the same selectors', function() {
|
|
var s1 = this.obj.get('selectors').add({ name: 'test1' });
|
|
var s2 = this.obj.get('selectors').add({ name: 'test2' });
|
|
this.obj.compare([s1, s2]).should.equal(true);
|
|
});
|
|
|
|
it('Compare with different state', function() {
|
|
var s1 = this.obj.get('selectors').add({ name: 'test1' });
|
|
var s2 = this.obj.get('selectors').add({ name: 'test2' });
|
|
this.obj.set('state','hover');
|
|
this.obj.compare([s1, s2]).should.equal(false);
|
|
this.obj.compare([s1, s2], 'hover').should.equal(true);
|
|
});
|
|
|
|
it('Compare with different mediaText', function() {
|
|
var s1 = this.obj.get('selectors').add({ name: 'test1' });
|
|
var s2 = this.obj.get('selectors').add({ name: 'test2' });
|
|
this.obj.set('state','hover');
|
|
this.obj.set('mediaText','1000');
|
|
this.obj.compare([s1, s2]).should.equal(false);
|
|
this.obj.compare([s1, s2], 'hover').should.equal(false);
|
|
this.obj.compare([s2, s1], 'hover', '1000').should.equal(true);
|
|
});
|
|
|
|
});
|
|
|
|
describe('CssRules', function() {
|
|
|
|
it('Creates collection item correctly', function() {
|
|
var c = new CssRules();
|
|
var m = c.add({});
|
|
m.should.be.an.instanceOf(CssRule);
|
|
});
|
|
|
|
});
|
|
|
|
describe('Selectors', function() {
|
|
|
|
it('Creates collection item correctly', function() {
|
|
var c = new Selectors();
|
|
var m = c.add({});
|
|
m.should.be.an.instanceOf(Selector);
|
|
});
|
|
|
|
});
|
|
}
|
|
};
|
|
|
|
});
|