diff --git a/platform/features/layout/test/FixedControllerSpec.js b/platform/features/layout/test/FixedControllerSpec.js index 9d2ffa9e95..087028c44a 100644 --- a/platform/features/layout/test/FixedControllerSpec.js +++ b/platform/features/layout/test/FixedControllerSpec.js @@ -322,6 +322,47 @@ define( expect(handle.endDrag).toEqual(jasmine.any(Function)); }); }); + + it("exposes a move handle", function () { + var handle; + + // Select something so that drag handles are expected + testModel.modified = 1; + findWatch("model.modified")(testModel.modified); + controller.select(controller.getElements()[1]); + + // Should have a move handle + handle = controller.moveHandle(); + + // And it should have start/continue/end drag methods + expect(handle.startDrag).toEqual(jasmine.any(Function)); + expect(handle.continueDrag).toEqual(jasmine.any(Function)); + expect(handle.endDrag).toEqual(jasmine.any(Function)); + }); + + it("updates selection style during drag", function () { + var oldStyle; + + // Select something so that drag handles are expected + testModel.modified = 1; + findWatch("model.modified")(testModel.modified); + controller.select(controller.getElements()[1]); + + // Get style + oldStyle = controller.selected().style; + + // Start a drag gesture + controller.moveHandle().startDrag(); + + // Haven't moved yet; style shouldn't have updated yet + expect(controller.selected().style).toEqual(oldStyle); + + // Drag a little + controller.moveHandle().continueDrag([ 1000, 100 ]); + + // Style should have been updated + expect(controller.selected().style).not.toEqual(oldStyle); + }); }); } ); \ No newline at end of file diff --git a/platform/features/layout/test/elements/ElementProxySpec.js b/platform/features/layout/test/elements/ElementProxySpec.js index ab90204ce0..b05061594c 100644 --- a/platform/features/layout/test/elements/ElementProxySpec.js +++ b/platform/features/layout/test/elements/ElementProxySpec.js @@ -47,6 +47,13 @@ define( proxy.order("top"); expect(testElements).toEqual([{}, {}, {}, testElement]); }); + + it("ensures x/y values are non-negative", function () { + proxy.x(-1); + proxy.y(-400); + expect(proxy.x()).toEqual(0); + expect(proxy.y()).toEqual(0); + }); }); } ); diff --git a/platform/features/layout/test/elements/LineHandleSpec.js b/platform/features/layout/test/elements/LineHandleSpec.js index c9049f81b9..25d51f617e 100644 --- a/platform/features/layout/test/elements/LineHandleSpec.js +++ b/platform/features/layout/test/elements/LineHandleSpec.js @@ -48,6 +48,7 @@ define( expect(testElement.y).not.toEqual(testElement.y2); }); + }); } ); \ No newline at end of file diff --git a/platform/features/layout/test/elements/LineProxySpec.js b/platform/features/layout/test/elements/LineProxySpec.js index fe38c7c3c9..9e2ed88b44 100644 --- a/platform/features/layout/test/elements/LineProxySpec.js +++ b/platform/features/layout/test/elements/LineProxySpec.js @@ -67,6 +67,10 @@ define( expect(proxy.y2()).toEqual(0); }); + it("provides handles for both ends", function () { + expect(new LineProxy(diagonal).handles().length).toEqual(2); + }); + }); } ); \ No newline at end of file