From 3ce1064c4e0fff7bd4a3c80b911f87062f0949c4 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 3 Mar 2015 18:52:13 -0800 Subject: [PATCH] [Fixed Position] Expose view proxy Expose view proxy as selection state from the Fixed Position controller, to make Add button available under generalized selection mechanism, WTD-929. --- platform/features/layout/src/FixedController.js | 7 ++++++- platform/features/layout/test/FixedControllerSpec.js | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/platform/features/layout/src/FixedController.js b/platform/features/layout/src/FixedController.js index fc71829e8b..60bc813c80 100644 --- a/platform/features/layout/src/FixedController.js +++ b/platform/features/layout/src/FixedController.js @@ -208,9 +208,14 @@ define( }); } - // Track current selection state + // Track current selection state selection = $scope.selection; + // Expose the view's selection proxy + if (selection) { + selection.proxy(new FixedProxy(addElement, $q, dialogService)); + } + // Refresh list of elements whenever model changes $scope.$watch("model.modified", refreshElements); diff --git a/platform/features/layout/test/FixedControllerSpec.js b/platform/features/layout/test/FixedControllerSpec.js index 5028812c0e..68562a0e28 100644 --- a/platform/features/layout/test/FixedControllerSpec.js +++ b/platform/features/layout/test/FixedControllerSpec.js @@ -104,7 +104,7 @@ define( mockScope.configuration = testConfiguration; mockScope.selection = jasmine.createSpyObj( 'selection', - [ 'select', 'get', 'selected', 'deselect' ] + [ 'select', 'get', 'selected', 'deselect', 'proxy' ] ); controller = new FixedController( @@ -297,6 +297,12 @@ define( // elements to size SVGs appropriately expect(controller.getGridSize()).toEqual(testGrid); }); + + it("exposes a view-level selection proxy", function () { + expect(mockScope.selection.proxy).toHaveBeenCalledWith( + jasmine.any(Object) + ); + }); }); } ); \ No newline at end of file