[Code Style] Run gulp fixstyle
...to apply code style settings from #142.
This commit is contained in:
@@ -57,4 +57,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -44,10 +44,10 @@ define(
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getModel', 'getCapability' ]
|
||||
['getId', 'getModel', 'getCapability']
|
||||
);
|
||||
testModel = {
|
||||
composition: [ 'a', 'b', 'c', 'd', 'e', 'f' ]
|
||||
composition: ['a', 'b', 'c', 'd', 'e', 'f']
|
||||
};
|
||||
mockDomainObject.getModel.andReturn(testModel);
|
||||
});
|
||||
@@ -58,7 +58,7 @@ define(
|
||||
});
|
||||
|
||||
it("returns nothing when composition is exceeded", function () {
|
||||
testModel.composition = [ 'foo' ];
|
||||
testModel.composition = ['foo'];
|
||||
expect(column.value(mockDomainObject)).toEqual("");
|
||||
});
|
||||
|
||||
@@ -70,4 +70,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -36,20 +36,20 @@ define(
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getModel', 'getCapability', 'hasCapability' ]
|
||||
['getId', 'getModel', 'getCapability', 'hasCapability']
|
||||
);
|
||||
mockType = jasmine.createSpyObj('type', [ 'instanceOf' ]);
|
||||
mockType = jasmine.createSpyObj('type', ['instanceOf']);
|
||||
mockExportService = jasmine.createSpyObj(
|
||||
'exportService',
|
||||
[ 'exportCSV' ]
|
||||
['exportCSV']
|
||||
);
|
||||
mockNotificationService = jasmine.createSpyObj(
|
||||
'notificationService',
|
||||
[ 'notify', 'error' ]
|
||||
['notify', 'error']
|
||||
);
|
||||
mockNotification = jasmine.createSpyObj(
|
||||
'notification',
|
||||
[ 'dismiss' ]
|
||||
['dismiss']
|
||||
);
|
||||
|
||||
mockNotificationService.notify.andReturn(mockNotification);
|
||||
@@ -149,4 +149,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -34,7 +34,7 @@ define(
|
||||
beforeEach(function () {
|
||||
mockExportService = jasmine.createSpyObj(
|
||||
'exportService',
|
||||
[ 'exportCSV' ]
|
||||
['exportCSV']
|
||||
);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
|
||||
@@ -42,7 +42,7 @@ define(
|
||||
testId = "foo";
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getModel', 'getCapability' ]
|
||||
['getId', 'getModel', 'getCapability']
|
||||
);
|
||||
mockDomainObject.getId.andReturn(testId);
|
||||
});
|
||||
@@ -55,4 +55,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -44,7 +44,7 @@ define(
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getModel', 'getCapability', 'useCapability' ]
|
||||
['getId', 'getModel', 'getCapability', 'useCapability']
|
||||
);
|
||||
testMetadata = [
|
||||
{ name: "Something else", value: 123 },
|
||||
@@ -72,4 +72,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -44,11 +44,11 @@ define(
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getModel', 'getCapability' ]
|
||||
['getId', 'getModel', 'getCapability']
|
||||
);
|
||||
testModel = {
|
||||
relationships: {
|
||||
modes: [ 'a', 'b', 'c', 'd', 'e', 'f' ]
|
||||
modes: ['a', 'b', 'c', 'd', 'e', 'f']
|
||||
}
|
||||
};
|
||||
mockDomainObject.getModel.andReturn(testModel);
|
||||
@@ -60,7 +60,7 @@ define(
|
||||
});
|
||||
|
||||
it("returns nothing when relationships are exceeded", function () {
|
||||
testModel.relationships.modes = [ 'foo' ];
|
||||
testModel.relationships.modes = ['foo'];
|
||||
expect(column.value(mockDomainObject)).toEqual("");
|
||||
});
|
||||
|
||||
@@ -72,4 +72,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -50,7 +50,7 @@ define(
|
||||
beforeEach(function () {
|
||||
var mockTimespan = jasmine.createSpyObj(
|
||||
'timespan',
|
||||
[ 'getStart', 'getEnd' ]
|
||||
['getStart', 'getEnd']
|
||||
);
|
||||
|
||||
testMetadata = [
|
||||
@@ -59,8 +59,8 @@ define(
|
||||
];
|
||||
|
||||
mockDomainObjects = [
|
||||
{ composition: [ 'a', 'b', 'c' ] },
|
||||
{ relationships: { modes: [ 'x', 'y' ] } },
|
||||
{ composition: ['a', 'b', 'c'] },
|
||||
{ relationships: { modes: ['x', 'y'] } },
|
||||
{ }
|
||||
].map(makeMockDomainObject);
|
||||
|
||||
|
||||
@@ -82,9 +82,9 @@ define([
|
||||
|
||||
beforeEach(function () {
|
||||
testModels = {
|
||||
a: { composition: [ 'b', 'c' ]},
|
||||
b: { composition: [ 'c' ] },
|
||||
c: { relationships: { modes: [ 'd' ] } },
|
||||
a: { composition: ['b', 'c']},
|
||||
b: { composition: ['c'] },
|
||||
c: { relationships: { modes: ['d'] } },
|
||||
d: {},
|
||||
unreachable: {}
|
||||
};
|
||||
@@ -132,4 +132,4 @@ define([
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -36,11 +36,11 @@ define(
|
||||
};
|
||||
mockTimespan = jasmine.createSpyObj(
|
||||
'timespan',
|
||||
[ 'getStart', 'getEnd' ]
|
||||
['getStart', 'getEnd']
|
||||
);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'useCapability', 'hasCapability' ]
|
||||
['useCapability', 'hasCapability']
|
||||
);
|
||||
mockTimespan.getStart.andReturn(testTimes.start);
|
||||
mockTimespan.getEnd.andReturn(testTimes.end);
|
||||
@@ -52,7 +52,7 @@ define(
|
||||
});
|
||||
});
|
||||
|
||||
[ "start", "end" ].forEach(function (bound) {
|
||||
["start", "end"].forEach(function (bound) {
|
||||
describe("when referring to " + bound + " times", function () {
|
||||
var name = bound.charAt(0).toUpperCase() + bound.slice(1);
|
||||
|
||||
@@ -90,4 +90,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -41,7 +41,7 @@ define(
|
||||
mockQ = jasmine.createSpyObj('$q', ['when']);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getModel', 'getCapability' ]
|
||||
['getModel', 'getCapability']
|
||||
);
|
||||
|
||||
mockQ.when.andCallFake(asPromise);
|
||||
|
||||
@@ -96,4 +96,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -36,4 +36,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -31,7 +31,7 @@ define(
|
||||
beforeEach(function () {
|
||||
var mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getModel', 'getId' ]
|
||||
['getModel', 'getId']
|
||||
);
|
||||
|
||||
testModel = {
|
||||
|
||||
@@ -30,11 +30,11 @@ define(
|
||||
graph;
|
||||
|
||||
beforeEach(function () {
|
||||
points = [ 0, 10, -10, -100, 20, 100, 0 ];
|
||||
points = [0, 10, -10, -100, 20, 100, 0];
|
||||
|
||||
mockGraph = jasmine.createSpyObj(
|
||||
'graph',
|
||||
[ 'getPointCount', 'getDomainValue', 'getRangeValue' ]
|
||||
['getPointCount', 'getDomainValue', 'getRangeValue']
|
||||
);
|
||||
|
||||
mockGraph.getPointCount.andReturn(points.length * 2);
|
||||
@@ -83,4 +83,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -42,7 +42,7 @@ define(
|
||||
mockQ = jasmine.createSpyObj('$q', ['when']);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getModel', 'useCapability' ]
|
||||
['getId', 'getModel', 'useCapability']
|
||||
);
|
||||
|
||||
testModel = {
|
||||
|
||||
@@ -43,14 +43,14 @@ define(
|
||||
expect(graph.getPointCount()).toEqual(16);
|
||||
|
||||
// Should get two values at every time stamp, for step-like appearance
|
||||
[ 5, 15, 40, 50, 100, 120, 150, 180].forEach(function (v, i) {
|
||||
[5, 15, 40, 50, 100, 120, 150, 180].forEach(function (v, i) {
|
||||
expect(graph.getDomainValue(i * 2)).toEqual(v);
|
||||
expect(graph.getDomainValue(i * 2 + 1)).toEqual(v);
|
||||
});
|
||||
|
||||
// Should also repeat values at subsequent indexes, but offset differently,
|
||||
// for horizontal spans between steps
|
||||
[ 0, 42, 72, 42, 20, -22, 0, -10].forEach(function (v, i) {
|
||||
[0, 42, 72, 42, 20, -22, 0, -10].forEach(function (v, i) {
|
||||
expect(graph.getRangeValue(i * 2)).toEqual(v);
|
||||
// Offset backwards; wrap around end of the series
|
||||
expect(graph.getRangeValue((16 + i * 2 - 1) % 16)).toEqual(v);
|
||||
@@ -72,4 +72,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -45,30 +45,34 @@ define(
|
||||
mockQ = jasmine.createSpyObj('$q', ['when', 'all']);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getModel', 'getCapability', 'useCapability' ]
|
||||
['getModel', 'getCapability', 'useCapability']
|
||||
);
|
||||
mockChildA = jasmine.createSpyObj(
|
||||
'childA',
|
||||
[ 'getModel', 'useCapability', 'hasCapability' ]
|
||||
['getModel', 'useCapability', 'hasCapability']
|
||||
);
|
||||
mockChildB = jasmine.createSpyObj(
|
||||
'childA',
|
||||
[ 'getModel', 'useCapability', 'hasCapability' ]
|
||||
['getModel', 'useCapability', 'hasCapability']
|
||||
);
|
||||
mockTimespanA = jasmine.createSpyObj(
|
||||
'timespanA',
|
||||
[ 'getEnd' ]
|
||||
['getEnd']
|
||||
);
|
||||
mockTimespanB = jasmine.createSpyObj(
|
||||
'timespanB',
|
||||
[ 'getEnd' ]
|
||||
['getEnd']
|
||||
);
|
||||
|
||||
mockQ.when.andCallFake(asPromise);
|
||||
mockQ.all.andCallFake(function (values) {
|
||||
var result = [];
|
||||
function addResult(v) { result.push(v); }
|
||||
function promiseResult(v) { asPromise(v).then(addResult); }
|
||||
function addResult(v) {
|
||||
result.push(v);
|
||||
}
|
||||
function promiseResult(v) {
|
||||
asPromise(v).then(addResult);
|
||||
}
|
||||
values.forEach(promiseResult);
|
||||
return asPromise(result);
|
||||
});
|
||||
@@ -83,7 +87,7 @@ define(
|
||||
});
|
||||
mockDomainObject.useCapability.andCallFake(function (c) {
|
||||
if (c === 'composition') {
|
||||
return asPromise([ mockChildA, mockChildB ]);
|
||||
return asPromise([mockChildA, mockChildB]);
|
||||
}
|
||||
});
|
||||
mockChildA.hasCapability.andReturn(true);
|
||||
|
||||
@@ -51,7 +51,7 @@ define(
|
||||
mutationModel = JSON.parse(JSON.stringify(testModel));
|
||||
|
||||
mockMutation = jasmine.createSpyObj("mutation", ["mutate"]);
|
||||
mockTimespans = [ 44000, 65000, 1100 ].map(makeMockTimespan);
|
||||
mockTimespans = [44000, 65000, 1100].map(makeMockTimespan);
|
||||
|
||||
mockMutation.mutate.andCallFake(function (mutator) {
|
||||
mutator(mutationModel);
|
||||
@@ -107,4 +107,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -36,4 +36,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -84,15 +84,15 @@ define(
|
||||
mockQ = jasmine.createSpyObj('$q', ['when', 'all']);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getModel', 'getCapability', 'useCapability' ]
|
||||
['getId', 'getModel', 'getCapability', 'useCapability']
|
||||
);
|
||||
mockRelationship = jasmine.createSpyObj(
|
||||
'relationship',
|
||||
[ 'getRelatedObjects' ]
|
||||
['getRelatedObjects']
|
||||
);
|
||||
mockComposition = jasmine.createSpyObj(
|
||||
'composition',
|
||||
[ 'invoke' ]
|
||||
['invoke']
|
||||
);
|
||||
mockCallback = jasmine.createSpy('callback');
|
||||
|
||||
|
||||
@@ -48,4 +48,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -99,7 +99,7 @@ define(
|
||||
|
||||
mockScope = jasmine.createSpyObj(
|
||||
"$scope",
|
||||
[ '$watch', '$on' ]
|
||||
['$watch', '$on']
|
||||
);
|
||||
mockLoader = jasmine.createSpyObj('objectLoader', ['load']);
|
||||
mockDomainObject = mockA;
|
||||
@@ -245,4 +245,4 @@ define(
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -61,7 +61,9 @@ define(
|
||||
mockTimespan.getDuration.andReturn(50);
|
||||
mockTimespan.getEnd.andReturn(150);
|
||||
|
||||
mockToPixels.andCallFake(function (t) { return t * 10; });
|
||||
mockToPixels.andCallFake(function (t) {
|
||||
return t * 10;
|
||||
});
|
||||
|
||||
controller = new TimelineGanttController(TEST_MAX_OFFSCREEN);
|
||||
});
|
||||
@@ -96,4 +98,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -32,7 +32,7 @@ define(
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
'$scope',
|
||||
[ '$watchCollection' ]
|
||||
['$watchCollection']
|
||||
);
|
||||
testResources = [
|
||||
{ key: 'abc', name: "Some name" },
|
||||
@@ -58,7 +58,7 @@ define(
|
||||
|
||||
// Supply new parameters
|
||||
mockScope.$watchCollection.mostRecentCall.args[1]({
|
||||
graphs: [ mockGraphA, mockGraphB ],
|
||||
graphs: [mockGraphA, mockGraphB],
|
||||
origin: 9,
|
||||
duration: 144
|
||||
});
|
||||
|
||||
@@ -38,7 +38,7 @@ define(
|
||||
// This controller's job is just to expose the formatter
|
||||
// in scope, so simply verify that the two agree.
|
||||
it("formats durations", function () {
|
||||
[ 0, 100, 4123, 93600, 748801230012].forEach(function (n) {
|
||||
[0, 100, 4123, 93600, 748801230012].forEach(function (n) {
|
||||
expect(controller.niceTime(n))
|
||||
.toEqual(formatter.format(n));
|
||||
});
|
||||
|
||||
@@ -83,4 +83,4 @@ define(
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -90,7 +90,9 @@ define(
|
||||
mockScope.domainObject.getCapability.andCallFake(function (c) {
|
||||
if (c === 'editor') {
|
||||
return {
|
||||
inEditContext: function () {return true;}
|
||||
inEditContext: function () {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
@@ -35,19 +35,19 @@ define(
|
||||
beforeEach(function () {
|
||||
mockDragHandler = jasmine.createSpyObj(
|
||||
'dragHandler',
|
||||
[ 'start' ]
|
||||
['start']
|
||||
);
|
||||
mockSnapHandler = jasmine.createSpyObj(
|
||||
'snapHandler',
|
||||
[ 'snap' ]
|
||||
['snap']
|
||||
);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getCapability', 'getId' ]
|
||||
['getCapability', 'getId']
|
||||
);
|
||||
mockType = jasmine.createSpyObj(
|
||||
'type',
|
||||
[ 'instanceOf' ]
|
||||
['instanceOf']
|
||||
);
|
||||
|
||||
mockDomainObject.getId.andReturn('test-id');
|
||||
|
||||
@@ -81,15 +81,15 @@ define(
|
||||
['a', 'b', 'c', 'd', 'e', 'f'].forEach(function (id, index) {
|
||||
mockTimespans[id] = jasmine.createSpyObj(
|
||||
'timespan-' + id,
|
||||
[ 'getStart', 'getEnd', 'getDuration', 'setStart', 'setEnd', 'setDuration' ]
|
||||
['getStart', 'getEnd', 'getDuration', 'setStart', 'setEnd', 'setDuration']
|
||||
);
|
||||
mockPersists[id] = jasmine.createSpyObj(
|
||||
'persistence-' + id,
|
||||
[ 'persist' ]
|
||||
['persist']
|
||||
);
|
||||
mockMutations[id] = jasmine.createSpyObj(
|
||||
'mutation-' + id,
|
||||
[ 'mutate' ]
|
||||
['mutate']
|
||||
);
|
||||
mockTimespans[id].getStart.andReturn(index * 1000);
|
||||
mockTimespans[id].getDuration.andReturn(4000 + index);
|
||||
@@ -225,4 +225,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -69,4 +69,4 @@ define(
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -33,15 +33,15 @@ define(
|
||||
beforeEach(function () {
|
||||
mockDragHandler = jasmine.createSpyObj(
|
||||
'dragHandler',
|
||||
[ 'end', 'persist' ]
|
||||
['end', 'persist']
|
||||
);
|
||||
mockSnapHandler = jasmine.createSpyObj(
|
||||
'snapHandler',
|
||||
[ 'snap' ]
|
||||
['snap']
|
||||
);
|
||||
mockZoomController = jasmine.createSpyObj(
|
||||
'zoom',
|
||||
[ 'toMillis', 'toPixels' ]
|
||||
['toMillis', 'toPixels']
|
||||
);
|
||||
|
||||
mockDragHandler.end.andReturn(12321);
|
||||
@@ -112,4 +112,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -33,15 +33,15 @@ define(
|
||||
beforeEach(function () {
|
||||
mockDragHandler = jasmine.createSpyObj(
|
||||
'dragHandler',
|
||||
[ 'start', 'duration', 'end', 'move', 'persist' ]
|
||||
['start', 'duration', 'end', 'move', 'persist']
|
||||
);
|
||||
mockSnapHandler = jasmine.createSpyObj(
|
||||
'snapHandler',
|
||||
[ 'snap' ]
|
||||
['snap']
|
||||
);
|
||||
mockZoomController = jasmine.createSpyObj(
|
||||
'zoom',
|
||||
[ 'toMillis', 'toPixels' ]
|
||||
['toMillis', 'toPixels']
|
||||
);
|
||||
|
||||
mockDragHandler.start.andReturn(12321);
|
||||
@@ -179,4 +179,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -34,7 +34,7 @@ define(
|
||||
|
||||
mockDragHandler = jasmine.createSpyObj(
|
||||
'dragHandler',
|
||||
[ 'start', 'end', 'ids' ]
|
||||
['start', 'end', 'ids']
|
||||
);
|
||||
|
||||
mockDragHandler.ids.andReturn(['a', 'b', 'c', 'd']);
|
||||
@@ -76,4 +76,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -33,15 +33,15 @@ define(
|
||||
beforeEach(function () {
|
||||
mockDragHandler = jasmine.createSpyObj(
|
||||
'dragHandler',
|
||||
[ 'start', 'persist' ]
|
||||
['start', 'persist']
|
||||
);
|
||||
mockSnapHandler = jasmine.createSpyObj(
|
||||
'snapHandler',
|
||||
[ 'snap' ]
|
||||
['snap']
|
||||
);
|
||||
mockZoomController = jasmine.createSpyObj(
|
||||
'zoom',
|
||||
[ 'toMillis', 'toPixels' ]
|
||||
['toMillis', 'toPixels']
|
||||
);
|
||||
|
||||
mockDragHandler.start.andReturn(12321);
|
||||
@@ -111,4 +111,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -48,9 +48,9 @@ define(
|
||||
|
||||
beforeEach(function () {
|
||||
testResources = {
|
||||
a: [ 'xyz', 'abc' ],
|
||||
b: [ 'xyz' ],
|
||||
c: [ 'xyz', 'abc', 'def', 'ghi' ]
|
||||
a: ['xyz', 'abc'],
|
||||
b: ['xyz'],
|
||||
c: ['xyz', 'abc', 'def', 'ghi']
|
||||
};
|
||||
|
||||
mockQ = jasmine.createSpyObj('$q', ['when', 'all']);
|
||||
@@ -58,16 +58,16 @@ define(
|
||||
mockSwimlanes = ['a', 'b', 'c'].map(function (k) {
|
||||
var mockSwimlane = jasmine.createSpyObj(
|
||||
'swimlane-' + k,
|
||||
[ 'graph', 'color' ]
|
||||
['graph', 'color']
|
||||
),
|
||||
mockGraph = jasmine.createSpyObj(
|
||||
'graph-' + k,
|
||||
[ 'getPointCount', 'getDomainValue', 'getRangeValue' ]
|
||||
['getPointCount', 'getDomainValue', 'getRangeValue']
|
||||
);
|
||||
mockSwimlane.graph.andReturn(true);
|
||||
mockSwimlane.domainObject = jasmine.createSpyObj(
|
||||
'domainObject-' + k,
|
||||
[ 'getCapability', 'hasCapability', 'useCapability', 'getId' ]
|
||||
['getCapability', 'hasCapability', 'useCapability', 'getId']
|
||||
);
|
||||
mockSwimlane.color.andReturn('#' + k);
|
||||
// Provide just enough information about graphs to support
|
||||
@@ -148,4 +148,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -72,4 +72,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -42,9 +42,9 @@ define(
|
||||
|
||||
beforeEach(function () {
|
||||
testColors = {
|
||||
a: [ 0, 1, 0 ],
|
||||
b: [ 1, 0, 1 ],
|
||||
c: [ 1, 0, 0 ]
|
||||
a: [0, 1, 0],
|
||||
b: [1, 0, 1],
|
||||
c: [1, 0, 0]
|
||||
};
|
||||
|
||||
mockGraphs = [];
|
||||
@@ -53,11 +53,11 @@ define(
|
||||
['a', 'b', 'c'].forEach(function (k, i) {
|
||||
var mockGraph = jasmine.createSpyObj(
|
||||
'utilization-' + k,
|
||||
[ 'getPointCount', 'getDomainValue', 'getRangeValue' ]
|
||||
['getPointCount', 'getDomainValue', 'getRangeValue']
|
||||
);
|
||||
mockDomainObjects[k] = jasmine.createSpyObj(
|
||||
'domainObject-' + k,
|
||||
[ 'getCapability', 'useCapability' ]
|
||||
['getCapability', 'useCapability']
|
||||
);
|
||||
mockDomainObjects[k].useCapability.andReturn(asPromise({
|
||||
testResource: mockGraph
|
||||
@@ -72,7 +72,7 @@ define(
|
||||
|
||||
mockRenderer = jasmine.createSpyObj(
|
||||
'renderer',
|
||||
[ 'render', 'decode' ]
|
||||
['render', 'decode']
|
||||
);
|
||||
|
||||
mockRenderer.render.andCallFake(function (utilization) {
|
||||
@@ -167,4 +167,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -49,10 +49,14 @@ define(
|
||||
var colors = {}, i, ids = [];
|
||||
|
||||
// Add item to set
|
||||
function set(c) { colors[c] = true; }
|
||||
function set(c) {
|
||||
colors[c] = true;
|
||||
}
|
||||
|
||||
// Generate ids
|
||||
for (i = 0; i < 30; i += 1) { ids.push("id" + i); }
|
||||
for (i = 0; i < 30; i += 1) {
|
||||
ids.push("id" + i);
|
||||
}
|
||||
|
||||
// Assign colors to each id, then retrieve colors,
|
||||
// storing into the set
|
||||
|
||||
@@ -38,16 +38,16 @@ define(
|
||||
);
|
||||
mockSelection = jasmine.createSpyObj(
|
||||
'selection',
|
||||
[ 'get' ]
|
||||
['get']
|
||||
);
|
||||
mockActionCapability = jasmine.createSpyObj(
|
||||
'action',
|
||||
[ 'getActions' ]
|
||||
['getActions']
|
||||
);
|
||||
mockActions = ['a', 'b', 'c'].map(function (type) {
|
||||
var mockAction = jasmine.createSpyObj(
|
||||
'action-' + type,
|
||||
[ 'perform', 'getMetadata' ]
|
||||
['perform', 'getMetadata']
|
||||
);
|
||||
mockAction.getMetadata.andReturn({ type: type });
|
||||
return mockAction;
|
||||
|
||||
@@ -43,7 +43,7 @@ define(
|
||||
|
||||
mockSwimlane.domainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getCapability', 'getModel' ]
|
||||
['getCapability', 'getModel']
|
||||
);
|
||||
|
||||
mockCapabilities.mutation = jasmine.createSpyObj(
|
||||
@@ -158,11 +158,11 @@ define(
|
||||
it("fires the 'remove' action when remove is called", function () {
|
||||
var mockChild = jasmine.createSpyObj(
|
||||
'childObject',
|
||||
[ 'getCapability', 'getModel' ]
|
||||
['getCapability', 'getModel']
|
||||
),
|
||||
mockAction = jasmine.createSpyObj(
|
||||
'action',
|
||||
[ 'perform' ]
|
||||
['perform']
|
||||
);
|
||||
|
||||
mockChild.getCapability.andCallFake(function (c) {
|
||||
|
||||
@@ -41,28 +41,28 @@ define(
|
||||
|
||||
mockSwimlane = jasmine.createSpyObj(
|
||||
"swimlane",
|
||||
[ "highlight", "highlightBottom" ]
|
||||
["highlight", "highlightBottom"]
|
||||
);
|
||||
// domainObject, idPath, children, expanded
|
||||
mockSwimlane.domainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getId", "getCapability", "useCapability", "hasCapability" ]
|
||||
["getId", "getCapability", "useCapability", "hasCapability"]
|
||||
);
|
||||
mockSwimlane.idPath = [ 'a', 'b' ];
|
||||
mockSwimlane.children = [ {} ];
|
||||
mockSwimlane.idPath = ['a', 'b'];
|
||||
mockSwimlane.children = [{}];
|
||||
mockSwimlane.expanded = true;
|
||||
|
||||
mockSwimlane.parent = {};
|
||||
mockSwimlane.parent.idPath = ['a'];
|
||||
mockSwimlane.parent.domainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getId", "getCapability", "useCapability", "hasCapability" ]
|
||||
["getId", "getCapability", "useCapability", "hasCapability"]
|
||||
);
|
||||
mockSwimlane.parent.children = [ mockSwimlane ];
|
||||
mockSwimlane.parent.children = [mockSwimlane];
|
||||
|
||||
mockSwimlane.children[0].domainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getId", "getCapability", "useCapability", "hasCapability" ]
|
||||
["getId", "getCapability", "useCapability", "hasCapability"]
|
||||
);
|
||||
|
||||
mockAction = jasmine.createSpyObj('action', ['perform']);
|
||||
@@ -73,11 +73,11 @@ define(
|
||||
|
||||
mockOtherObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getId", "getCapability", "useCapability", "hasCapability" ]
|
||||
["getId", "getCapability", "useCapability", "hasCapability"]
|
||||
);
|
||||
mockActionCapability = jasmine.createSpyObj("action", ["perform", "getActions"]);
|
||||
mockPersistence = jasmine.createSpyObj("persistence", ["persist"]);
|
||||
mockContext = jasmine.createSpyObj('context', [ 'getParent' ]);
|
||||
mockContext = jasmine.createSpyObj('context', ['getParent']);
|
||||
|
||||
mockActionCapability.getActions.andReturn([mockAction]);
|
||||
mockSwimlane.parent.domainObject.getId.andReturn('a');
|
||||
@@ -152,7 +152,7 @@ define(
|
||||
});
|
||||
|
||||
it("inserts into when highlighted", function () {
|
||||
var testModel = { composition: [ 'c' ] };
|
||||
var testModel = { composition: ['c'] };
|
||||
mockSwimlane.highlight.andReturn(true);
|
||||
handler.drop('d', mockOtherObject);
|
||||
// Should have mutated
|
||||
@@ -167,7 +167,7 @@ define(
|
||||
});
|
||||
|
||||
it("inserts after as a peer when highlighted at the bottom", function () {
|
||||
var testModel = { composition: [ 'x', 'b', 'y' ] };
|
||||
var testModel = { composition: ['x', 'b', 'y'] };
|
||||
mockSwimlane.highlightBottom.andReturn(true);
|
||||
mockSwimlane.expanded = false;
|
||||
handler.drop('d', mockOtherObject);
|
||||
@@ -177,11 +177,11 @@ define(
|
||||
// Run the mutator
|
||||
mockSwimlane.parent.domainObject.useCapability.mostRecentCall
|
||||
.args[1](testModel);
|
||||
expect(testModel.composition).toEqual([ 'x', 'b', 'd', 'y']);
|
||||
expect(testModel.composition).toEqual(['x', 'b', 'd', 'y']);
|
||||
});
|
||||
|
||||
it("inserts into when highlighted at the bottom and expanded", function () {
|
||||
var testModel = { composition: [ 'c' ] };
|
||||
var testModel = { composition: ['c'] };
|
||||
mockSwimlane.highlightBottom.andReturn(true);
|
||||
mockSwimlane.expanded = true;
|
||||
handler.drop('d', mockOtherObject);
|
||||
@@ -191,11 +191,11 @@ define(
|
||||
// Run the mutator
|
||||
mockSwimlane.domainObject.useCapability.mostRecentCall
|
||||
.args[1](testModel);
|
||||
expect(testModel.composition).toEqual([ 'd', 'c' ]);
|
||||
expect(testModel.composition).toEqual(['d', 'c']);
|
||||
});
|
||||
|
||||
it("inserts after as a peer when highlighted at the bottom and childless", function () {
|
||||
var testModel = { composition: [ 'x', 'b', 'y' ] };
|
||||
var testModel = { composition: ['x', 'b', 'y'] };
|
||||
mockSwimlane.highlightBottom.andReturn(true);
|
||||
mockSwimlane.expanded = true;
|
||||
mockSwimlane.children = [];
|
||||
@@ -206,11 +206,11 @@ define(
|
||||
// Run the mutator
|
||||
mockSwimlane.parent.domainObject.useCapability.mostRecentCall
|
||||
.args[1](testModel);
|
||||
expect(testModel.composition).toEqual([ 'x', 'b', 'd', 'y']);
|
||||
expect(testModel.composition).toEqual(['x', 'b', 'd', 'y']);
|
||||
});
|
||||
|
||||
it("allows reordering within a parent", function () {
|
||||
var testModel = { composition: [ 'x', 'b', 'y', 'd' ] };
|
||||
var testModel = { composition: ['x', 'b', 'y', 'd'] };
|
||||
|
||||
mockSwimlane.highlightBottom.andReturn(true);
|
||||
mockSwimlane.expanded = true;
|
||||
@@ -227,7 +227,7 @@ define(
|
||||
runs(function () {
|
||||
mockSwimlane.parent.domainObject.useCapability.mostRecentCall
|
||||
.args[1](testModel);
|
||||
expect(testModel.composition).toEqual([ 'x', 'b', 'd', 'y']);
|
||||
expect(testModel.composition).toEqual(['x', 'b', 'd', 'y']);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -160,4 +160,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -36,7 +36,9 @@ define(
|
||||
testConfiguration;
|
||||
|
||||
function asPromise(v) {
|
||||
return { then: function (cb) { cb(v); } };
|
||||
return { then: function (cb) {
|
||||
cb(v);
|
||||
} };
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
@@ -218,4 +220,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -57,11 +57,11 @@ define(
|
||||
testAttrs = { mctSwimlaneDrop: "mockSwimlane" };
|
||||
mockSwimlane = jasmine.createSpyObj(
|
||||
"swimlane",
|
||||
[ "allowDropIn", "allowDropAfter", "drop", "highlight", "highlightBottom" ]
|
||||
["allowDropIn", "allowDropAfter", "drop", "highlight", "highlightBottom"]
|
||||
);
|
||||
mockElement[0] = jasmine.createSpyObj(
|
||||
"realElement",
|
||||
[ "getBoundingClientRect" ]
|
||||
["getBoundingClientRect"]
|
||||
);
|
||||
mockElement[0].offsetHeight = TEST_HEIGHT;
|
||||
mockElement[0].getBoundingClientRect.andReturn({ top: TEST_TOP });
|
||||
|
||||
@@ -54,7 +54,7 @@ define(
|
||||
function addDomainObject(id, children, capabilities) {
|
||||
var mockDomainObject = jasmine.createSpyObj(
|
||||
'object-' + id,
|
||||
[ 'useCapability', 'hasCapability', 'getId' ]
|
||||
['useCapability', 'hasCapability', 'getId']
|
||||
);
|
||||
|
||||
mockDomainObject.getId.andReturn(id);
|
||||
@@ -72,7 +72,7 @@ define(
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockQ = jasmine.createSpyObj('$q', [ 'when', 'all' ]);
|
||||
mockQ = jasmine.createSpyObj('$q', ['when', 'all']);
|
||||
mockCallback = jasmine.createSpy('callback');
|
||||
mockDomainObjects = {};
|
||||
testCompositions = {};
|
||||
@@ -82,8 +82,12 @@ define(
|
||||
mockQ.when.andCallFake(asPromise);
|
||||
mockQ.all.andCallFake(function (values) {
|
||||
var result = [];
|
||||
function addResult(v) { result.push(v); }
|
||||
function promiseResult(v) { asPromise(v).then(addResult); }
|
||||
function addResult(v) {
|
||||
result.push(v);
|
||||
}
|
||||
function promiseResult(v) {
|
||||
asPromise(v).then(addResult);
|
||||
}
|
||||
values.forEach(promiseResult);
|
||||
return asPromise(result);
|
||||
});
|
||||
@@ -152,4 +156,4 @@ define(
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user