[Fixed Position] Update failing specs

Update existing tests to account for changes from WTD-880.
This commit is contained in:
Victor Woeltjen
2015-02-20 15:53:41 -08:00
parent 84e90f6ad1
commit 6814567116
3 changed files with 37 additions and 7 deletions

View File

@@ -7,6 +7,8 @@ define(
describe("The Fixed Position controller", function () { describe("The Fixed Position controller", function () {
var mockScope, var mockScope,
mockQ,
mockDialogService,
mockSubscriber, mockSubscriber,
mockFormatter, mockFormatter,
mockDomainObject, mockDomainObject,
@@ -58,6 +60,11 @@ define(
'telemetrySubscriber', 'telemetrySubscriber',
[ 'subscribe' ] [ 'subscribe' ]
); );
mockQ = jasmine.createSpyObj('$q', ['when']);
mockDialogService = jasmine.createSpyObj(
'dialogService',
['getUserInput']
);
mockFormatter = jasmine.createSpyObj( mockFormatter = jasmine.createSpyObj(
'telemetryFormatter', 'telemetryFormatter',
[ 'formatDomainValue', 'formatRangeValue' ] [ 'formatDomainValue', 'formatRangeValue' ]
@@ -99,6 +106,8 @@ define(
controller = new FixedController( controller = new FixedController(
mockScope, mockScope,
mockQ,
mockDialogService,
mockSubscriber, mockSubscriber,
mockFormatter mockFormatter
); );

View File

@@ -6,12 +6,28 @@ define(
"use strict"; "use strict";
describe("Fixed Position view's selection proxy", function () { describe("Fixed Position view's selection proxy", function () {
it("has a placeholder message when clicked", function () { var mockCallback,
var oldAlert = window.alert; mockQ,
window.alert = jasmine.createSpy('alert'); mockDialogService,
new FixedProxy({}).add(''); mockPromise,
expect(window.alert).toHaveBeenCalledWith(jasmine.any(String)); proxy;
window.alert = oldAlert;
beforeEach(function () {
mockCallback = jasmine.createSpy('callback');
mockQ = jasmine.createSpyObj('$q', ['when']);
mockDialogService = jasmine.createSpyObj('dialogService', ['getUserInput']);
mockPromise = jasmine.createSpyObj('promise', ['then']);
mockQ.when.andReturn(mockPromise);
proxy = new FixedProxy(mockCallback, mockQ, mockDialogService);
});
it("handles promised element creation", function () {
// The element factory may return promises (e.g. if
// user input is required) so make sure proxy is wrapping these
proxy.add("fixed.box");
expect(mockQ.when).toHaveBeenCalled();
}); });
}); });
} }

View File

@@ -5,8 +5,13 @@ define(
function (ElementProxies) { function (ElementProxies) {
"use strict"; "use strict";
// Expect these element types to have proxies
var ELEMENT_TYPES = [ var ELEMENT_TYPES = [
"fixed.telemetry" "fixed.telemetry",
"fixed.line",
"fixed.box",
"fixed.text",
"fixed.image"
]; ];
// Verify that the set of proxies exposed matches the specific // Verify that the set of proxies exposed matches the specific