Merge branch 'master' into open671
Conflicts: main.js platform/commonUI/edit/src/policies/EditableMovePolicy.js platform/commonUI/general/src/directives/MCTTree.js platform/commonUI/general/src/ui/ToggleView.js platform/core/src/actions/ActionCapability.js platform/core/test/models/CachingModelDecoratorSpec.js platform/core/test/services/InstantiateSpec.js platform/features/events/bundle.js platform/features/events/src/DomainColumn.js platform/features/events/src/EventListController.js platform/features/events/src/EventListPopulator.js platform/features/events/src/RangeColumn.js platform/features/events/src/directives/MCTDataTable.js platform/features/events/src/policies/MessagesViewPolicy.js platform/features/events/test/DomainColumnSpec.js platform/features/events/test/EventListControllerSpec.js platform/features/events/test/EventListPopulatorSpec.js platform/features/events/test/RangeColumnSpec.js platform/features/events/test/policies/MessagesViewPolicySpec.js platform/features/rtevents/bundle.js platform/features/rtevents/src/DomainColumn.js platform/features/rtevents/src/RTEventListController.js platform/features/rtevents/src/RangeColumn.js platform/features/rtevents/src/directives/MCTRTDataTable.js platform/features/rtevents/src/policies/RTMessagesViewPolicy.js platform/features/rtevents/test/DomainColumnSpec.js platform/features/rtevents/test/RTEventListControllerSpec.js platform/features/rtevents/test/RangeColumnSpec.js platform/features/rtevents/test/policies/RTMessagesViewPolicySpec.js platform/features/rtscrolling/bundle.js platform/features/rtscrolling/src/DomainColumn.js platform/features/rtscrolling/src/NameColumn.js platform/features/rtscrolling/src/RTScrollingListController.js platform/features/rtscrolling/src/RangeColumn.js platform/features/scrolling/src/DomainColumn.js platform/features/scrolling/src/RangeColumn.js platform/features/scrolling/src/ScrollingListController.js platform/features/scrolling/src/ScrollingListPopulator.js platform/features/scrolling/test/DomainColumnSpec.js platform/features/scrolling/test/RangeColumnSpec.js platform/features/scrolling/test/ScrollingListControllerSpec.js platform/features/scrolling/test/ScrollingListPopulatorSpec.js platform/features/table/src/directives/MCTTable.js platform/features/table/test/controllers/TelemetryTableControllerSpec.js platform/representation/src/gestures/DropGesture.js platform/telemetry/src/TelemetryFormatter.js test-main.js
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2009-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* 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'],
|
||||
function (CompositionColumn) {
|
||||
describe("CompositionColumn", function () {
|
||||
var testIndex,
|
||||
column;
|
||||
|
||||
beforeEach(function () {
|
||||
testIndex = 3;
|
||||
column = new CompositionColumn(testIndex);
|
||||
});
|
||||
|
||||
it("includes a one-based index in its name", function () {
|
||||
expect(column.name().indexOf(String(testIndex + 1)))
|
||||
.not.toEqual(-1);
|
||||
});
|
||||
|
||||
describe("value", function () {
|
||||
var mockDomainObject,
|
||||
testModel;
|
||||
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getModel', 'getCapability' ]
|
||||
);
|
||||
testModel = {
|
||||
composition: [ 'a', 'b', 'c', 'd', 'e', 'f' ]
|
||||
};
|
||||
mockDomainObject.getModel.andReturn(testModel);
|
||||
});
|
||||
|
||||
it("returns a corresponding identifier", function () {
|
||||
expect(column.value(mockDomainObject))
|
||||
.toEqual(testModel.composition[testIndex]);
|
||||
});
|
||||
|
||||
it("returns nothing when composition is exceeded", function () {
|
||||
testModel.composition = [ 'foo' ];
|
||||
expect(column.value(mockDomainObject)).toEqual("");
|
||||
});
|
||||
|
||||
it("returns nothing when composition is absent", function () {
|
||||
delete testModel.composition;
|
||||
expect(column.value(mockDomainObject)).toEqual("");
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,153 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2009-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* 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'],
|
||||
function (ExportTimelineAsCSVAction) {
|
||||
describe("ExportTimelineAsCSVAction", function () {
|
||||
var mockExportService,
|
||||
mockNotificationService,
|
||||
mockNotification,
|
||||
mockDomainObject,
|
||||
mockType,
|
||||
testContext,
|
||||
testType,
|
||||
action;
|
||||
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getModel', 'getCapability', 'hasCapability' ]
|
||||
);
|
||||
mockType = jasmine.createSpyObj('type', [ 'instanceOf' ]);
|
||||
mockExportService = jasmine.createSpyObj(
|
||||
'exportService',
|
||||
[ 'exportCSV' ]
|
||||
);
|
||||
mockNotificationService = jasmine.createSpyObj(
|
||||
'notificationService',
|
||||
[ 'notify', 'error' ]
|
||||
);
|
||||
mockNotification = jasmine.createSpyObj(
|
||||
'notification',
|
||||
[ 'dismiss' ]
|
||||
);
|
||||
|
||||
mockNotificationService.notify.andReturn(mockNotification);
|
||||
|
||||
mockDomainObject.hasCapability.andReturn(true);
|
||||
mockDomainObject.getCapability.andReturn(mockType);
|
||||
mockType.instanceOf.andCallFake(function (type) {
|
||||
return type === testType;
|
||||
});
|
||||
|
||||
testContext = { domainObject: mockDomainObject };
|
||||
|
||||
action = new ExportTimelineAsCSVAction(
|
||||
mockExportService,
|
||||
mockNotificationService,
|
||||
testContext
|
||||
);
|
||||
});
|
||||
|
||||
it("is applicable to timelines", function () {
|
||||
testType = 'timeline';
|
||||
expect(ExportTimelineAsCSVAction.appliesTo(testContext))
|
||||
.toBe(true);
|
||||
});
|
||||
|
||||
it("is not applicable to non-timelines", function () {
|
||||
testType = 'folder';
|
||||
expect(ExportTimelineAsCSVAction.appliesTo(testContext))
|
||||
.toBe(false);
|
||||
});
|
||||
|
||||
describe("when performed", function () {
|
||||
var testPromise,
|
||||
mockCallback;
|
||||
|
||||
beforeEach(function () {
|
||||
mockCallback = jasmine.createSpy('callback');
|
||||
// White-boxy; we know most work is delegated
|
||||
// to the associated Task, so stub out that interaction.
|
||||
spyOn(action.task, "run").andCallFake(function () {
|
||||
return new Promise(function (resolve, reject) {
|
||||
testPromise = {
|
||||
resolve: resolve,
|
||||
reject: reject
|
||||
};
|
||||
});
|
||||
});
|
||||
action.perform().then(mockCallback);
|
||||
});
|
||||
|
||||
it("shows a notification", function () {
|
||||
expect(mockNotificationService.notify)
|
||||
.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("starts an export task", function () {
|
||||
expect(action.task.run).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe("and completed", function () {
|
||||
beforeEach(function () {
|
||||
testPromise.resolve();
|
||||
waitsFor(function () {
|
||||
return mockCallback.calls.length > 0;
|
||||
});
|
||||
});
|
||||
|
||||
it("dismisses the displayed notification", function () {
|
||||
expect(mockNotification.dismiss)
|
||||
.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("shows no error messages", function () {
|
||||
expect(mockNotificationService.error)
|
||||
.not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("and an error occurs", function () {
|
||||
beforeEach(function () {
|
||||
testPromise.reject();
|
||||
waitsFor(function () {
|
||||
return mockCallback.calls.length > 0;
|
||||
});
|
||||
});
|
||||
|
||||
it("dismisses the displayed notification", function () {
|
||||
expect(mockNotification.dismiss)
|
||||
.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("shows an error message", function () {
|
||||
expect(mockNotificationService.error)
|
||||
.toHaveBeenCalledWith(jasmine.any(String));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,79 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2009-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* 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.
|
||||
describe("EXportTimelineAsCSVTask", function () {
|
||||
var mockExportService,
|
||||
mockDomainObject,
|
||||
task;
|
||||
|
||||
beforeEach(function () {
|
||||
mockExportService = jasmine.createSpyObj(
|
||||
'exportService',
|
||||
[ 'exportCSV' ]
|
||||
);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[
|
||||
'getCapability',
|
||||
'useCapability',
|
||||
'hasCapability',
|
||||
'getId',
|
||||
'getModel'
|
||||
]
|
||||
);
|
||||
|
||||
mockDomainObject.getId.andReturn('mock');
|
||||
mockDomainObject.getModel.andReturn({});
|
||||
|
||||
task = new ExportTimelineAsCSVTask(
|
||||
mockExportService,
|
||||
mockDomainObject
|
||||
);
|
||||
});
|
||||
|
||||
describe("when run", function () {
|
||||
var mockCallback;
|
||||
|
||||
beforeEach(function () {
|
||||
mockCallback = jasmine.createSpy('callback');
|
||||
task.run().then(mockCallback);
|
||||
waitsFor(function () {
|
||||
return mockCallback.calls.length > 0;
|
||||
});
|
||||
});
|
||||
|
||||
it("exports to CSV", function () {
|
||||
expect(mockExportService.exportCSV)
|
||||
.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
59
platform/features/timeline/test/actions/IdColumnSpec.js
Normal file
59
platform/features/timeline/test/actions/IdColumnSpec.js
Normal file
@@ -0,0 +1,59 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2009-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* 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'],
|
||||
function (IdColumn) {
|
||||
describe("IdColumn", function () {
|
||||
var column;
|
||||
|
||||
beforeEach(function () {
|
||||
column = new IdColumn();
|
||||
});
|
||||
|
||||
it("has a name", function () {
|
||||
expect(column.name()).toEqual(jasmine.any(String));
|
||||
});
|
||||
|
||||
describe("value", function () {
|
||||
var mockDomainObject,
|
||||
testId;
|
||||
|
||||
beforeEach(function () {
|
||||
testId = "foo";
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getModel', 'getCapability' ]
|
||||
);
|
||||
mockDomainObject.getId.andReturn(testId);
|
||||
});
|
||||
|
||||
it("provides a domain object's identifier", function () {
|
||||
expect(column.value(mockDomainObject))
|
||||
.toEqual(testId);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,76 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2009-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* 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'],
|
||||
function (MetadataColumn) {
|
||||
describe("MetadataColumn", function () {
|
||||
var testName,
|
||||
column;
|
||||
|
||||
beforeEach(function () {
|
||||
testName = 'Foo';
|
||||
column = new MetadataColumn(testName);
|
||||
});
|
||||
|
||||
it("reports its property name", function () {
|
||||
expect(column.name()).toEqual(testName);
|
||||
});
|
||||
|
||||
describe("value", function () {
|
||||
var mockDomainObject,
|
||||
testMetadata,
|
||||
testIndex;
|
||||
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getModel', 'getCapability', 'useCapability' ]
|
||||
);
|
||||
testMetadata = [
|
||||
{ name: "Something else", value: 123 },
|
||||
{ value: 456 },
|
||||
{ name: "And something else", value: 789 }
|
||||
];
|
||||
testIndex = 1;
|
||||
testMetadata[testIndex].name = testName;
|
||||
|
||||
mockDomainObject.useCapability.andCallFake(function (c) {
|
||||
return (c === 'metadata') && testMetadata;
|
||||
});
|
||||
});
|
||||
|
||||
it("returns a corresponding value", function () {
|
||||
expect(column.value(mockDomainObject))
|
||||
.toEqual(testMetadata[testIndex].value);
|
||||
});
|
||||
|
||||
it("returns nothing when no such property is present", function () {
|
||||
testMetadata[testIndex].name = "Not " + testName;
|
||||
expect(column.value(mockDomainObject)).toEqual("");
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
76
platform/features/timeline/test/actions/ModeColumnSpec.js
Normal file
76
platform/features/timeline/test/actions/ModeColumnSpec.js
Normal file
@@ -0,0 +1,76 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2009-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* 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'],
|
||||
function (ModeColumn) {
|
||||
describe("ModeColumn", function () {
|
||||
var testIndex,
|
||||
column;
|
||||
|
||||
beforeEach(function () {
|
||||
testIndex = 3;
|
||||
column = new ModeColumn(testIndex);
|
||||
});
|
||||
|
||||
it("includes a one-based index in its name", function () {
|
||||
expect(column.name().indexOf(String(testIndex + 1)))
|
||||
.not.toEqual(-1);
|
||||
});
|
||||
|
||||
describe("value", function () {
|
||||
var mockDomainObject,
|
||||
testModel;
|
||||
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getModel', 'getCapability' ]
|
||||
);
|
||||
testModel = {
|
||||
relationships: {
|
||||
modes: [ 'a', 'b', 'c', 'd', 'e', 'f' ]
|
||||
}
|
||||
};
|
||||
mockDomainObject.getModel.andReturn(testModel);
|
||||
});
|
||||
|
||||
it("returns a corresponding identifier", function () {
|
||||
expect(column.value(mockDomainObject))
|
||||
.toEqual(testModel.relationships.modes[testIndex]);
|
||||
});
|
||||
|
||||
it("returns nothing when relationships are exceeded", function () {
|
||||
testModel.relationships.modes = [ 'foo' ];
|
||||
expect(column.value(mockDomainObject)).toEqual("");
|
||||
});
|
||||
|
||||
it("returns nothing when mode relationships are absent", function () {
|
||||
delete testModel.relationships.modes;
|
||||
expect(column.value(mockDomainObject)).toEqual("");
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,129 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2009-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* 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'],
|
||||
function (TimelineColumnizer) {
|
||||
describe("TimelineColumnizer", function () {
|
||||
var mockDomainObjects,
|
||||
testMetadata,
|
||||
exporter;
|
||||
|
||||
function makeMockDomainObject(model, index) {
|
||||
var mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject-' + index,
|
||||
[
|
||||
'getId',
|
||||
'getCapability',
|
||||
'useCapability',
|
||||
'hasCapability',
|
||||
'getModel'
|
||||
]
|
||||
);
|
||||
mockDomainObject.getId.andReturn('id-' + index);
|
||||
mockDomainObject.getModel.andReturn(model);
|
||||
mockDomainObject.useCapability.andCallFake(function (c) {
|
||||
return c === 'metadata' && [];
|
||||
});
|
||||
return mockDomainObject;
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
var mockTimespan = jasmine.createSpyObj(
|
||||
'timespan',
|
||||
[ 'getStart', 'getEnd' ]
|
||||
);
|
||||
|
||||
testMetadata = [
|
||||
{ name: "abc", value: 123 },
|
||||
{ name: "xyz", value: 456 }
|
||||
];
|
||||
|
||||
mockDomainObjects = [
|
||||
{ composition: [ 'a', 'b', 'c' ] },
|
||||
{ relationships: { modes: [ 'x', 'y' ] } },
|
||||
{ }
|
||||
].map(makeMockDomainObject);
|
||||
|
||||
mockDomainObjects[1].hasCapability.andCallFake(function (c) {
|
||||
return c === 'timespan';
|
||||
});
|
||||
mockDomainObjects[1].useCapability.andCallFake(function (c) {
|
||||
return c === 'timespan' ? Promise.resolve(mockTimespan) :
|
||||
c === 'metadata' ? [] : undefined;
|
||||
});
|
||||
mockDomainObjects[2].useCapability.andCallFake(function (c) {
|
||||
return c === 'metadata' && testMetadata;
|
||||
});
|
||||
|
||||
exporter = new TimelineColumnizer(mockDomainObjects);
|
||||
});
|
||||
|
||||
describe("rows", function () {
|
||||
var rows;
|
||||
|
||||
beforeEach(function () {
|
||||
exporter.rows().then(function (r) {
|
||||
rows = r;
|
||||
});
|
||||
waitsFor(function () {
|
||||
return rows !== undefined;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it("include one row per domain object", function () {
|
||||
expect(rows.length).toEqual(mockDomainObjects.length);
|
||||
});
|
||||
|
||||
it("includes identifiers for each domain object", function () {
|
||||
rows.forEach(function (row, index) {
|
||||
var id = mockDomainObjects[index].getId();
|
||||
expect(row.indexOf(id)).not.toEqual(-1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("headers", function () {
|
||||
var headers;
|
||||
|
||||
beforeEach(function () {
|
||||
headers = exporter.headers();
|
||||
});
|
||||
|
||||
it("contains all metadata properties", function () {
|
||||
testMetadata.forEach(function (property) {
|
||||
expect(headers.indexOf(property.name))
|
||||
.not.toEqual(-1);
|
||||
});
|
||||
});
|
||||
|
||||
it("contains timespan properties", function () {
|
||||
expect(headers.indexOf("Start")).not.toEqual(-1);
|
||||
expect(headers.indexOf("End")).not.toEqual(-1);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
137
platform/features/timeline/test/actions/TimelineTraverserSpec.js
Normal file
137
platform/features/timeline/test/actions/TimelineTraverserSpec.js
Normal file
@@ -0,0 +1,137 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2009-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* 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,
|
||||
mockDomainObjects,
|
||||
traverser;
|
||||
|
||||
function addMockDomainObject(id) {
|
||||
var mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject-' + id,
|
||||
[
|
||||
'getId',
|
||||
'getCapability',
|
||||
'useCapability',
|
||||
'hasCapability',
|
||||
'getModel'
|
||||
]
|
||||
),
|
||||
mockRelationships,
|
||||
model = testModels[id];
|
||||
|
||||
mockDomainObject.getId.andReturn(id);
|
||||
mockDomainObject.getModel.andReturn(model);
|
||||
|
||||
mockDomainObject.hasCapability.andCallFake(function (c) {
|
||||
return c === 'composition' ? !!model.composition :
|
||||
c === 'relationship' ? !!model.relationships :
|
||||
false;
|
||||
});
|
||||
|
||||
if (!!model.composition) {
|
||||
mockDomainObject.useCapability.andCallFake(function (c) {
|
||||
return c === 'composition' &&
|
||||
Promise.resolve(model.composition.map(function (id) {
|
||||
return mockDomainObjects[id];
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
if (!!model.relationships) {
|
||||
mockRelationships = jasmine.createSpyObj(
|
||||
'relationship',
|
||||
['getRelatedObjects']
|
||||
);
|
||||
mockRelationships.getRelatedObjects.andCallFake(function (k) {
|
||||
var ids = model.relationships[k] || [];
|
||||
return Promise.resolve(ids.map(function (id) {
|
||||
return mockDomainObjects[id];
|
||||
}));
|
||||
});
|
||||
mockDomainObject.getCapability.andCallFake(function (c) {
|
||||
return c === 'relationship' && mockRelationships;
|
||||
});
|
||||
}
|
||||
|
||||
mockDomainObjects[id] = mockDomainObject;
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
testModels = {
|
||||
a: { composition: [ 'b', 'c' ]},
|
||||
b: { composition: [ 'c' ] },
|
||||
c: { relationships: { modes: [ 'd' ] } },
|
||||
d: {},
|
||||
unreachable: {}
|
||||
};
|
||||
|
||||
mockDomainObjects = {};
|
||||
Object.keys(testModels).forEach(addMockDomainObject);
|
||||
|
||||
traverser = new TimelineTraverser(mockDomainObjects.a);
|
||||
});
|
||||
|
||||
describe("buildObjectList", function () {
|
||||
var objects;
|
||||
|
||||
function contains(id) {
|
||||
return objects.some(function (object) {
|
||||
return object.getId() === id;
|
||||
});
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
traverser.buildObjectList().then(function (objectList) {
|
||||
objects = objectList;
|
||||
});
|
||||
waitsFor(function () {
|
||||
return objects !== undefined;
|
||||
});
|
||||
});
|
||||
|
||||
it("includes the object originally passed in", function () {
|
||||
expect(contains('a')).toBe(true);
|
||||
});
|
||||
|
||||
it("includes objects reachable via composition", function () {
|
||||
expect(contains('b')).toBe(true);
|
||||
expect(contains('c')).toBe(true);
|
||||
});
|
||||
|
||||
it("includes objects reachable via relationships", function () {
|
||||
expect(contains('d')).toBe(true);
|
||||
});
|
||||
|
||||
it("does not include unreachable objects", function () {
|
||||
expect(contains('unreachable')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,94 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2009-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* 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'],
|
||||
function (TimespanColumn, TimelineFormatter) {
|
||||
describe("TimespanColumn", function () {
|
||||
var testTimes,
|
||||
mockTimespan,
|
||||
mockDomainObject,
|
||||
column;
|
||||
|
||||
beforeEach(function () {
|
||||
testTimes = {
|
||||
start: 101000,
|
||||
end: 987654321
|
||||
};
|
||||
mockTimespan = jasmine.createSpyObj(
|
||||
'timespan',
|
||||
[ 'getStart', 'getEnd' ]
|
||||
);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'useCapability', 'hasCapability' ]
|
||||
);
|
||||
mockTimespan.getStart.andReturn(testTimes.start);
|
||||
mockTimespan.getEnd.andReturn(testTimes.end);
|
||||
mockDomainObject.useCapability.andCallFake(function (c) {
|
||||
return c === 'timespan' && Promise.resolve(mockTimespan);
|
||||
});
|
||||
mockDomainObject.hasCapability.andCallFake(function (c) {
|
||||
return c === 'timespan';
|
||||
});
|
||||
});
|
||||
|
||||
[ "start", "end" ].forEach(function (bound) {
|
||||
describe("when referring to " + bound + " times", function () {
|
||||
var name = bound.charAt(0).toUpperCase() + bound.slice(1);
|
||||
|
||||
beforeEach(function () {
|
||||
column = new TimespanColumn(bound === "start");
|
||||
});
|
||||
|
||||
it("is named \"" + name + "\"", function () {
|
||||
expect(column.name()).toEqual(name);
|
||||
});
|
||||
|
||||
describe("value", function () {
|
||||
var testFormatter,
|
||||
value;
|
||||
|
||||
beforeEach(function () {
|
||||
value = undefined;
|
||||
testFormatter = new TimelineFormatter();
|
||||
column.value(mockDomainObject).then(function (v) {
|
||||
value = v;
|
||||
});
|
||||
waitsFor(function () {
|
||||
return value !== undefined;
|
||||
});
|
||||
});
|
||||
|
||||
it("returns a formatted " + bound + " time", function () {
|
||||
var expected =
|
||||
testFormatter.format(testTimes[bound]);
|
||||
expect(value).toEqual(expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -30,12 +30,14 @@ define(
|
||||
mockCapabilities,
|
||||
testModel,
|
||||
mockPromise,
|
||||
testModes,
|
||||
decorator;
|
||||
|
||||
beforeEach(function () {
|
||||
mockSwimlane = {};
|
||||
mockCapabilities = {};
|
||||
testModel = {};
|
||||
testModes = ['a', 'b', 'c'];
|
||||
|
||||
mockSelection = jasmine.createSpyObj('selection', ['select', 'get']);
|
||||
|
||||
@@ -133,6 +135,22 @@ define(
|
||||
expect(mockCapabilities.persistence.persist).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not mutate modes when unchanged", function () {
|
||||
testModel.relationships = { modes: testModes };
|
||||
decorator.modes(testModes);
|
||||
expect(mockCapabilities.mutation.mutate).not.toHaveBeenCalled();
|
||||
expect(testModel.relationships.modes).toEqual(testModes);
|
||||
});
|
||||
|
||||
it("does mutate modes when changed", function () {
|
||||
var testModes2 = ['d', 'e', 'f'];
|
||||
testModel.relationships = { modes: testModes };
|
||||
decorator.modes(testModes2);
|
||||
expect(mockCapabilities.mutation.mutate).toHaveBeenCalled();
|
||||
mockCapabilities.mutation.mutate.mostRecentCall.args[0](testModel);
|
||||
expect(testModel.relationships.modes).toBe(testModes2);
|
||||
});
|
||||
|
||||
it("does not provide a 'remove' method with no parent", function () {
|
||||
expect(decorator.remove).not.toEqual(jasmine.any(Function));
|
||||
});
|
||||
|
||||
@@ -29,9 +29,13 @@ define(
|
||||
mockOtherObject,
|
||||
mockActionCapability,
|
||||
mockPersistence,
|
||||
mockContext,
|
||||
mockAction,
|
||||
handler;
|
||||
|
||||
beforeEach(function () {
|
||||
var mockPromise = jasmine.createSpyObj('promise', ['then']);
|
||||
|
||||
mockSwimlane = jasmine.createSpyObj(
|
||||
"swimlane",
|
||||
[ "highlight", "highlightBottom" ]
|
||||
@@ -58,6 +62,11 @@ define(
|
||||
[ "getId", "getCapability", "useCapability", "hasCapability" ]
|
||||
);
|
||||
|
||||
mockAction = jasmine.createSpyObj('action', ['perform']);
|
||||
mockAction.perform.andReturn(mockPromise);
|
||||
mockPromise.then.andCallFake(function (callback) {
|
||||
callback();
|
||||
});
|
||||
|
||||
mockOtherObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
@@ -65,20 +74,34 @@ define(
|
||||
);
|
||||
mockActionCapability = jasmine.createSpyObj("action", ["perform", "getActions"]);
|
||||
mockPersistence = jasmine.createSpyObj("persistence", ["persist"]);
|
||||
mockContext = jasmine.createSpyObj('context', [ 'getParent' ]);
|
||||
|
||||
mockActionCapability.getActions.andReturn([{}]);
|
||||
mockActionCapability.getActions.andReturn([mockAction]);
|
||||
mockSwimlane.parent.domainObject.getId.andReturn('a');
|
||||
mockSwimlane.domainObject.getId.andReturn('b');
|
||||
mockSwimlane.children[0].domainObject.getId.andReturn('c');
|
||||
mockOtherObject.getId.andReturn('d');
|
||||
|
||||
|
||||
mockSwimlane.domainObject.getCapability.andCallFake(function (c) {
|
||||
return {
|
||||
action: mockActionCapability,
|
||||
persistence: mockPersistence
|
||||
}[c];
|
||||
});
|
||||
mockOtherObject.getCapability.andReturn(mockActionCapability);
|
||||
mockSwimlane.parent.domainObject.getCapability.andCallFake(function (c) {
|
||||
return {
|
||||
action: mockActionCapability,
|
||||
persistence: mockPersistence
|
||||
}[c];
|
||||
});
|
||||
mockOtherObject.getCapability.andCallFake(function (c) {
|
||||
return {
|
||||
action: mockActionCapability,
|
||||
context: mockContext
|
||||
}[c];
|
||||
});
|
||||
mockContext.getParent.andReturn(mockOtherObject);
|
||||
|
||||
mockSwimlane.domainObject.hasCapability.andReturn(true);
|
||||
|
||||
@@ -87,13 +110,17 @@ define(
|
||||
|
||||
it("disallows drop outside of edit mode", function () {
|
||||
// Verify precondition
|
||||
expect(handler.allowDropIn('d')).toBeTruthy();
|
||||
expect(handler.allowDropAfter('d')).toBeTruthy();
|
||||
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);
|
||||
// Now, they should be disallowed
|
||||
expect(handler.allowDropIn('d')).toBeFalsy();
|
||||
expect(handler.allowDropAfter('d')).toBeFalsy();
|
||||
expect(handler.allowDropIn('d', mockSwimlane.domainObject))
|
||||
.toBeFalsy();
|
||||
expect(handler.allowDropAfter('d', mockSwimlane.domainObject))
|
||||
.toBeFalsy();
|
||||
|
||||
// Verify that editor capability was really checked for
|
||||
expect(mockSwimlane.domainObject.hasCapability)
|
||||
@@ -101,8 +128,9 @@ define(
|
||||
});
|
||||
|
||||
it("disallows dropping of parents", function () {
|
||||
expect(handler.allowDropIn('a')).toBeFalsy();
|
||||
expect(handler.allowDropAfter('a')).toBeFalsy();
|
||||
var mockParent = mockSwimlane.parent.domainObject;
|
||||
expect(handler.allowDropIn('a', mockParent)).toBeFalsy();
|
||||
expect(handler.allowDropAfter('a', mockParent)).toBeFalsy();
|
||||
});
|
||||
|
||||
it("does not drop when no highlight state is present", function () {
|
||||
@@ -119,7 +147,7 @@ define(
|
||||
it("inserts into when highlighted", function () {
|
||||
var testModel = { composition: [ 'c' ] };
|
||||
mockSwimlane.highlight.andReturn(true);
|
||||
handler.drop('d');
|
||||
handler.drop('d', mockOtherObject);
|
||||
// Should have mutated
|
||||
expect(mockSwimlane.domainObject.useCapability)
|
||||
.toHaveBeenCalledWith("mutation", jasmine.any(Function));
|
||||
@@ -131,24 +159,11 @@ define(
|
||||
expect(mockPersistence.persist).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("removes objects before insertion, if provided", function () {
|
||||
var testModel = { composition: [ 'c' ] };
|
||||
mockSwimlane.highlight.andReturn(true);
|
||||
handler.drop('d', mockOtherObject);
|
||||
// Should have invoked a remove action
|
||||
expect(mockActionCapability.perform)
|
||||
.toHaveBeenCalledWith('remove');
|
||||
// Verify that mutator still ran as expected
|
||||
mockSwimlane.domainObject.useCapability.mostRecentCall
|
||||
.args[1](testModel);
|
||||
expect(testModel.composition).toEqual(['c', 'd']);
|
||||
});
|
||||
|
||||
it("inserts after as a peer when highlighted at the bottom", function () {
|
||||
var testModel = { composition: [ 'x', 'b', 'y' ] };
|
||||
mockSwimlane.highlightBottom.andReturn(true);
|
||||
mockSwimlane.expanded = false;
|
||||
handler.drop('d');
|
||||
handler.drop('d', mockOtherObject);
|
||||
// Should have mutated
|
||||
expect(mockSwimlane.parent.domainObject.useCapability)
|
||||
.toHaveBeenCalledWith("mutation", jasmine.any(Function));
|
||||
@@ -162,7 +177,7 @@ define(
|
||||
var testModel = { composition: [ 'c' ] };
|
||||
mockSwimlane.highlightBottom.andReturn(true);
|
||||
mockSwimlane.expanded = true;
|
||||
handler.drop('d');
|
||||
handler.drop('d', mockOtherObject);
|
||||
// Should have mutated
|
||||
expect(mockSwimlane.domainObject.useCapability)
|
||||
.toHaveBeenCalledWith("mutation", jasmine.any(Function));
|
||||
@@ -177,7 +192,7 @@ define(
|
||||
mockSwimlane.highlightBottom.andReturn(true);
|
||||
mockSwimlane.expanded = true;
|
||||
mockSwimlane.children = [];
|
||||
handler.drop('d');
|
||||
handler.drop('d', mockOtherObject);
|
||||
// Should have mutated
|
||||
expect(mockSwimlane.parent.domainObject.useCapability)
|
||||
.toHaveBeenCalledWith("mutation", jasmine.any(Function));
|
||||
@@ -187,6 +202,38 @@ define(
|
||||
expect(testModel.composition).toEqual([ 'x', 'b', 'd', 'y']);
|
||||
});
|
||||
|
||||
it("allows reordering within a parent", function () {
|
||||
var testModel = { composition: [ 'x', 'b', 'y', 'd' ] };
|
||||
|
||||
mockSwimlane.highlightBottom.andReturn(true);
|
||||
mockSwimlane.expanded = true;
|
||||
mockSwimlane.children = [];
|
||||
mockContext.getParent
|
||||
.andReturn(mockSwimlane.parent.domainObject);
|
||||
handler.drop('d', mockOtherObject);
|
||||
|
||||
waitsFor(function () {
|
||||
return mockSwimlane.parent.domainObject.useCapability
|
||||
.calls.length > 0;
|
||||
});
|
||||
|
||||
runs(function () {
|
||||
mockSwimlane.parent.domainObject.useCapability.mostRecentCall
|
||||
.args[1](testModel);
|
||||
expect(testModel.composition).toEqual([ 'x', 'b', 'd', 'y']);
|
||||
});
|
||||
});
|
||||
|
||||
it("does not invoke an action when reordering", function () {
|
||||
mockSwimlane.highlightBottom.andReturn(true);
|
||||
mockSwimlane.expanded = true;
|
||||
mockSwimlane.children = [];
|
||||
mockContext.getParent
|
||||
.andReturn(mockSwimlane.parent.domainObject);
|
||||
handler.drop('d', mockOtherObject);
|
||||
expect(mockAction.perform).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -52,7 +52,7 @@ define(
|
||||
'dndService',
|
||||
['setData', 'getData', 'removeData']
|
||||
);
|
||||
mockScope = jasmine.createSpyObj('$scope', ['$eval']);
|
||||
mockScope = jasmine.createSpyObj('$scope', ['$eval', '$apply']);
|
||||
mockElement = jasmine.createSpyObj('element', ['on']);
|
||||
testAttrs = { mctSwimlaneDrop: "mockSwimlane" };
|
||||
mockSwimlane = jasmine.createSpyObj(
|
||||
@@ -115,6 +115,7 @@ define(
|
||||
|
||||
expect(mockSwimlane.highlight).toHaveBeenCalledWith(true);
|
||||
expect(mockSwimlane.highlightBottom).toHaveBeenCalledWith(false);
|
||||
expect(mockScope.$apply).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("updates bottom highlights on drag over", function () {
|
||||
@@ -125,6 +126,7 @@ define(
|
||||
|
||||
expect(mockSwimlane.highlight).toHaveBeenCalledWith(false);
|
||||
expect(mockSwimlane.highlightBottom).toHaveBeenCalledWith(true);
|
||||
expect(mockScope.$apply).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("respects swimlane's allowDropIn response", function () {
|
||||
@@ -154,12 +156,20 @@ define(
|
||||
it("notifies swimlane on drop", function () {
|
||||
handlers.drop(testEvent);
|
||||
expect(mockSwimlane.drop).toHaveBeenCalledWith('abc', 'someDomainObject');
|
||||
expect(mockScope.$apply).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("invokes preventDefault on drop", function () {
|
||||
handlers.drop(testEvent);
|
||||
expect(testEvent.preventDefault).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("clears highlights when drag leaves", function () {
|
||||
mockSwimlane.highlight.andReturn(true);
|
||||
handlers.dragleave();
|
||||
expect(mockSwimlane.highlight).toHaveBeenCalledWith(false);
|
||||
expect(mockSwimlane.highlightBottom).toHaveBeenCalledWith(false);
|
||||
expect(mockScope.$apply).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user