From b871e0da914c4add40d47f922442fecca8358dde Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 24 Feb 2015 10:12:33 -0800 Subject: [PATCH] [Fixed Position] Update FixedController spec Update FixedController spec to support updates to template for selection highlight, drag handles; WTD-882. --- .../layout/test/FixedControllerSpec.js | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/platform/features/layout/test/FixedControllerSpec.js b/platform/features/layout/test/FixedControllerSpec.js index c8b943cc62..9d2ffa9e95 100644 --- a/platform/features/layout/test/FixedControllerSpec.js +++ b/platform/features/layout/test/FixedControllerSpec.js @@ -167,6 +167,19 @@ define( expect(controller.selected(elements[1])).toBeTruthy(); }); + it("allows selection retrieval", function () { + // selected with no arguments should give the current + // selection + var elements; + + testModel.modified = 1; + findWatch("model.modified")(testModel.modified); + + elements = controller.getElements(); + controller.select(elements[1]); + expect(controller.selected()).toEqual(elements[1]); + }); + it("allows selections to be cleared", function () { var elements; @@ -288,6 +301,27 @@ define( // elements to size SVGs appropriately expect(controller.getGridSize()).toEqual(testGrid); }); + + it("exposes drag handles", function () { + var handles; + + // Select something so that drag handles are expected + testModel.modified = 1; + findWatch("model.modified")(testModel.modified); + controller.select(controller.getElements()[1]); + + // Should have a non-empty array of handles + handles = controller.handles(); + expect(handles).toEqual(jasmine.any(Array)); + expect(handles.length).not.toEqual(0); + + // And they should have start/continue/end drag methods + handles.forEach(function (handle) { + expect(handle.startDrag).toEqual(jasmine.any(Function)); + expect(handle.continueDrag).toEqual(jasmine.any(Function)); + expect(handle.endDrag).toEqual(jasmine.any(Function)); + }); + }); }); } ); \ No newline at end of file