Skip to content

Commit 69c733a

Browse files
committed
feat(actionsheet): cssClass option
1 parent 916ff63 commit 69c733a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

js/angular/service/actionSheet.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ function($rootScope, $compile, $animate, $timeout, $ionicTemplateLoader, $ionicP
8787
* Return true to close the action sheet, or false to keep it opened.
8888
* - `{boolean=}` `cancelOnStateChange` Whether to cancel the actionSheet when navigating
8989
* to a new state. Default true.
90+
* - `{string}` `cssClass` The custom CSS class name.
9091
*
9192
* @returns {function} `hideSheet` A function which, when called, hides & cancels the action sheet.
9293
*/
@@ -104,7 +105,7 @@ function($rootScope, $compile, $animate, $timeout, $ionicTemplateLoader, $ionicP
104105

105106

106107
// Compile the template
107-
var element = scope.element = $compile('<ion-action-sheet buttons="buttons"></ion-action-sheet>')(scope);
108+
var element = scope.element = $compile('<ion-action-sheet ng-class="cssClass" buttons="buttons"></ion-action-sheet>')(scope);
108109

109110
// Grab the sheet element for animation
110111
var sheetEl = jqLite(element[0].querySelector('.action-sheet-wrapper'));

test/unit/angular/service/actionSheet.unit.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,12 @@ describe('Ionic ActionSheet Service', function() {
103103
expect(scope.cancel).not.toHaveBeenCalled();
104104
}));
105105

106+
it('should add css class to element from cssClass option', inject(function($rootScope) {
107+
var scope = setup({
108+
cssClass: 'custom-class'
109+
});
110+
scope.showSheet();
111+
expect(scope.element.hasClass('custom-class')).toBe(true);
112+
}));
113+
106114
});

0 commit comments

Comments
 (0)