Merge pull request #1843 from nasa/follow-bug-1836

[Timers] Fix bug in FollowIndicator
This commit is contained in:
Deep Tailor 2017-12-18 15:22:35 -08:00 committed by GitHub
commit d140051054
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 8 deletions

View File

@ -45,7 +45,7 @@ define(
FollowIndicator.prototype.getText = function () {
var timer = this.timerService.getTimer();
return (timer) ? 'Following timer ' + timer.getModel().name : NO_TIMER;
return timer ? ('Following timer ' + timer.name) : NO_TIMER;
};
FollowIndicator.prototype.getDescription = function () {

View File

@ -42,18 +42,15 @@ define(["../../src/indicators/FollowIndicator"], function (FollowIndicator) {
});
describe("when a timer is set", function () {
var testModel;
var mockDomainObject;
var testObject;
beforeEach(function () {
testModel = { name: "some timer!" };
mockDomainObject = jasmine.createSpyObj('timer', ['getModel']);
mockDomainObject.getModel.andReturn(testModel);
mockTimerService.getTimer.andReturn(mockDomainObject);
testObject = { name: "some timer!" };
mockTimerService.getTimer.andReturn(testObject);
});
it("displays the timer's name", function () {
expect(indicator.getText().indexOf(testModel.name))
expect(indicator.getText().indexOf(testObject.name))
.not.toEqual(-1);
});
});