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.
210 lines
4.5 KiB
210 lines
4.5 KiB
var path = 'StyleManager/model/';
|
|
define([path + 'Sector',
|
|
path + 'Sectors',
|
|
path + 'PropertyFactory',
|
|
path + 'Property',
|
|
path + 'Properties',
|
|
path + 'Layer',
|
|
path + 'Layers'],
|
|
function(Sector,
|
|
Sectors,
|
|
PropertyFactory,
|
|
Property,
|
|
Properties,
|
|
Layer,
|
|
Layers) {
|
|
|
|
return {
|
|
run : function(){
|
|
|
|
describe('Sector', function() {
|
|
|
|
var obj;
|
|
|
|
beforeEach(function () {
|
|
obj = new Sector();
|
|
});
|
|
|
|
afterEach(function () {
|
|
delete obj;
|
|
});
|
|
|
|
it('Has id property', function() {
|
|
obj.has('id').should.equal(true);
|
|
});
|
|
|
|
it('Has no properties', function() {
|
|
obj.get('properties').length.should.equal(0);
|
|
});
|
|
|
|
it('Init with properties', function() {
|
|
obj = new Sector({
|
|
properties: [{}, {}]
|
|
});
|
|
obj.get('properties').length.should.equal(2);
|
|
});
|
|
|
|
});
|
|
|
|
describe('Sectors', function() {
|
|
|
|
var obj;
|
|
|
|
beforeEach(function () {
|
|
obj = new Sectors();
|
|
});
|
|
|
|
afterEach(function () {
|
|
delete obj;
|
|
});
|
|
|
|
it('Object exists', function() {
|
|
obj.should.be.ok;
|
|
});
|
|
|
|
});
|
|
|
|
describe('Property', function() {
|
|
|
|
var obj;
|
|
|
|
beforeEach(function () {
|
|
obj = new Property();
|
|
});
|
|
|
|
afterEach(function () {
|
|
delete obj;
|
|
});
|
|
|
|
it('Has property field', function() {
|
|
obj.has('property').should.equal(true);
|
|
});
|
|
|
|
it('Has no properties', function() {
|
|
obj.get('properties').length.should.equal(0);
|
|
});
|
|
|
|
it('Has no layers', function() {
|
|
obj.get('layers').length.should.equal(0);
|
|
});
|
|
|
|
});
|
|
|
|
describe('Properties', function() {
|
|
|
|
var obj;
|
|
|
|
beforeEach(function () {
|
|
obj = new Properties();
|
|
});
|
|
|
|
afterEach(function () {
|
|
delete obj;
|
|
});
|
|
|
|
it('Object exists', function() {
|
|
obj.should.be.ok;
|
|
});
|
|
|
|
});
|
|
|
|
describe('Layer', function() {
|
|
|
|
var obj;
|
|
|
|
beforeEach(function () {
|
|
obj = new Layer();
|
|
});
|
|
|
|
afterEach(function () {
|
|
delete obj;
|
|
});
|
|
|
|
it('Has index property', function() {
|
|
obj.has('index').should.equal(true);
|
|
});
|
|
|
|
it('Is active', function() {
|
|
obj.get('active').should.equal(true);
|
|
});
|
|
|
|
});
|
|
|
|
describe('Layers', function() {
|
|
|
|
var obj;
|
|
|
|
beforeEach(function () {
|
|
obj = new Layers();
|
|
});
|
|
|
|
afterEach(function () {
|
|
delete obj;
|
|
});
|
|
|
|
it('Object exists', function() {
|
|
obj.should.be.ok;
|
|
});
|
|
|
|
it('Init index on add', function() {
|
|
var model = obj.add({});
|
|
model.get('index').should.equal(1);
|
|
});
|
|
|
|
it('Increment index', function() {
|
|
var model = obj.add({});
|
|
var model2 = obj.add({});
|
|
model2.get('index').should.equal(2);
|
|
});
|
|
|
|
it('Cache index', function() {
|
|
var model = obj.add({});
|
|
var model2 = obj.add({});
|
|
obj.remove(model2);
|
|
var model3 = obj.add({});
|
|
model3.get('index').should.equal(3);
|
|
});
|
|
|
|
it('Reset index on reset', function() {
|
|
var model = obj.add({});
|
|
var model2 = obj.add({});
|
|
obj.reset();
|
|
obj.idx.should.equal(1);
|
|
});
|
|
|
|
});
|
|
|
|
describe('PropertyFactory', function() {
|
|
|
|
var obj;
|
|
|
|
beforeEach(function () {
|
|
obj = new PropertyFactory();
|
|
});
|
|
|
|
afterEach(function () {
|
|
delete obj;
|
|
});
|
|
|
|
it('Object exists', function() {
|
|
obj.should.be.ok;
|
|
});
|
|
|
|
it('Build single prop', function() {
|
|
obj.build(['float']).should.deep.equal([{
|
|
property: 'float',
|
|
type: 'radio',
|
|
defaults: 'none',
|
|
list: [
|
|
{value: 'none'},
|
|
{value: 'left'},
|
|
{value: 'right'},
|
|
],
|
|
}]);
|
|
});
|
|
});
|
|
|
|
}
|
|
};
|
|
|
|
});
|