Browse Source

Fix StyleManager tests

pull/3901/head
Artur Arseniev 5 years ago
parent
commit
d0c00c53d6
  1. 82
      test/specs/style_manager/index.js

82
test/specs/style_manager/index.js

@ -1,28 +1,18 @@
import StyleManager from 'style_manager'; import Editor from 'editor/model/Editor';
import Models from './model/Models';
import SectorView from './view/SectorView';
import SectorsView from './view/SectorsView';
import PropertyView from './view/PropertyView';
import PropertySelectView from './view/PropertySelectView';
import PropertyRadioView from './view/PropertyRadioView';
import PropertyIntegerView from './view/PropertyIntegerView';
import PropertyColorView from './view/PropertyColorView';
import PropertyCompositeView from './view/PropertyCompositeView';
import PropertyStackView from './view/PropertyStackView';
import LayerView from './view/LayerView';
describe('StyleManager', () => { describe('StyleManager', () => {
describe('Main', () => { describe('Main', () => {
var obj; let obj;
let em;
beforeEach(() => { beforeEach(() => {
obj = new StyleManager().init({ em = new Editor({});
sectors: [] obj = em.get('StyleManager');
});
}); });
afterEach(() => { afterEach(() => {
obj = null; obj = null;
em.destroy();
}); });
test('Object exists', () => { test('Object exists', () => {
@ -37,7 +27,7 @@ describe('StyleManager', () => {
obj.addSector('test', { obj.addSector('test', {
name: 'Test name' name: 'Test name'
}); });
var sector = obj.getSectors().at(0); var sector = obj.getSectors()[0];
expect(obj.getSectors().length).toEqual(1); expect(obj.getSectors().length).toEqual(1);
expect(sector.get('id')).toEqual('test'); expect(sector.get('id')).toEqual('test');
expect(sector.get('name')).toEqual('Test name'); expect(sector.get('name')).toEqual('Test name');
@ -127,39 +117,43 @@ describe('StyleManager', () => {
describe('Init with configuration', () => { describe('Init with configuration', () => {
beforeEach(() => { beforeEach(() => {
obj = new StyleManager().init({ em = new Editor({
sectors: [ StyleManager: {
{ sectors: [
id: 'dim', {
name: 'Dimension', id: 'dim',
properties: [ name: 'Dimension',
{ properties: [
name: 'Width', {
property: 'width' name: 'Width',
}, property: 'width'
{ },
name: 'Height', {
property: 'height' name: 'Height',
} property: 'height'
] }
}, ]
{ },
id: 'pos', {
name: 'position', id: 'pos',
properties: [ name: 'position',
{ properties: [
name: 'Width', {
property: 'width' name: 'Width',
} property: 'width'
] }
} ]
] }
]
}
}); });
obj = em.get('StyleManager');
obj.onLoad(); obj.onLoad();
}); });
afterEach(() => { afterEach(() => {
obj = null; obj = null;
em.destroy();
}); });
test('Sectors added', () => { test('Sectors added', () => {

Loading…
Cancel
Save