Merge branch 'master' into csv-export-update-751
Conflicts: platform/features/timeline/bundle.js
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./src/actions/ExportTimelineAsCSVAction",
|
||||
@@ -80,7 +79,6 @@ define([
|
||||
datetimeTemplate,
|
||||
legacyRegistry
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
legacyRegistry.register("platform/features/timeline", {
|
||||
"name": "Timelines",
|
||||
|
||||
@@ -158,9 +158,13 @@
|
||||
top: 20px; bottom: 5px;
|
||||
.l-labels-holder {
|
||||
@include absPosDefault();
|
||||
@include justify-content(space-between);
|
||||
left: $m;
|
||||
.tick-label.tick-label-y {
|
||||
text-align: left;
|
||||
.t-resource-graph-tick-label {
|
||||
font-size: 0.9em;
|
||||
&.tick-label-y {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,14 +23,14 @@
|
||||
{{parameters.title}}
|
||||
</div>
|
||||
<div class="l-graph-area">
|
||||
<div class="l-labels-holder">
|
||||
<div class="tick-label tick-label-y tick-label-1" style="top: 0;">
|
||||
<div class="l-labels-holder l-flex-col">
|
||||
<div class="t-resource-graph-tick-label tick-label-y flex-elem">
|
||||
{{parameters.high}}
|
||||
</div>
|
||||
<div class="tick-label tick-label-y" style="top: 50%; margin-top: -0.5em; height: 1em;">
|
||||
<div class="t-resource-graph-tick-label tick-label-y flex-elem">
|
||||
{{parameters.middle}}
|
||||
</div>
|
||||
<div class="tick-label tick-label-y" style="top: auto; bottom: 4px; height: 1em;">
|
||||
<div class="t-resource-graph-tick-label tick-label-y flex-elem">
|
||||
{{parameters.low}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
}">
|
||||
<div class="l-cols">
|
||||
<span class="l-col l-col-icon l-plot-resource"
|
||||
ng-click="ngModel.toggleGraph()"
|
||||
ng-click="ngModel.toggleGraph(); parameters.commit()"
|
||||
title="Click to enable or disable inclusion in Resource Graphing">
|
||||
<span class="ui-symbol"
|
||||
ng-show="ngModel.graph()"
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
<div class="t-swimlanes-holder l-swimlanes-holder"
|
||||
mct-scroll-y="scroll.y">
|
||||
<mct-include key="'timeline-tabular-swimlane-cols-tree'"
|
||||
parameters="{ commit: commit }"
|
||||
ng-repeat="swimlane in timelineController.swimlanes()"
|
||||
ng-model="swimlane">
|
||||
</mct-include>
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
/**
|
||||
* Defines constant values for use in timeline view.
|
||||
@@ -29,4 +28,4 @@ define({
|
||||
HANDLE_WIDTH: 32,
|
||||
// Pixel tolerance for snapping behavior
|
||||
SNAP_WIDTH: 16
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
'use strict';
|
||||
|
||||
// Conversion factors from time units to milliseconds
|
||||
var SECONDS = 1000,
|
||||
@@ -75,4 +73,4 @@ define(
|
||||
|
||||
return TimelineFormatter;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,10 +19,8 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([], function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* A column containing references to other objects contained
|
||||
|
||||
@@ -19,10 +19,8 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(["./ExportTimelineAsCSVTask"], function (ExportTimelineAsCSVTask) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Implements the "Export Timeline as CSV" action.
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,Promise*/
|
||||
|
||||
/**
|
||||
* Module defining ExportTimelineAsCSVTask. Created by vwoeltje on 2/8/16.
|
||||
@@ -28,7 +27,6 @@ define([
|
||||
"./TimelineTraverser",
|
||||
"./TimelineColumnizer"
|
||||
], function (TimelineTraverser, TimelineColumnizer) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Runs (and coordinates) the preparation and export of CSV data
|
||||
|
||||
@@ -19,10 +19,8 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([], function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* A column showing domain object identifiers.
|
||||
|
||||
@@ -19,10 +19,8 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([], function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* A column reflecting properties from domain object metadata.
|
||||
|
||||
@@ -19,10 +19,8 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([], function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* A column showing relationships to activity modes.
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,Promise*/
|
||||
|
||||
define([
|
||||
"./IdColumn",
|
||||
@@ -34,7 +33,6 @@ define([
|
||||
MetadataColumn,
|
||||
TimespanColumn
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* A description of how to populate a given column within a
|
||||
|
||||
@@ -19,10 +19,8 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,Promise*/
|
||||
|
||||
define([], function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Builds a list of domain objects which should be included
|
||||
@@ -82,4 +80,4 @@ define([], function () {
|
||||
|
||||
return TimelineTraverser;
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,10 +19,8 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(['../TimelineFormatter'], function (TimelineFormatter) {
|
||||
"use strict";
|
||||
|
||||
var FORMATTER = new TimelineFormatter();
|
||||
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Describes the time span of an activity object.
|
||||
@@ -54,25 +52,25 @@ define(
|
||||
// Set the start time associated with this object
|
||||
function setStart(value) {
|
||||
var end = getEnd();
|
||||
mutation.mutate(function (model) {
|
||||
model.start.timestamp = Math.max(value, 0);
|
||||
mutation.mutate(function (m) {
|
||||
m.start.timestamp = Math.max(value, 0);
|
||||
// Update duration to keep end time
|
||||
model.duration.timestamp = Math.max(end - value, 0);
|
||||
m.duration.timestamp = Math.max(end - value, 0);
|
||||
}, model.modified);
|
||||
}
|
||||
|
||||
// Set the duration associated with this object
|
||||
function setDuration(value) {
|
||||
mutation.mutate(function (model) {
|
||||
model.duration.timestamp = Math.max(value, 0);
|
||||
mutation.mutate(function (m) {
|
||||
m.duration.timestamp = Math.max(value, 0);
|
||||
}, model.modified);
|
||||
}
|
||||
|
||||
// Set the end time associated with this object
|
||||
function setEnd(value) {
|
||||
var start = getStart();
|
||||
mutation.mutate(function (model) {
|
||||
model.duration.timestamp = Math.max(value - start, 0);
|
||||
mutation.mutate(function (m) {
|
||||
m.duration.timestamp = Math.max(value - start, 0);
|
||||
}, model.modified);
|
||||
}
|
||||
|
||||
@@ -118,4 +116,4 @@ define(
|
||||
|
||||
return ActivityTimespan;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
['./ActivityTimespan'],
|
||||
function (ActivityTimespan) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Implements the `timespan` capability for Activity objects.
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Provides data to populate resource graphs associated
|
||||
@@ -37,10 +35,10 @@ define(
|
||||
getPointCount: function () {
|
||||
return 0;
|
||||
},
|
||||
getDomainValue: function (index) {
|
||||
getDomainValue: function () {
|
||||
return 0;
|
||||
},
|
||||
getRangeValue: function (index) {
|
||||
getRangeValue: function () {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
@@ -49,4 +47,4 @@ define(
|
||||
return ActivityUtilization;
|
||||
}
|
||||
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Exposes costs associated with a subsystem mode.
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Provide points for a cumulative resource summary graph, using
|
||||
@@ -55,22 +53,21 @@ define(
|
||||
|
||||
// Initialize the data values
|
||||
function initializeValues() {
|
||||
var values = [],
|
||||
var vals = [],
|
||||
slope = 0,
|
||||
previous = 0,
|
||||
i;
|
||||
|
||||
// Add a point (or points, if needed) reaching to the provided
|
||||
// domain and/or range value
|
||||
function addPoint(domain, range) {
|
||||
var previous = values[values.length - 1],
|
||||
var previous = vals[vals.length - 1],
|
||||
delta = domain - previous.domain, // time delta
|
||||
change = delta * slope * rate, // change
|
||||
next = previous.range + change;
|
||||
|
||||
// Crop to minimum boundary...
|
||||
if (next < minimum) {
|
||||
values.push({
|
||||
vals.push({
|
||||
domain: intercept(
|
||||
previous.domain,
|
||||
previous.range,
|
||||
@@ -84,7 +81,7 @@ define(
|
||||
|
||||
// ...and maximum boundary
|
||||
if (next > maximum) {
|
||||
values.push({
|
||||
vals.push({
|
||||
domain: intercept(
|
||||
previous.domain,
|
||||
previous.range,
|
||||
@@ -98,19 +95,19 @@ define(
|
||||
|
||||
// Add the new data value
|
||||
if (delta > 0) {
|
||||
values.push({ domain: domain, range: next });
|
||||
vals.push({ domain: domain, range: next });
|
||||
}
|
||||
|
||||
slope = range;
|
||||
}
|
||||
|
||||
values.push({ domain: 0, range: initial });
|
||||
vals.push({ domain: 0, range: initial });
|
||||
|
||||
for (i = 0; i < graph.getPointCount(); i += 1) {
|
||||
addPoint(graph.getDomainValue(i), graph.getRangeValue(i));
|
||||
}
|
||||
|
||||
return values;
|
||||
return vals;
|
||||
}
|
||||
|
||||
function convertToPercent(point) {
|
||||
@@ -152,4 +149,4 @@ define(
|
||||
|
||||
return CumulativeGraph;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
['./ResourceGraph', './CumulativeGraph'],
|
||||
function (ResourceGraph, CumulativeGraph) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Implements the `graph` capability for Timeline and
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
// Utility function to copy an array, sorted by a specific field
|
||||
function sort(array, field) {
|
||||
@@ -74,13 +72,13 @@ define(
|
||||
|
||||
// If there are sequences of points with the same timestamp,
|
||||
// allow only the first and last.
|
||||
function filterPoint(value, index, values) {
|
||||
function filterPoint(value, index, vals) {
|
||||
// Allow the first or last point as a base case; aside from
|
||||
// that, allow only points that have different timestamps
|
||||
// from their predecessor or successor.
|
||||
return (index === 0) || (index === values.length - 1) ||
|
||||
(value.domain !== values[index - 1].domain) ||
|
||||
(value.domain !== values[index + 1].domain);
|
||||
return (index === 0) || (index === vals.length - 1) ||
|
||||
(value.domain !== vals[index - 1].domain) ||
|
||||
(value.domain !== vals[index + 1].domain);
|
||||
}
|
||||
|
||||
// Add a step up or down (Step 3c above)
|
||||
@@ -146,4 +144,4 @@ define(
|
||||
return ResourceGraph;
|
||||
}
|
||||
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Describes the time span of a timeline object.
|
||||
@@ -59,18 +57,18 @@ define(
|
||||
|
||||
// Set the start time associated with this object
|
||||
function setStart(value) {
|
||||
mutation.mutate(function (model) {
|
||||
model.start.timestamp = Math.max(value, 0);
|
||||
mutation.mutate(function (m) {
|
||||
m.start.timestamp = Math.max(value, 0);
|
||||
}, model.modified);
|
||||
}
|
||||
|
||||
// Set the duration associated with this object
|
||||
function setDuration(value) {
|
||||
function setDuration() {
|
||||
// No-op; duration is implicit
|
||||
}
|
||||
|
||||
// Set the end time associated with this object
|
||||
function setEnd(value) {
|
||||
function setEnd() {
|
||||
// No-op; end time is implicit
|
||||
}
|
||||
|
||||
@@ -123,4 +121,4 @@ define(
|
||||
|
||||
return TimelineTimespan;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
['./TimelineTimespan'],
|
||||
function (TimelineTimespan) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Implements the `timespan` capability for Timeline objects.
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Provides data to populate resource graphs associated
|
||||
@@ -49,4 +47,4 @@ define(
|
||||
return TimelineUtilization;
|
||||
}
|
||||
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Provide the resource utilization over time for a timeline
|
||||
@@ -122,13 +120,13 @@ define(
|
||||
}
|
||||
|
||||
// Look up a specific object's resource utilization
|
||||
function lookupUtilization(domainObject) {
|
||||
return domainObject.useCapability('utilization');
|
||||
function lookupUtilization(object) {
|
||||
return object.useCapability('utilization');
|
||||
}
|
||||
|
||||
// Look up a specific object's resource utilization keys
|
||||
function lookupUtilizationResources(domainObject) {
|
||||
var utilization = domainObject.getCapability('utilization');
|
||||
function lookupUtilizationResources(object) {
|
||||
var utilization = object.getCapability('utilization');
|
||||
return utilization && utilization.resources();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Controller which support the Values view of Activity Modes.
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[
|
||||
@@ -32,7 +31,6 @@ define(
|
||||
TimelineGraphPopulator,
|
||||
TimelineDragPopulator
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Controller for the Timeline view.
|
||||
@@ -98,7 +96,7 @@ define(
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Recalculate swimlane state on changes
|
||||
$scope.$watch("domainObject", swimlanePopulator.populate);
|
||||
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,moment*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Controller for the `datetime` form control.
|
||||
@@ -90,4 +88,4 @@ define(
|
||||
return DateTimeController;
|
||||
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Control for Gantt bars in a timeline view.
|
||||
@@ -85,4 +83,4 @@ define(
|
||||
|
||||
return TimelineGanttController;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,11 +19,9 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Controller for the graph area of a timeline view.
|
||||
@@ -94,4 +92,4 @@ define(
|
||||
|
||||
return TimelineGraphController;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
["../TimelineFormatter"],
|
||||
function (TimelineFormatter) {
|
||||
"use strict";
|
||||
|
||||
var FORMATTER = new TimelineFormatter();
|
||||
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
["../TimelineFormatter"],
|
||||
function (TimelineFormatter) {
|
||||
"use strict";
|
||||
|
||||
var FORMATTER = new TimelineFormatter();
|
||||
|
||||
@@ -115,4 +113,4 @@ define(
|
||||
|
||||
return TimelineTickController;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,14 +19,9 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
define(
|
||||
['../TimelineFormatter'],
|
||||
function (TimelineFormatter) {
|
||||
"use strict";
|
||||
|
||||
|
||||
var FORMATTER = new TimelineFormatter();
|
||||
[],
|
||||
function () {
|
||||
|
||||
/**
|
||||
* Controls the pan-zoom state of a timeline view.
|
||||
@@ -34,7 +29,7 @@ define(
|
||||
*/
|
||||
function TimelineZoomController($scope, ZOOM_CONFIGURATION) {
|
||||
// Prefer to start with the middle index
|
||||
var zoomLevels = ZOOM_CONFIGURATION.levels || [ 1000 ],
|
||||
var zoomLevels = ZOOM_CONFIGURATION.levels || [1000],
|
||||
zoomIndex = Math.floor(zoomLevels.length / 2),
|
||||
tickWidth = ZOOM_CONFIGURATION.width || 200,
|
||||
duration = 86400000; // Default duration in view
|
||||
@@ -62,7 +57,8 @@ define(
|
||||
function storeZoom() {
|
||||
var isEditMode = $scope.commit &&
|
||||
$scope.domainObject &&
|
||||
$scope.domainObject.hasCapability('editor');
|
||||
$scope.domainObject.hasCapability('editor') &&
|
||||
$scope.domainObject.getCapability('editor').inEditContext();
|
||||
if (isEditMode) {
|
||||
$scope.configuration = $scope.configuration || {};
|
||||
$scope.configuration.zoomLevel = zoomIndex;
|
||||
@@ -115,7 +111,6 @@ define(
|
||||
* @returns {number} duration, in milliseconds
|
||||
*/
|
||||
duration: function (value) {
|
||||
var prior = duration;
|
||||
if (arguments.length > 0) {
|
||||
duration = roundDuration(value);
|
||||
}
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
['./TimelineStartHandle', './TimelineEndHandle', './TimelineMoveHandle'],
|
||||
function (TimelineStartHandle, TimelineEndHandle, TimelineMoveHandle) {
|
||||
"use strict";
|
||||
|
||||
|
||||
var DEFAULT_HANDLES = [
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Handles business logic (mutation of objects, retrieval of start/end
|
||||
@@ -49,19 +47,19 @@ define(
|
||||
}
|
||||
|
||||
// Get the timespan associated with this domain object
|
||||
function populateCapabilityMaps(domainObject) {
|
||||
var id = domainObject.getId(),
|
||||
timespanPromise = domainObject.useCapability('timespan');
|
||||
function populateCapabilityMaps(object) {
|
||||
var id = object.getId(),
|
||||
timespanPromise = object.useCapability('timespan');
|
||||
if (timespanPromise) {
|
||||
timespanPromise.then(function (timespan) {
|
||||
// Cache that timespan
|
||||
timespans[id] = timespan;
|
||||
// And its mutation capability
|
||||
mutations[id] = domainObject.getCapability('mutation');
|
||||
mutations[id] = object.getCapability('mutation');
|
||||
// Also cache the persistence capability for later
|
||||
persists[id] = domainObject.getCapability('persistence');
|
||||
persists[id] = object.getCapability('persistence');
|
||||
// And the composition, for bulk moves
|
||||
compositions[id] = domainObject.getModel().composition || [];
|
||||
compositions[id] = object.getModel().composition || [];
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -201,8 +199,8 @@ define(
|
||||
minStart;
|
||||
|
||||
// Update start & end, in that order
|
||||
function updateStartEnd(id) {
|
||||
var timespan = timespans[id], start, end;
|
||||
function updateStartEnd(spanId) {
|
||||
var timespan = timespans[spanId], start, end;
|
||||
if (timespan) {
|
||||
// Get start/end so we don't get fooled by our
|
||||
// own adjustments
|
||||
@@ -212,7 +210,7 @@ define(
|
||||
timespan.setStart(start + delta);
|
||||
timespan.setEnd(end + delta);
|
||||
// Mark as dirty for subsequent persistence
|
||||
dirty[toId(id)] = true;
|
||||
dirty[toId(spanId)] = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,12 +228,12 @@ define(
|
||||
}
|
||||
|
||||
// Find the minimum start time
|
||||
minStart = Object.keys(ids).map(function (id) {
|
||||
minStart = Object.keys(ids).map(function (spanId) {
|
||||
// Get the start time; default to +Inf if not
|
||||
// found, since this will not survive a min
|
||||
// test if any real timespans are present
|
||||
return timespans[id] ?
|
||||
timespans[id].getStart() :
|
||||
return timespans[spanId] ?
|
||||
timespans[spanId].getStart() :
|
||||
Number.POSITIVE_INFINITY;
|
||||
}).reduce(function (a, b) {
|
||||
// Reduce with a minimum test
|
||||
@@ -255,4 +253,4 @@ define(
|
||||
|
||||
return TimelineDragHandler;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
['./TimelineDragHandler', './TimelineSnapHandler', './TimelineDragHandleFactory'],
|
||||
function (TimelineDragHandler, TimelineSnapHandler, TimelineDragHandleFactory) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Provides drag handles for the active selection in a timeline view.
|
||||
@@ -94,4 +92,4 @@ define(
|
||||
|
||||
return TimelineDragPopulator;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
['../../TimelineConstants'],
|
||||
function (Constants) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Handle for changing the end time of a timeline or
|
||||
@@ -95,4 +93,4 @@ define(
|
||||
|
||||
return TimelineEndHandle;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
['../../TimelineConstants'],
|
||||
function (Constants) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Handle for moving (by drag) a timeline or
|
||||
@@ -119,13 +117,10 @@ define(
|
||||
|
||||
style: function (zoom) {
|
||||
return {
|
||||
left: zoom.toPixels(dragHandler.start(id)) +
|
||||
Constants.HANDLE_WIDTH +
|
||||
'px',
|
||||
width: zoom.toPixels(dragHandler.duration(id)) -
|
||||
Constants.HANDLE_WIDTH * 2
|
||||
+ 'px'
|
||||
//cursor: initialStart === undefined ? 'grab' : 'grabbing'
|
||||
left: (zoom.toPixels(dragHandler.start(id)) +
|
||||
Constants.HANDLE_WIDTH) + 'px',
|
||||
width: (zoom.toPixels(dragHandler.duration(id)) -
|
||||
Constants.HANDLE_WIDTH * 2) + 'px'
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -133,4 +128,4 @@ define(
|
||||
|
||||
return TimelineMoveHandle;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Snaps timestamps to match other timestamps within a
|
||||
@@ -44,7 +42,9 @@ define(
|
||||
candidates;
|
||||
|
||||
// Filter an id for inclustion
|
||||
function include(id) { return id !== exclude; }
|
||||
function include(id) {
|
||||
return id !== exclude;
|
||||
}
|
||||
|
||||
// Evaluate a candidate timestamp as a snap-to location
|
||||
function evaluate(candidate) {
|
||||
@@ -103,4 +103,4 @@ define(
|
||||
|
||||
return TimelineSnapHandler;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
['../../TimelineConstants'],
|
||||
function (Constants) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Handle for changing the start time of a timeline or
|
||||
@@ -95,4 +93,4 @@ define(
|
||||
|
||||
return TimelineStartHandle;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Provides data to populate a graph in a timeline view.
|
||||
@@ -47,8 +45,6 @@ define(
|
||||
min = 0,
|
||||
// current maximum
|
||||
max = 0,
|
||||
// current displayed time span
|
||||
duration = 1000,
|
||||
// line colors to display
|
||||
colors = Object.keys(domainObjects);
|
||||
|
||||
@@ -172,8 +168,8 @@ define(
|
||||
setBounds: function (offset, duration) {
|
||||
// We don't update in-place, because we need the change
|
||||
// to trigger a watch in mct-chart.
|
||||
drawingObject.origin = [ offset, drawingObject.origin[1] ];
|
||||
drawingObject.dimensions = [ duration, drawingObject.dimensions[1] ];
|
||||
drawingObject.origin = [offset, drawingObject.origin[1]];
|
||||
drawingObject.dimensions = [duration, drawingObject.dimensions[1]];
|
||||
},
|
||||
/**
|
||||
* Redraw lines in this graph.
|
||||
@@ -190,4 +186,4 @@ define(
|
||||
|
||||
return TimelineGraph;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,11 +19,9 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
define(
|
||||
['./TimelineGraph', './TimelineGraphRenderer'],
|
||||
function (TimelineGraph, TimelineGraphRenderer) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Responsible for determining which resource graphs
|
||||
@@ -77,11 +75,14 @@ define(
|
||||
|
||||
// Look up resources for a domain object
|
||||
function lookupResources(swimlane) {
|
||||
var graphs = swimlane.domainObject.useCapability('graph');
|
||||
var graphPromise =
|
||||
swimlane.domainObject.useCapability('graph');
|
||||
function getKeys(obj) {
|
||||
return Object.keys(obj);
|
||||
}
|
||||
return $q.when(graphs ? (graphs.then(getKeys)) : []);
|
||||
return $q.when(
|
||||
graphPromise ? (graphPromise.then(getKeys)) : []
|
||||
);
|
||||
}
|
||||
|
||||
// Add all graph assignments appropriate for this swimlane
|
||||
@@ -154,4 +155,4 @@ define(
|
||||
return TimelineGraphPopulator;
|
||||
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,Float32Array*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Responsible for preparing data for display by
|
||||
@@ -80,4 +78,4 @@ define(
|
||||
return TimelineGraphRenderer;
|
||||
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,11 +19,9 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
var COLOR_OPTIONS = [
|
||||
"#20b2aa",
|
||||
@@ -119,4 +117,4 @@ define(
|
||||
|
||||
return TimelineColorAssigner;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Selection proxy for the Timeline view. Implements
|
||||
@@ -36,8 +34,8 @@ define(
|
||||
var actionMap = {};
|
||||
|
||||
// Populate available Create actions for this domain object
|
||||
function populateActionMap(domainObject) {
|
||||
var actionCapability = domainObject.getCapability('action'),
|
||||
function populateActionMap(object) {
|
||||
var actionCapability = object.getCapability('action'),
|
||||
actions = actionCapability ?
|
||||
actionCapability.getActions('add') : [];
|
||||
actions.forEach(function (action) {
|
||||
@@ -76,4 +74,4 @@ define(
|
||||
|
||||
return TimelineProxy;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Describes a swimlane in a timeline view. This will be
|
||||
@@ -49,9 +47,7 @@ define(
|
||||
depth = parent ? (parent.depth + 1) : 0,
|
||||
timespan,
|
||||
path = (!parent || !parent.parent) ? "" : parent.path +
|
||||
//(parent.path.length > 0 ? " / " : "") +
|
||||
parent.domainObject.getModel().name +
|
||||
" > ";
|
||||
parent.domainObject.getModel().name + " > ";
|
||||
|
||||
// Look up timespan for this object
|
||||
domainObject.useCapability('timespan').then(function (t) {
|
||||
@@ -174,4 +170,4 @@ define(
|
||||
|
||||
return TimelineSwimlane;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
['./TimelineSwimlaneDropHandler'],
|
||||
function (TimelineSwimlaneDropHandler) {
|
||||
"use strict";
|
||||
|
||||
var ACTIVITY_RELATIONSHIP = "modes";
|
||||
|
||||
@@ -47,9 +45,9 @@ define(
|
||||
if (arguments.length > 0 && Array.isArray(value)) {
|
||||
if ((model.relationships || {})[ACTIVITY_RELATIONSHIP] !== value) {
|
||||
// Update the relationships
|
||||
mutator.mutate(function (model) {
|
||||
model.relationships = model.relationships || {};
|
||||
model.relationships[ACTIVITY_RELATIONSHIP] = value;
|
||||
mutator.mutate(function (m) {
|
||||
m.relationships = m.relationships || {};
|
||||
m.relationships[ACTIVITY_RELATIONSHIP] = value;
|
||||
}).then(persister.persist);
|
||||
}
|
||||
}
|
||||
@@ -63,8 +61,8 @@ define(
|
||||
if (arguments.length > 0 && (typeof value === 'string') &&
|
||||
value !== model.link) {
|
||||
// Update the link
|
||||
mutator.mutate(function (model) {
|
||||
model.link = value;
|
||||
mutator.mutate(function (m) {
|
||||
m.link = value;
|
||||
}).then(persister.persist);
|
||||
}
|
||||
return model.link;
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Handles drop (from drag-and-drop) initiated changes to a swimlane.
|
||||
@@ -41,9 +39,10 @@ define(
|
||||
};
|
||||
}
|
||||
|
||||
// Check if we are in edit mode
|
||||
// Check if we are in edit mode (also check parents)
|
||||
function inEditMode() {
|
||||
return swimlane.domainObject.hasCapability("editor");
|
||||
return swimlane.domainObject.hasCapability('editor') &&
|
||||
swimlane.domainObject.getCapability('editor').inEditContext();
|
||||
}
|
||||
|
||||
// Boolean and (for reduce below)
|
||||
@@ -52,7 +51,7 @@ define(
|
||||
}
|
||||
|
||||
// Check if pathA entirely contains pathB
|
||||
function pathContains(swimlane, id) {
|
||||
function pathContains(swimlaneToCheck, id) {
|
||||
// Check if id at a specific index matches (for map below)
|
||||
function matches(pathId) {
|
||||
return pathId === id;
|
||||
@@ -60,18 +59,18 @@ define(
|
||||
|
||||
// Path A contains Path B if it is longer, and all of
|
||||
// B's ids match the ids in A.
|
||||
return swimlane.idPath.map(matches).reduce(or, false);
|
||||
return swimlaneToCheck.idPath.map(matches).reduce(or, false);
|
||||
}
|
||||
|
||||
// Check if a swimlane contains a child with the specified id
|
||||
function contains(swimlane, id) {
|
||||
function contains(swimlaneToCheck, id) {
|
||||
// Check if a child swimlane has a matching domain object id
|
||||
function matches(child) {
|
||||
return child.domainObject.getId() === id;
|
||||
}
|
||||
|
||||
// Find any one child id that matches this id
|
||||
return swimlane.children.map(matches).reduce(or, false);
|
||||
return swimlaneToCheck.children.map(matches).reduce(or, false);
|
||||
}
|
||||
|
||||
// Initiate mutation of a domain object
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[
|
||||
@@ -34,7 +33,6 @@ define(
|
||||
TimelineColorAssigner,
|
||||
TimelineProxy
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Populates and maintains a list of swimlanes for a given
|
||||
@@ -63,8 +61,8 @@ define(
|
||||
swimlane;
|
||||
|
||||
// For the recursive step
|
||||
function populate(childSubgraph, index) {
|
||||
populateSwimlanes(childSubgraph, swimlane, index);
|
||||
function populate(childSubgraph, nextIndex) {
|
||||
populateSwimlanes(childSubgraph, swimlane, nextIndex);
|
||||
}
|
||||
|
||||
// Make sure we have a valid object instance...
|
||||
@@ -196,4 +194,4 @@ define(
|
||||
|
||||
return TimelineSwimlanePopulator;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
['./SwimlaneDragConstants'],
|
||||
function (SwimlaneDragConstants) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Defines the `mct-swimlane-drag` directive. When a drag is initiated
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
['./SwimlaneDragConstants'],
|
||||
function (SwimlaneDragConstants) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Defines the `mct-swimlane-drop` directive. When a drop occurs
|
||||
@@ -42,7 +40,6 @@ define(
|
||||
height = element[0].offsetHeight,
|
||||
rect = element[0].getBoundingClientRect(),
|
||||
offset = event.pageY - rect.top,
|
||||
dataTransfer = event.dataTransfer,
|
||||
id = dndService.getData(
|
||||
SwimlaneDragConstants.MCT_DRAG_TYPE
|
||||
),
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define({
|
||||
/**
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The ObjectLoader is a utility service for loading subgraphs
|
||||
@@ -43,13 +41,13 @@ define(
|
||||
filter;
|
||||
|
||||
// Check object existence (for criterion-less filtering)
|
||||
function exists(domainObject) {
|
||||
return !!domainObject;
|
||||
function exists(object) {
|
||||
return !!object;
|
||||
}
|
||||
|
||||
// Check for capability matching criterion
|
||||
function hasCapability(domainObject) {
|
||||
return domainObject && domainObject.hasCapability(criterion);
|
||||
function hasCapability(object) {
|
||||
return object && object.hasCapability(criterion);
|
||||
}
|
||||
|
||||
// For the recursive step...
|
||||
@@ -63,8 +61,8 @@ define(
|
||||
}
|
||||
|
||||
// Avoid infinite recursion
|
||||
function notVisiting(domainObject) {
|
||||
return !visiting[domainObject.getId()];
|
||||
function notVisiting(object) {
|
||||
return !visiting[object.getId()];
|
||||
}
|
||||
|
||||
// Put the composition of this domain object into the result
|
||||
@@ -132,4 +130,4 @@ define(
|
||||
|
||||
return ObjectLoader;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../src/TimelineConstants'],
|
||||
function (TimelineConstants) {
|
||||
"use strict";
|
||||
describe("The set of Timeline constants", function () {
|
||||
it("specifies a handle width", function () {
|
||||
expect(TimelineConstants.HANDLE_WIDTH)
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../src/TimelineFormatter'],
|
||||
function (TimelineFormatter) {
|
||||
'use strict';
|
||||
|
||||
var SECOND = 1000,
|
||||
MINUTE = SECOND * 60,
|
||||
@@ -59,4 +57,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/actions/CompositionColumn'],
|
||||
@@ -45,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);
|
||||
});
|
||||
@@ -59,7 +58,7 @@ define(
|
||||
});
|
||||
|
||||
it("returns nothing when composition is exceeded", function () {
|
||||
testModel.composition = [ 'foo' ];
|
||||
testModel.composition = ['foo'];
|
||||
expect(column.value(mockDomainObject)).toEqual("");
|
||||
});
|
||||
|
||||
@@ -71,4 +70,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/actions/ExportTimelineAsCSVAction'],
|
||||
@@ -37,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);
|
||||
@@ -150,4 +149,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/actions/ExportTimelineAsCSVTask'],
|
||||
function (ExportTimelineAsCSVTask) {
|
||||
'use strict';
|
||||
|
||||
// Note that most responsibility is delegated to helper
|
||||
// classes, so testing here is minimal.
|
||||
@@ -36,7 +34,7 @@ define(
|
||||
beforeEach(function () {
|
||||
mockExportService = jasmine.createSpyObj(
|
||||
'exportService',
|
||||
[ 'exportCSV' ]
|
||||
['exportCSV']
|
||||
);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/actions/IdColumn'],
|
||||
@@ -43,7 +42,7 @@ define(
|
||||
testId = "foo";
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getModel', 'getCapability' ]
|
||||
['getId', 'getModel', 'getCapability']
|
||||
);
|
||||
mockDomainObject.getId.andReturn(testId);
|
||||
});
|
||||
@@ -56,4 +55,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/actions/MetadataColumn'],
|
||||
@@ -45,7 +44,7 @@ define(
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getModel', 'getCapability', 'useCapability' ]
|
||||
['getId', 'getModel', 'getCapability', 'useCapability']
|
||||
);
|
||||
testMetadata = [
|
||||
{ name: "Something else", value: 123 },
|
||||
@@ -73,4 +72,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/actions/ModeColumn'],
|
||||
@@ -45,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);
|
||||
@@ -61,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("");
|
||||
});
|
||||
|
||||
@@ -73,4 +72,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/actions/TimelineColumnizer'],
|
||||
@@ -51,7 +50,7 @@ define(
|
||||
beforeEach(function () {
|
||||
var mockTimespan = jasmine.createSpyObj(
|
||||
'timespan',
|
||||
[ 'getStart', 'getEnd' ]
|
||||
['getStart', 'getEnd']
|
||||
);
|
||||
|
||||
testMetadata = [
|
||||
@@ -60,8 +59,8 @@ define(
|
||||
];
|
||||
|
||||
mockDomainObjects = [
|
||||
{ composition: [ 'a', 'b', 'c' ] },
|
||||
{ relationships: { modes: [ 'x', 'y' ] } },
|
||||
{ composition: ['a', 'b', 'c'] },
|
||||
{ relationships: { modes: ['x', 'y'] } },
|
||||
{ }
|
||||
].map(makeMockDomainObject);
|
||||
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define([
|
||||
"../../src/actions/TimelineTraverser"
|
||||
], function (TimelineTraverser) {
|
||||
'use strict';
|
||||
|
||||
describe("TimelineTraverser", function () {
|
||||
var testModels,
|
||||
@@ -57,8 +55,8 @@ define([
|
||||
if (!!model.composition) {
|
||||
mockDomainObject.useCapability.andCallFake(function (c) {
|
||||
return c === 'composition' &&
|
||||
Promise.resolve(model.composition.map(function (id) {
|
||||
return mockDomainObjects[id];
|
||||
Promise.resolve(model.composition.map(function (cid) {
|
||||
return mockDomainObjects[cid];
|
||||
}));
|
||||
});
|
||||
}
|
||||
@@ -70,8 +68,8 @@ define([
|
||||
);
|
||||
mockRelationships.getRelatedObjects.andCallFake(function (k) {
|
||||
var ids = model.relationships[k] || [];
|
||||
return Promise.resolve(ids.map(function (id) {
|
||||
return mockDomainObjects[id];
|
||||
return Promise.resolve(ids.map(function (objId) {
|
||||
return mockDomainObjects[objId];
|
||||
}));
|
||||
});
|
||||
mockDomainObject.getCapability.andCallFake(function (c) {
|
||||
@@ -84,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: {}
|
||||
};
|
||||
@@ -134,4 +132,4 @@ define([
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/actions/TimespanColumn', '../../src/TimelineFormatter'],
|
||||
@@ -37,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);
|
||||
@@ -53,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);
|
||||
|
||||
@@ -91,4 +90,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/capabilities/ActivityTimespanCapability'],
|
||||
function (ActivityTimespanCapability) {
|
||||
'use strict';
|
||||
|
||||
describe("An Activity's timespan capability", function () {
|
||||
var mockQ,
|
||||
@@ -43,7 +41,7 @@ define(
|
||||
mockQ = jasmine.createSpyObj('$q', ['when']);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getModel', 'getCapability' ]
|
||||
['getModel', 'getCapability']
|
||||
);
|
||||
|
||||
mockQ.when.andCallFake(asPromise);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/capabilities/ActivityTimespan'],
|
||||
function (ActivityTimespan) {
|
||||
'use strict';
|
||||
|
||||
describe("An Activity's timespan", function () {
|
||||
var testModel,
|
||||
@@ -98,4 +96,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/capabilities/ActivityUtilization'],
|
||||
function (ActivityUtilization) {
|
||||
'use strict';
|
||||
|
||||
describe("An Activity's resource utilization", function () {
|
||||
|
||||
@@ -38,4 +36,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/capabilities/CostCapability'],
|
||||
function (CostCapability) {
|
||||
'use strict';
|
||||
|
||||
describe("A subsystem mode's cost capability", function () {
|
||||
var testModel,
|
||||
@@ -33,7 +31,7 @@ define(
|
||||
beforeEach(function () {
|
||||
var mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getModel', 'getId' ]
|
||||
['getModel', 'getId']
|
||||
);
|
||||
|
||||
testModel = {
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/capabilities/CumulativeGraph'],
|
||||
function (CumulativeGraph) {
|
||||
'use strict';
|
||||
|
||||
describe("A cumulative resource graph", function () {
|
||||
var mockGraph,
|
||||
@@ -32,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);
|
||||
@@ -85,4 +83,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/capabilities/GraphCapability'],
|
||||
function (GraphCapability) {
|
||||
'use strict';
|
||||
|
||||
describe("A Timeline's graph capability", function () {
|
||||
var mockQ,
|
||||
@@ -44,7 +42,7 @@ define(
|
||||
mockQ = jasmine.createSpyObj('$q', ['when']);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getModel', 'useCapability' ]
|
||||
['getId', 'getModel', 'useCapability']
|
||||
);
|
||||
|
||||
testModel = {
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/capabilities/ResourceGraph'],
|
||||
function (ResourceGraph) {
|
||||
'use strict';
|
||||
|
||||
describe("A resource graph capability", function () {
|
||||
|
||||
@@ -45,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);
|
||||
@@ -74,4 +72,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/capabilities/TimelineTimespanCapability'],
|
||||
function (TimelineTimespanCapability) {
|
||||
'use strict';
|
||||
|
||||
describe("A Timeline's timespan capability", function () {
|
||||
var mockQ,
|
||||
@@ -47,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);
|
||||
});
|
||||
@@ -85,7 +87,7 @@ define(
|
||||
});
|
||||
mockDomainObject.useCapability.andCallFake(function (c) {
|
||||
if (c === 'composition') {
|
||||
return asPromise([ mockChildA, mockChildB ]);
|
||||
return asPromise([mockChildA, mockChildB]);
|
||||
}
|
||||
});
|
||||
mockChildA.hasCapability.andReturn(true);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/capabilities/TimelineTimespan'],
|
||||
function (TimelineTimespan) {
|
||||
'use strict';
|
||||
|
||||
describe("A Timeline's timespan", function () {
|
||||
var testModel,
|
||||
@@ -53,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);
|
||||
@@ -109,4 +107,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/capabilities/TimelineUtilization'],
|
||||
function (TimelineUtilization) {
|
||||
'use strict';
|
||||
|
||||
describe("A Timeline's resource utilization", function () {
|
||||
|
||||
@@ -38,4 +36,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/capabilities/UtilizationCapability'],
|
||||
function (UtilizationCapability) {
|
||||
'use strict';
|
||||
|
||||
describe("A Timeline's utilization capability", function () {
|
||||
var mockQ,
|
||||
@@ -71,8 +69,8 @@ define(
|
||||
resources: function () {
|
||||
return Object.keys(costs).sort();
|
||||
},
|
||||
cost: function (c) {
|
||||
return costs[c];
|
||||
cost: function (k) {
|
||||
return costs[k];
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -86,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');
|
||||
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/controllers/ActivityModeValuesController'],
|
||||
function (ActivityModeValuesController) {
|
||||
'use strict';
|
||||
|
||||
describe("An Activity Mode's Values view controller", function () {
|
||||
var testResources,
|
||||
@@ -50,4 +48,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/controllers/TimelineController'],
|
||||
function (TimelineController) {
|
||||
'use strict';
|
||||
|
||||
var DOMAIN_OBJECT_METHODS = [
|
||||
'getModel',
|
||||
@@ -101,7 +99,7 @@ define(
|
||||
|
||||
mockScope = jasmine.createSpyObj(
|
||||
"$scope",
|
||||
[ '$watch', '$on' ]
|
||||
['$watch', '$on']
|
||||
);
|
||||
mockLoader = jasmine.createSpyObj('objectLoader', ['load']);
|
||||
mockDomainObject = mockA;
|
||||
@@ -247,4 +245,4 @@ define(
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -20,12 +20,10 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
["../../src/controllers/TimelineDateTimeController"],
|
||||
function (TimelineDateTimeController) {
|
||||
"use strict";
|
||||
|
||||
describe("The date-time controller for timeline creation", function () {
|
||||
var mockScope,
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/controllers/TimelineGanttController'],
|
||||
function (TimelineGanttController) {
|
||||
"use strict";
|
||||
|
||||
var TEST_MAX_OFFSCREEN = 50;
|
||||
|
||||
@@ -63,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);
|
||||
});
|
||||
@@ -98,4 +98,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/controllers/TimelineGraphController'],
|
||||
function (TimelineGraphController) {
|
||||
'use strict';
|
||||
|
||||
describe("The Timeline graph controller", function () {
|
||||
var mockScope,
|
||||
@@ -34,7 +32,7 @@ define(
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
'$scope',
|
||||
[ '$watchCollection' ]
|
||||
['$watchCollection']
|
||||
);
|
||||
testResources = [
|
||||
{ key: 'abc', name: "Some name" },
|
||||
@@ -60,7 +58,7 @@ define(
|
||||
|
||||
// Supply new parameters
|
||||
mockScope.$watchCollection.mostRecentCall.args[1]({
|
||||
graphs: [ mockGraphA, mockGraphB ],
|
||||
graphs: [mockGraphA, mockGraphB],
|
||||
origin: 9,
|
||||
duration: 144
|
||||
});
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
[
|
||||
@@ -27,7 +26,6 @@ define(
|
||||
'../../src/TimelineFormatter'
|
||||
],
|
||||
function (TimelineTableController, TimelineFormatter) {
|
||||
"use strict";
|
||||
|
||||
describe("The timeline table controller", function () {
|
||||
var formatter, controller;
|
||||
@@ -40,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));
|
||||
});
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../src/controllers/TimelineTickController', '../../src/TimelineFormatter'],
|
||||
function (TimelineTickController, TimelineFormatter) {
|
||||
'use strict';
|
||||
|
||||
var BILLION = 1000000000,
|
||||
FORMATTER = new TimelineFormatter();
|
||||
@@ -85,4 +83,4 @@ define(
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,13 +19,11 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
|
||||
define(
|
||||
['../../src/controllers/TimelineZoomController'],
|
||||
function (TimelineZoomController) {
|
||||
'use strict';
|
||||
|
||||
describe("The timeline zoom state controller", function () {
|
||||
var testConfiguration,
|
||||
@@ -84,11 +82,20 @@ define(
|
||||
it("persists zoom changes in Edit mode", function () {
|
||||
mockScope.domainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
['hasCapability']
|
||||
['hasCapability', 'getCapability']
|
||||
);
|
||||
mockScope.domainObject.hasCapability.andCallFake(function (c) {
|
||||
return c === 'editor';
|
||||
});
|
||||
mockScope.domainObject.getCapability.andCallFake(function (c) {
|
||||
if (c === 'editor') {
|
||||
return {
|
||||
inEditContext: function () {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
controller.zoom(1);
|
||||
expect(mockScope.commit).toHaveBeenCalled();
|
||||
expect(mockScope.configuration.zoomLevel)
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../../src/controllers/drag/TimelineDragHandleFactory'],
|
||||
function (TimelineDragHandleFactory) {
|
||||
'use strict';
|
||||
|
||||
describe("A Timeline drag handle factory", function () {
|
||||
var mockDragHandler,
|
||||
@@ -37,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');
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../../src/controllers/drag/TimelineDragHandler'],
|
||||
function (TimelineDragHandler) {
|
||||
'use strict';
|
||||
|
||||
describe("A Timeline drag handler", function () {
|
||||
var mockLoader,
|
||||
@@ -58,22 +56,22 @@ define(
|
||||
}
|
||||
|
||||
function makeMockDomainObject(id, composition) {
|
||||
var mockDomainObject = jasmine.createSpyObj(
|
||||
var mockDomainObj = jasmine.createSpyObj(
|
||||
'domainObject-' + id,
|
||||
['getId', 'getModel', 'getCapability', 'useCapability']
|
||||
);
|
||||
|
||||
mockDomainObject.getId.andReturn(id);
|
||||
mockDomainObject.getModel.andReturn({ composition: composition });
|
||||
mockDomainObject.useCapability.andReturn(asPromise(mockTimespans[id]));
|
||||
mockDomainObject.getCapability.andCallFake(function (c) {
|
||||
mockDomainObj.getId.andReturn(id);
|
||||
mockDomainObj.getModel.andReturn({ composition: composition });
|
||||
mockDomainObj.useCapability.andReturn(asPromise(mockTimespans[id]));
|
||||
mockDomainObj.getCapability.andCallFake(function (c) {
|
||||
return {
|
||||
persistence: mockPersists[id],
|
||||
mutation: mockMutations[id]
|
||||
}[c];
|
||||
});
|
||||
|
||||
return mockDomainObject;
|
||||
return mockDomainObj;
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
@@ -83,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);
|
||||
@@ -227,4 +225,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,13 +19,11 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
|
||||
define(
|
||||
['../../../src/controllers/drag/TimelineDragPopulator'],
|
||||
function (TimelineDragPopulator) {
|
||||
"use strict";
|
||||
|
||||
describe("The timeline drag populator", function () {
|
||||
var mockObjectLoader,
|
||||
@@ -71,4 +69,4 @@ define(
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../../src/controllers/drag/TimelineEndHandle', '../../../src/TimelineConstants'],
|
||||
function (TimelineEndHandle, TimelineConstants) {
|
||||
'use strict';
|
||||
|
||||
describe("A Timeline end drag handle", function () {
|
||||
var mockDragHandler,
|
||||
@@ -35,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);
|
||||
@@ -114,4 +112,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../../src/controllers/drag/TimelineMoveHandle', '../../../src/TimelineConstants'],
|
||||
function (TimelineMoveHandle, TimelineConstants) {
|
||||
'use strict';
|
||||
|
||||
describe("A Timeline move drag handle", function () {
|
||||
var mockDragHandler,
|
||||
@@ -35,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);
|
||||
@@ -181,4 +179,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../../src/controllers/drag/TimelineSnapHandler'],
|
||||
function (TimelineSnapHandler) {
|
||||
'use strict';
|
||||
|
||||
describe("A Timeline snap handler", function () {
|
||||
var mockDragHandler,
|
||||
@@ -36,7 +34,7 @@ define(
|
||||
|
||||
mockDragHandler = jasmine.createSpyObj(
|
||||
'dragHandler',
|
||||
[ 'start', 'end', 'ids' ]
|
||||
['start', 'end', 'ids']
|
||||
);
|
||||
|
||||
mockDragHandler.ids.andReturn(['a', 'b', 'c', 'd']);
|
||||
@@ -78,4 +76,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../../src/controllers/drag/TimelineStartHandle', '../../../src/TimelineConstants'],
|
||||
function (TimelineStartHandle, TimelineConstants) {
|
||||
'use strict';
|
||||
|
||||
describe("A Timeline start drag handle", function () {
|
||||
var mockDragHandler,
|
||||
@@ -35,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);
|
||||
@@ -113,4 +111,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../../src/controllers/graph/TimelineGraphPopulator'],
|
||||
function (TimelineGraphPopulator) {
|
||||
'use strict';
|
||||
|
||||
describe("A Timeline's resource graph populator", function () {
|
||||
var mockSwimlanes,
|
||||
@@ -50,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']);
|
||||
@@ -60,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
|
||||
@@ -150,4 +148,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../../src/controllers/graph/TimelineGraphRenderer'],
|
||||
function (TimelineGraphRenderer) {
|
||||
'use strict';
|
||||
|
||||
describe("A Timeline's graph renderer", function () {
|
||||
var renderer;
|
||||
@@ -74,4 +72,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../../src/controllers/graph/TimelineGraph'],
|
||||
function (TimelineGraph) {
|
||||
'use strict';
|
||||
|
||||
describe("A Timeline's resource graph", function () {
|
||||
var mockDomainObjects,
|
||||
@@ -44,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 = [];
|
||||
@@ -55,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
|
||||
@@ -74,7 +72,7 @@ define(
|
||||
|
||||
mockRenderer = jasmine.createSpyObj(
|
||||
'renderer',
|
||||
[ 'render', 'decode' ]
|
||||
['render', 'decode']
|
||||
);
|
||||
|
||||
mockRenderer.render.andCallFake(function (utilization) {
|
||||
@@ -169,4 +167,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../../src/controllers/swimlane/TimelineColorAssigner'],
|
||||
function (TimelineColorAssigner) {
|
||||
'use strict';
|
||||
|
||||
describe("The Timeline legend color assigner", function () {
|
||||
var testConfiguration,
|
||||
@@ -51,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
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../../src/controllers/swimlane/TimelineProxy'],
|
||||
function (TimelineProxy) {
|
||||
'use strict';
|
||||
|
||||
describe("The Timeline's selection proxy", function () {
|
||||
var mockDomainObject,
|
||||
@@ -40,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;
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../../src/controllers/swimlane/TimelineSwimlaneDecorator'],
|
||||
function (TimelineSwimlaneDecorator) {
|
||||
'use strict';
|
||||
|
||||
describe("A Timeline swimlane decorator", function () {
|
||||
var mockSwimlane,
|
||||
@@ -45,7 +43,7 @@ define(
|
||||
|
||||
mockSwimlane.domainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getCapability', 'getModel' ]
|
||||
['getCapability', 'getModel']
|
||||
);
|
||||
|
||||
mockCapabilities.mutation = jasmine.createSpyObj(
|
||||
@@ -160,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) {
|
||||
|
||||
@@ -19,17 +19,16 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../../src/controllers/swimlane/TimelineSwimlaneDropHandler'],
|
||||
function (TimelineSwimlaneDropHandler) {
|
||||
"use strict";
|
||||
|
||||
describe("A timeline's swimlane drop handler", function () {
|
||||
var mockSwimlane,
|
||||
mockOtherObject,
|
||||
mockActionCapability,
|
||||
mockEditorCapability,
|
||||
mockPersistence,
|
||||
mockContext,
|
||||
mockAction,
|
||||
@@ -38,30 +37,32 @@ define(
|
||||
beforeEach(function () {
|
||||
var mockPromise = jasmine.createSpyObj('promise', ['then']);
|
||||
|
||||
mockEditorCapability = jasmine.createSpyObj('editorCapability', ['inEditContext']);
|
||||
|
||||
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']);
|
||||
@@ -72,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');
|
||||
@@ -88,19 +89,22 @@ define(
|
||||
mockSwimlane.domainObject.getCapability.andCallFake(function (c) {
|
||||
return {
|
||||
action: mockActionCapability,
|
||||
persistence: mockPersistence
|
||||
persistence: mockPersistence,
|
||||
editor: mockEditorCapability
|
||||
}[c];
|
||||
});
|
||||
mockSwimlane.parent.domainObject.getCapability.andCallFake(function (c) {
|
||||
return {
|
||||
action: mockActionCapability,
|
||||
persistence: mockPersistence
|
||||
persistence: mockPersistence,
|
||||
editor: mockEditorCapability
|
||||
}[c];
|
||||
});
|
||||
mockOtherObject.getCapability.andCallFake(function (c) {
|
||||
return {
|
||||
action: mockActionCapability,
|
||||
context: mockContext
|
||||
context: mockContext,
|
||||
editor: mockEditorCapability
|
||||
}[c];
|
||||
});
|
||||
mockContext.getParent.andReturn(mockOtherObject);
|
||||
@@ -111,13 +115,14 @@ define(
|
||||
});
|
||||
|
||||
it("disallows drop outside of edit mode", function () {
|
||||
mockEditorCapability.inEditContext.andReturn(true);
|
||||
// Verify precondition
|
||||
expect(handler.allowDropIn('d', mockSwimlane.domainObject))
|
||||
.toBeTruthy();
|
||||
expect(handler.allowDropAfter('d', mockSwimlane.domainObject))
|
||||
.toBeTruthy();
|
||||
// Act as if we're not in edit mode
|
||||
mockSwimlane.domainObject.hasCapability.andReturn(false);
|
||||
mockEditorCapability.inEditContext.andReturn(false);
|
||||
// Now, they should be disallowed
|
||||
expect(handler.allowDropIn('d', mockSwimlane.domainObject))
|
||||
.toBeFalsy();
|
||||
@@ -147,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
|
||||
@@ -162,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);
|
||||
@@ -172,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);
|
||||
@@ -186,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 = [];
|
||||
@@ -201,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;
|
||||
@@ -222,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']);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,waitsFor,jasmine,window,afterEach*/
|
||||
|
||||
define(
|
||||
['../../../src/controllers/swimlane/TimelineSwimlanePopulator'],
|
||||
function (TimelineSwimlanePopulator) {
|
||||
'use strict';
|
||||
|
||||
describe("A Timeline swimlane populator", function () {
|
||||
var mockLoader,
|
||||
@@ -44,16 +42,16 @@ define(
|
||||
}
|
||||
|
||||
function makeMockDomainObject(id, composition) {
|
||||
var mockDomainObject = jasmine.createSpyObj(
|
||||
var mockDomainObj = jasmine.createSpyObj(
|
||||
'domainObject-' + id,
|
||||
['getId', 'getModel', 'getCapability', 'useCapability']
|
||||
);
|
||||
|
||||
mockDomainObject.getId.andReturn(id);
|
||||
mockDomainObject.getModel.andReturn({ composition: composition });
|
||||
mockDomainObject.useCapability.andReturn(asPromise(false));
|
||||
mockDomainObj.getId.andReturn(id);
|
||||
mockDomainObj.getModel.andReturn({ composition: composition });
|
||||
mockDomainObj.useCapability.andReturn(asPromise(false));
|
||||
|
||||
return mockDomainObject;
|
||||
return mockDomainObj;
|
||||
}
|
||||
|
||||
function subgraph(domainObject, objects) {
|
||||
@@ -162,4 +160,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user