[Fixed Position] Add tests for FixedController

Add tests for FixedController and FixedProxy which reflect
added/changed behavior for Add button, WTD-880.
This commit is contained in:
Victor Woeltjen 2015-02-20 15:59:22 -08:00
parent 6814567116
commit e50e57b0be
2 changed files with 23 additions and 2 deletions

View File

@ -272,8 +272,6 @@ define(
.toHaveBeenCalledWith(jasmine.any(String));
});
it("unsubscribes when destroyed", function () {
// Make an object available
findWatch('domainObject')(mockDomainObject);
@ -284,6 +282,12 @@ define(
// Should have unsubscribed
expect(mockSubscription.unsubscribe).toHaveBeenCalled();
});
it("exposes its grid size", function () {
// Template needs to be able to pass this into line
// elements to size SVGs appropriately
expect(controller.getGridSize()).toEqual(testGrid);
});
});
}
);

View File

@ -29,6 +29,23 @@ define(
proxy.add("fixed.box");
expect(mockQ.when).toHaveBeenCalled();
});
it("notifies its callback when an element is created", function () {
proxy.add("fixed.box");
// Callback should not have been invoked yet
expect(mockCallback).not.toHaveBeenCalled();
// Resolve the promise
mockPromise.then.mostRecentCall.args[0]({});
// Should have fired the callback
expect(mockCallback).toHaveBeenCalledWith({
type: "fixed.box",
x: 0,
y: 0,
width: 1,
height: 1
});
});
});
}
);