From 69c733a7cb0580de151c7f932bc9617cc1d61ebc Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Fri, 12 Dec 2014 22:25:17 -0600 Subject: [PATCH] feat(actionsheet): cssClass option --- js/angular/service/actionSheet.js | 3 ++- test/unit/angular/service/actionSheet.unit.js | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/js/angular/service/actionSheet.js b/js/angular/service/actionSheet.js index 7129e01e80..f0aaa42129 100644 --- a/js/angular/service/actionSheet.js +++ b/js/angular/service/actionSheet.js @@ -87,6 +87,7 @@ function($rootScope, $compile, $animate, $timeout, $ionicTemplateLoader, $ionicP * Return true to close the action sheet, or false to keep it opened. * - `{boolean=}` `cancelOnStateChange` Whether to cancel the actionSheet when navigating * to a new state. Default true. + * - `{string}` `cssClass` The custom CSS class name. * * @returns {function} `hideSheet` A function which, when called, hides & cancels the action sheet. */ @@ -104,7 +105,7 @@ function($rootScope, $compile, $animate, $timeout, $ionicTemplateLoader, $ionicP // Compile the template - var element = scope.element = $compile('')(scope); + var element = scope.element = $compile('')(scope); // Grab the sheet element for animation var sheetEl = jqLite(element[0].querySelector('.action-sheet-wrapper')); diff --git a/test/unit/angular/service/actionSheet.unit.js b/test/unit/angular/service/actionSheet.unit.js index 606a1f4c38..2c0e33fd07 100644 --- a/test/unit/angular/service/actionSheet.unit.js +++ b/test/unit/angular/service/actionSheet.unit.js @@ -103,4 +103,12 @@ describe('Ionic ActionSheet Service', function() { expect(scope.cancel).not.toHaveBeenCalled(); })); + it('should add css class to element from cssClass option', inject(function($rootScope) { + var scope = setup({ + cssClass: 'custom-class' + }); + scope.showSheet(); + expect(scope.element.hasClass('custom-class')).toBe(true); + })); + });