mirror of
https://github.com/nasa/openmct.git
synced 2025-02-01 16:58:04 +00:00
Merge pull request #275 from nasa/open271
[Layout] Enforce minimum size on drop
This commit is contained in:
commit
b7eb9491cb
@ -113,7 +113,7 @@ define(
|
|||||||
Math.floor(position.x / self.gridSize[0]),
|
Math.floor(position.x / self.gridSize[0]),
|
||||||
Math.floor(position.y / self.gridSize[1])
|
Math.floor(position.y / self.gridSize[1])
|
||||||
],
|
],
|
||||||
dimensions: DEFAULT_DIMENSIONS
|
dimensions: self.defaultDimensions()
|
||||||
};
|
};
|
||||||
// Mark change as persistable
|
// Mark change as persistable
|
||||||
if ($scope.commit) {
|
if ($scope.commit) {
|
||||||
|
@ -192,6 +192,29 @@ define(
|
|||||||
expect(parseInt(styleB.width, 10)).toBeGreaterThan(63);
|
expect(parseInt(styleB.width, 10)).toBeGreaterThan(63);
|
||||||
expect(parseInt(styleB.width, 10)).toBeGreaterThan(31);
|
expect(parseInt(styleB.width, 10)).toBeGreaterThan(31);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("ensures a minimum frame size on drop", function () {
|
||||||
|
var style;
|
||||||
|
|
||||||
|
// Start with a very small frame size
|
||||||
|
testModel.layoutGrid = [ 1, 1 ];
|
||||||
|
mockScope.$watch.calls[0].args[1](testModel.layoutGrid);
|
||||||
|
|
||||||
|
// Notify that a drop occurred
|
||||||
|
testModel.composition.push('d');
|
||||||
|
mockScope.$on.mostRecentCall.args[1](
|
||||||
|
mockEvent,
|
||||||
|
'd',
|
||||||
|
{ x: 300, y: 100 }
|
||||||
|
);
|
||||||
|
mockScope.$watch.calls[0].args[1](['d']);
|
||||||
|
|
||||||
|
style = controller.getFrameStyle("d");
|
||||||
|
|
||||||
|
// Resulting size should still be reasonably large pixel-size
|
||||||
|
expect(parseInt(style.width, 10)).toBeGreaterThan(63);
|
||||||
|
expect(parseInt(style.height, 10)).toBeGreaterThan(31);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user