Merge pull request #1744 from nasa/inspector-issue-1276

Inspector issue 1276
This commit is contained in:
Victor Woeltjen 2017-10-10 15:33:27 -07:00 committed by GitHub
commit 8703f363b8
2 changed files with 14 additions and 3 deletions

View File

@ -108,8 +108,11 @@ define(
getMetadata(); getMetadata();
}); });
}
var mutation = $scope.ngModel.selectedObject.getCapability('mutation');
var unlisten = mutation.listen(getMetadata);
$scope.$on('$destroy', unlisten);
}
return ObjectInspectorController; return ObjectInspectorController;
} }
); );

View File

@ -39,10 +39,18 @@ define(
beforeEach(function () { beforeEach(function () {
mockScope = jasmine.createSpyObj( mockScope = jasmine.createSpyObj(
"$scope", "$scope",
["$watch"] ["$watch", "$on"]
); );
mockScope.ngModel = {}; mockScope.ngModel = {};
mockScope.ngModel.selectedObject = 'mock selected object'; mockScope.ngModel.selectedObject = {
getCapability: function () {
return {
listen: function () {
return true;
}
};
}
};
mockObjectService = jasmine.createSpyObj( mockObjectService = jasmine.createSpyObj(
"objectService", "objectService",