[Fixed Position] Update specs
Update specs to reflect usage of generalized selection mechanism, WTD-929.
This commit is contained in:
@@ -102,7 +102,10 @@ define(
|
|||||||
});
|
});
|
||||||
mockScope.model = testModel;
|
mockScope.model = testModel;
|
||||||
mockScope.configuration = testConfiguration;
|
mockScope.configuration = testConfiguration;
|
||||||
mockScope.selection = []; // Act like edit mode
|
mockScope.selection = jasmine.createSpyObj(
|
||||||
|
'selection',
|
||||||
|
[ 'select', 'get', 'selected', 'deselect' ]
|
||||||
|
);
|
||||||
|
|
||||||
controller = new FixedController(
|
controller = new FixedController(
|
||||||
mockScope,
|
mockScope,
|
||||||
@@ -163,8 +166,8 @@ define(
|
|||||||
|
|
||||||
elements = controller.getElements();
|
elements = controller.getElements();
|
||||||
controller.select(elements[1]);
|
controller.select(elements[1]);
|
||||||
expect(controller.selected(elements[0])).toBeFalsy();
|
expect(mockScope.selection.select)
|
||||||
expect(controller.selected(elements[1])).toBeTruthy();
|
.toHaveBeenCalledWith(elements[1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("allows selections to be cleared", function () {
|
it("allows selections to be cleared", function () {
|
||||||
@@ -190,6 +193,12 @@ define(
|
|||||||
elements = controller.getElements();
|
elements = controller.getElements();
|
||||||
controller.select(elements[1]);
|
controller.select(elements[1]);
|
||||||
|
|
||||||
|
// Verify precondition
|
||||||
|
expect(mockScope.selection.select.calls.length).toEqual(1);
|
||||||
|
|
||||||
|
// Mimic selection behavior
|
||||||
|
mockScope.selection.get.andReturn(elements[1]);
|
||||||
|
|
||||||
elements[2].remove();
|
elements[2].remove();
|
||||||
testModel.modified = 2;
|
testModel.modified = 2;
|
||||||
findWatch("model.modified")(testModel.modified);
|
findWatch("model.modified")(testModel.modified);
|
||||||
@@ -198,7 +207,7 @@ define(
|
|||||||
// Verify removal, as test assumes this
|
// Verify removal, as test assumes this
|
||||||
expect(elements.length).toEqual(2);
|
expect(elements.length).toEqual(2);
|
||||||
|
|
||||||
expect(controller.selected(elements[1])).toBeTruthy();
|
expect(mockScope.selection.select.calls.length).toEqual(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("provides values for telemetry elements", function () {
|
it("provides values for telemetry elements", function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user