mirror of
https://github.com/nasa/openmct.git
synced 2024-12-19 13:17:53 +00:00
Merge pull request #1640 from nasa/fix-error-on-table-destroy
[Resize] don't trigger callback after being destroyed
This commit is contained in:
commit
0794c0edf7
@ -83,13 +83,14 @@ define(
|
||||
// Callback to fire after each timeout;
|
||||
// update bounds and schedule another timeout
|
||||
function onInterval() {
|
||||
if (!active) {
|
||||
return;
|
||||
}
|
||||
fireEval({
|
||||
width: element[0].offsetWidth,
|
||||
height: element[0].offsetHeight
|
||||
});
|
||||
if (active) {
|
||||
$timeout(onInterval, currentInterval(), false);
|
||||
}
|
||||
$timeout(onInterval, currentInterval(), false);
|
||||
}
|
||||
|
||||
// Stop running in the background
|
||||
|
@ -102,11 +102,16 @@ define(
|
||||
// Broadcast a destroy event
|
||||
mockScope.$on.mostRecentCall.args[1]();
|
||||
|
||||
testElement.offsetWidth = 300;
|
||||
testElement.offsetHeight = 350;
|
||||
mockScope.$eval.reset();
|
||||
|
||||
// Fire the timeout
|
||||
mockTimeout.mostRecentCall.args[0]();
|
||||
|
||||
// Should NOT have scheduled another timeout
|
||||
expect(mockTimeout.calls.length).toEqual(2);
|
||||
expect(mockScope.$eval).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("triggers a digest cycle when size changes", function () {
|
||||
|
Loading…
Reference in New Issue
Block a user