chore(tests): reformat color tests

This commit is contained in:
Nico Rehwaldt 2018-01-30 13:15:41 +01:00
parent 46cd6ea119
commit 38bff969ac

View File

@ -13,14 +13,16 @@ describe('features/modeling - set color', function() {
var diagramXML = require('../../../fixtures/bpmn/simple.bpmn');
var testModules = [ coreModule, modelingModule ];
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
beforeEach(bootstrapModeler(diagramXML, {
modules: [
coreModule,
modelingModule
]
}));
describe('execute', function() {
it('setting fill color', inject(function(elementRegistry, modeling) {
// given
@ -48,7 +50,8 @@ describe('features/modeling - set color', function() {
}));
it('setting fill color without changing stroke color', inject(function(elementRegistry, modeling) {
it('setting fill color without changing stroke color', inject(
function(elementRegistry, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -60,10 +63,12 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.fill).to.equal('YELLOW');
expect(taskShape.businessObject.di.stroke).to.equal('YELLOW');
}));
}
));
it('unsetting fill color without changing stroke color', inject(function(elementRegistry, modeling) {
it('unsetting fill color without changing stroke color', inject(
function(elementRegistry, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -75,9 +80,12 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.fill).not.to.exist;
expect(taskShape.businessObject.di.stroke).to.equal('YELLOW');
}));
}
));
it('unsetting both fill and stroke color', inject(function(elementRegistry, modeling) {
it('unsetting both fill and stroke color', inject(
function(elementRegistry, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -89,7 +97,8 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.fill).not.to.exist;
expect(taskShape.businessObject.di.stroke).not.to.exist;
}));
}
));
it('setting stroke color', inject(function(elementRegistry, modeling) {
@ -121,7 +130,8 @@ describe('features/modeling - set color', function() {
}));
it('setting fill color (multiple elements)', inject(function(elementRegistry, modeling) {
it('setting fill color (multiple elements)', inject(
function(elementRegistry, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -135,10 +145,12 @@ describe('features/modeling - set color', function() {
expect(startEventShape.businessObject.di.fill).to.equal('FUCHSIA');
expect(taskShape.businessObject.di.stroke).not.to.exist;
expect(startEventShape.businessObject.di.stroke).not.to.exist;
}));
}
));
it('unsetting fill color (multiple elements)', inject(function(elementRegistry, modeling) {
it('unsetting fill color (multiple elements)', inject(
function(elementRegistry, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -151,32 +163,42 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.fill).not.to.exist;
expect(startEventShape.businessObject.di.fill).not.to.exist;
}));
}
));
it('setting stroke color (multiple elements)', inject(function(elementRegistry, modeling) {
it('setting stroke color (multiple elements)', inject(
function(elementRegistry, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
var startEventShape = elementRegistry.get('StartEvent_1');
// when
modeling.setColor([ taskShape, startEventShape ], { stroke: 'FUCHSIA' });
modeling.setColor([
taskShape,
startEventShape
], { stroke: 'FUCHSIA' });
// then
expect(taskShape.businessObject.di.stroke).to.equal('FUCHSIA');
expect(startEventShape.businessObject.di.stroke).to.equal('FUCHSIA');
expect(taskShape.businessObject.di.fill).not.to.exist;
expect(startEventShape.businessObject.di.fill).not.to.exist;
}));
}
));
it('unsetting stroke color (multiple elements)', inject(function(elementRegistry, modeling) {
it('unsetting stroke color (multiple elements)', inject(
function(elementRegistry, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
var startEventShape = elementRegistry.get('StartEvent_1');
modeling.setColor([ taskShape, startEventShape ], { stroke: 'FUCHSIA' });
modeling.setColor([
taskShape,
startEventShape
], { stroke: 'FUCHSIA' });
// when
modeling.setColor([ taskShape, startEventShape ]);
@ -184,15 +206,16 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.stroke).not.to.exist;
expect(startEventShape.businessObject.di.stroke).not.to.exist;
}));
}
));
});
describe('undo', function() {
it('setting fill color', inject(function(elementRegistry, commandStack, modeling) {
it('setting fill color', inject(
function(elementRegistry, commandStack, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -203,10 +226,12 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.fill).not.to.exist;
}));
}
));
it('unsetting fill color', inject(function(elementRegistry, commandStack, modeling) {
it('unsetting fill color', inject(
function(elementRegistry, commandStack, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -218,10 +243,12 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.fill).to.equal('FUCHSIA');
}));
}
));
it('setting stroke color', inject(function(elementRegistry, commandStack, modeling) {
it('setting stroke color', inject(
function(elementRegistry, commandStack, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -232,10 +259,12 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.stroke).not.to.exist;
}));
}
));
it('unsetting stroke color', inject(function(elementRegistry, commandStack, modeling) {
it('unsetting stroke color', inject(
function(elementRegistry, commandStack, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -247,10 +276,12 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.stroke).to.equal('FUCHSIA');
}));
}
));
it('setting fill color (multiple elements)', inject(function(elementRegistry, commandStack, modeling) {
it('setting fill color (multiple elements)', inject(
function(elementRegistry, commandStack, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -263,10 +294,12 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.fill).not.to.exist;
expect(startEventShape.businessObject.di.fill).not.to.exist;
}));
}
));
it('unsetting fill color (multiple elements)', inject(function(elementRegistry, commandStack, modeling) {
it('unsetting fill color (multiple elements)', inject(
function(elementRegistry, commandStack, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -280,26 +313,33 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.fill).to.equal('FUCHSIA');
expect(startEventShape.businessObject.di.fill).to.equal('FUCHSIA');
}));
}
));
it('setting stroke color (multiple elements)', inject(function(elementRegistry, commandStack, modeling) {
it('setting stroke color (multiple elements)', inject(
function(elementRegistry, commandStack, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
var startEventShape = elementRegistry.get('StartEvent_1');
// when
modeling.setColor([ taskShape, startEventShape ], { stroke: 'FUCHSIA' });
modeling.setColor([
taskShape,
startEventShape
], { stroke: 'FUCHSIA' });
commandStack.undo();
// then
expect(taskShape.businessObject.di.stroke).not.to.exist;
expect(startEventShape.businessObject.di.stroke).not.to.exist;
}));
}
));
it('unsetting stroke color (multiple elements)', inject(function(elementRegistry, commandStack, modeling) {
it('unsetting stroke color (multiple elements)', inject(
function(elementRegistry, commandStack, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -313,15 +353,16 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.stroke).to.equal('FUCHSIA');
expect(startEventShape.businessObject.di.stroke).to.equal('FUCHSIA');
}));
}
));
});
describe('redo', function() {
it('setting fill color', inject(function(elementRegistry, commandStack, modeling) {
it('setting fill color', inject(
function(elementRegistry, commandStack, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -333,10 +374,12 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.fill).to.equal('FUCHSIA');
}));
}
));
it('unsetting fill color', inject(function(elementRegistry, commandStack, modeling) {
it('unsetting fill color', inject(
function(elementRegistry, commandStack, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -349,10 +392,12 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.fill).not.to.exist;
}));
}
));
it('setting stroke color', inject(function(elementRegistry, commandStack, modeling) {
it('setting stroke color', inject(
function(elementRegistry, commandStack, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -364,10 +409,12 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.stroke).to.equal('FUCHSIA');
}));
}
));
it('unsetting stroke color', inject(function(elementRegistry, commandStack, modeling) {
it('unsetting stroke color', inject(
function(elementRegistry, commandStack, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -380,10 +427,12 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.stroke).not.to.exist;
}));
}
));
it('setting fill color (multiple elements)', inject(function(elementRegistry, commandStack, modeling) {
it('setting fill color (multiple elements)', inject(
function(elementRegistry, commandStack, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -397,10 +446,12 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.fill).to.equal('FUCHSIA');
expect(startEventShape.businessObject.di.fill).to.equal('FUCHSIA');
}));
}
));
it('unsetting fill color (multiple elements)', inject(function(elementRegistry, commandStack, modeling) {
it('unsetting fill color (multiple elements)', inject(
function(elementRegistry, commandStack, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -415,10 +466,12 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.fill).not.to.exist;
expect(startEventShape.businessObject.di.fill).not.to.exist;
}));
}
));
it('setting stroke color (multiple elements)', inject(function(elementRegistry, commandStack, modeling) {
it('setting stroke color (multiple elements)', inject(
function(elementRegistry, commandStack, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
@ -432,15 +485,20 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.stroke).to.equal('FUCHSIA');
expect(startEventShape.businessObject.di.stroke).to.equal('FUCHSIA');
}));
}
));
it('unsetting stroke color (multiple elements)', inject(function(elementRegistry, commandStack, modeling) {
it('unsetting stroke color (multiple elements)', inject(
function(elementRegistry, commandStack, modeling) {
// given
var taskShape = elementRegistry.get('Task_1');
var startEventShape = elementRegistry.get('StartEvent_1');
modeling.setColor([ taskShape, startEventShape ], { stroke: 'FUCHSIA' });
modeling.setColor([
taskShape,
startEventShape
], { stroke: 'FUCHSIA' });
// when
modeling.setColor([ taskShape, startEventShape ]);
@ -450,7 +508,8 @@ describe('features/modeling - set color', function() {
// then
expect(taskShape.businessObject.di.stroke).not.to.exist;
expect(startEventShape.businessObject.di.stroke).not.to.exist;
}));
}
));
});