mirror of
https://github.com/nasa/openmct.git
synced 2025-05-31 22:50:49 +00:00
Merge branch 'open1233' into open-master
This commit is contained in:
commit
29283e4fb5
@ -256,6 +256,11 @@ define(
|
|||||||
|
|
||||||
// Position a panel after a drop event
|
// Position a panel after a drop event
|
||||||
function handleDrop(e, id, position) {
|
function handleDrop(e, id, position) {
|
||||||
|
// Don't handle this event if it has already been handled
|
||||||
|
if (e.defaultPrevented) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e.preventDefault();
|
||||||
// Store the position of this element.
|
// Store the position of this element.
|
||||||
addElement({
|
addElement({
|
||||||
type: "fixed.telemetry",
|
type: "fixed.telemetry",
|
||||||
|
@ -109,6 +109,9 @@ define(
|
|||||||
|
|
||||||
// Position a panel after a drop event
|
// Position a panel after a drop event
|
||||||
function handleDrop(e, id, position) {
|
function handleDrop(e, id, position) {
|
||||||
|
if (e.defaultPrevented) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Ensure that configuration field is populated
|
// Ensure that configuration field is populated
|
||||||
$scope.configuration = $scope.configuration || {};
|
$scope.configuration = $scope.configuration || {};
|
||||||
// Make sure there is a "panels" field in the
|
// Make sure there is a "panels" field in the
|
||||||
@ -129,6 +132,10 @@ define(
|
|||||||
}
|
}
|
||||||
// Populate template-facing position for this id
|
// Populate template-facing position for this id
|
||||||
populatePosition(id);
|
populatePosition(id);
|
||||||
|
// Layout may contain embedded views which will
|
||||||
|
// listen for drops, so call preventDefault() so
|
||||||
|
// that they can recognize that this event is handled.
|
||||||
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Position panes when the model field changes
|
// Position panes when the model field changes
|
||||||
|
@ -34,6 +34,7 @@ define(
|
|||||||
mockFormatter,
|
mockFormatter,
|
||||||
mockDomainObject,
|
mockDomainObject,
|
||||||
mockSubscription,
|
mockSubscription,
|
||||||
|
mockEvent,
|
||||||
testGrid,
|
testGrid,
|
||||||
testModel,
|
testModel,
|
||||||
testValues,
|
testValues,
|
||||||
@ -98,6 +99,10 @@ define(
|
|||||||
'subscription',
|
'subscription',
|
||||||
[ 'unsubscribe', 'getTelemetryObjects', 'getRangeValue', 'getDatum' ]
|
[ 'unsubscribe', 'getTelemetryObjects', 'getRangeValue', 'getDatum' ]
|
||||||
);
|
);
|
||||||
|
mockEvent = jasmine.createSpyObj(
|
||||||
|
'event',
|
||||||
|
[ 'preventDefault' ]
|
||||||
|
);
|
||||||
|
|
||||||
testGrid = [ 123, 456 ];
|
testGrid = [ 123, 456 ];
|
||||||
testModel = {
|
testModel = {
|
||||||
@ -302,7 +307,7 @@ define(
|
|||||||
// Notify that a drop occurred
|
// Notify that a drop occurred
|
||||||
testModel.composition.push('d');
|
testModel.composition.push('d');
|
||||||
findOn('mctDrop')(
|
findOn('mctDrop')(
|
||||||
{},
|
mockEvent,
|
||||||
'd',
|
'd',
|
||||||
{ x: 300, y: 100 }
|
{ x: 300, y: 100 }
|
||||||
);
|
);
|
||||||
@ -310,12 +315,31 @@ define(
|
|||||||
// Should have added an element
|
// Should have added an element
|
||||||
expect(testConfiguration.elements.length).toEqual(4);
|
expect(testConfiguration.elements.length).toEqual(4);
|
||||||
|
|
||||||
|
// ...and prevented default...
|
||||||
|
expect(mockEvent.preventDefault).toHaveBeenCalled();
|
||||||
|
|
||||||
// Should have triggered commit (provided by
|
// Should have triggered commit (provided by
|
||||||
// EditRepresenter) with some message.
|
// EditRepresenter) with some message.
|
||||||
expect(mockScope.commit)
|
expect(mockScope.commit)
|
||||||
.toHaveBeenCalledWith(jasmine.any(String));
|
.toHaveBeenCalledWith(jasmine.any(String));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("ignores drops when default has been prevented", function () {
|
||||||
|
// Avoids redundant drop-handling, WTD-1233
|
||||||
|
mockEvent.defaultPrevented = true;
|
||||||
|
|
||||||
|
// Notify that a drop occurred
|
||||||
|
testModel.composition.push('d');
|
||||||
|
findOn('mctDrop')(
|
||||||
|
mockEvent,
|
||||||
|
'd',
|
||||||
|
{ x: 300, y: 100 }
|
||||||
|
);
|
||||||
|
|
||||||
|
// Should NOT have added an element
|
||||||
|
expect(testConfiguration.elements.length).toEqual(3);
|
||||||
|
});
|
||||||
|
|
||||||
it("unsubscribes when destroyed", function () {
|
it("unsubscribes when destroyed", function () {
|
||||||
// Make an object available
|
// Make an object available
|
||||||
findWatch('domainObject')(mockDomainObject);
|
findWatch('domainObject')(mockDomainObject);
|
||||||
|
@ -28,6 +28,7 @@ define(
|
|||||||
|
|
||||||
describe("The Layout controller", function () {
|
describe("The Layout controller", function () {
|
||||||
var mockScope,
|
var mockScope,
|
||||||
|
mockEvent,
|
||||||
testModel,
|
testModel,
|
||||||
testConfiguration,
|
testConfiguration,
|
||||||
controller;
|
controller;
|
||||||
@ -37,6 +38,10 @@ define(
|
|||||||
"$scope",
|
"$scope",
|
||||||
[ "$watch", "$on", "commit" ]
|
[ "$watch", "$on", "commit" ]
|
||||||
);
|
);
|
||||||
|
mockEvent = jasmine.createSpyObj(
|
||||||
|
'event',
|
||||||
|
[ 'preventDefault' ]
|
||||||
|
);
|
||||||
|
|
||||||
testModel = {
|
testModel = {
|
||||||
composition: [ "a", "b", "c" ]
|
composition: [ "a", "b", "c" ]
|
||||||
@ -144,17 +149,32 @@ define(
|
|||||||
// Notify that a drop occurred
|
// Notify that a drop occurred
|
||||||
testModel.composition.push('d');
|
testModel.composition.push('d');
|
||||||
mockScope.$on.mostRecentCall.args[1](
|
mockScope.$on.mostRecentCall.args[1](
|
||||||
{},
|
mockEvent,
|
||||||
'd',
|
'd',
|
||||||
{ x: 300, y: 100 }
|
{ x: 300, y: 100 }
|
||||||
);
|
);
|
||||||
expect(testConfiguration.panels.d).toBeDefined();
|
expect(testConfiguration.panels.d).toBeDefined();
|
||||||
|
expect(mockEvent.preventDefault).toHaveBeenCalled();
|
||||||
|
|
||||||
// Should have triggered commit (provided by
|
// Should have triggered commit (provided by
|
||||||
// EditRepresenter) with some message.
|
// EditRepresenter) with some message.
|
||||||
expect(mockScope.commit)
|
expect(mockScope.commit)
|
||||||
.toHaveBeenCalledWith(jasmine.any(String));
|
.toHaveBeenCalledWith(jasmine.any(String));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("ignores drops when default has been prevented", function () {
|
||||||
|
// Avoids redundant drop-handling, WTD-1233
|
||||||
|
mockEvent.defaultPrevented = true;
|
||||||
|
|
||||||
|
// Notify that a drop occurred
|
||||||
|
testModel.composition.push('d');
|
||||||
|
mockScope.$on.mostRecentCall.args[1](
|
||||||
|
mockEvent,
|
||||||
|
'd',
|
||||||
|
{ x: 300, y: 100 }
|
||||||
|
);
|
||||||
|
expect(testConfiguration.panels.d).not.toBeDefined();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
@ -17,7 +17,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "ELASTIC_ROOT",
|
"key": "ELASTIC_ROOT",
|
||||||
"value": "/elastic",
|
"value": "http://localhost:9200",
|
||||||
"priority": "fallback"
|
"priority": "fallback"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user