[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 () {
var mockScope,
mockQ,
mockDialogService,
mockSubscriber,
mockFormatter,
mockDomainObject,
@ -58,6 +60,11 @@ define(
'telemetrySubscriber',
[ 'subscribe' ]
);
mockQ = jasmine.createSpyObj('$q', ['when']);
mockDialogService = jasmine.createSpyObj(
'dialogService',
['getUserInput']
);
mockFormatter = jasmine.createSpyObj(
'telemetryFormatter',
[ 'formatDomainValue', 'formatRangeValue' ]
@ -99,6 +106,8 @@ define(
controller = new FixedController(
mockScope,
mockQ,
mockDialogService,
mockSubscriber,
mockFormatter
);

View File

@ -6,12 +6,28 @@ define(
"use strict";
describe("Fixed Position view's selection proxy", function () {
it("has a placeholder message when clicked", function () {
var oldAlert = window.alert;
window.alert = jasmine.createSpy('alert');
new FixedProxy({}).add('');
expect(window.alert).toHaveBeenCalledWith(jasmine.any(String));
window.alert = oldAlert;
var mockCallback,
mockQ,
mockDialogService,
mockPromise,
proxy;
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) {
"use strict";
// Expect these element types to have proxies
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