Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ionModalView #1668

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions js/angular/directive/modalView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* @ngdoc directive
* @name ionModalView
* @module ionic
* @restrict EA
*
* @description
* A container for content, used as a modal view.
*
* @usage
* Below is an example where our modal page will load.
*
* ```html
* <ion-modal-view>
* <ion-content>
* Hello!
* </ion-content>
* </ion-modal-view>
* ```
*/
IonicModule
.directive('ionModalView', [function() {
return {
restrict: 'EA',
priority: 1000,
compile: function(tElement, tAttrs, transclude) {
tElement.addClass('modal');
}
};
}]);
25 changes: 25 additions & 0 deletions test/unit/angular/directive/modalView.unit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
describe('ionModalView directive', function() {
beforeEach(module('ionic'));

it('should have class of modal from element', inject(function($rootScope, $compile, $ionicViewService) {
spyOn($ionicViewService, 'nextViewOptions');
var el = $compile('<ion-modal-view>')($rootScope.$new());

expect(el[0].classList.contains('modal')).toBe(true);
}));

it('should have class of modal from attribute', inject(function($rootScope, $compile, $ionicViewService) {
spyOn($ionicViewService, 'nextViewOptions');
var el = $compile('<div ion-modal-view>')($rootScope.$new());

expect(el[0].classList.contains('modal')).toBe(true);
}));

it('should not have class of modal', inject(function($rootScope, $compile, $ionicViewService) {
spyOn($ionicViewService, 'nextViewOptions');
var el = $compile('<div ion-not-modal-view>')($rootScope.$new());

expect(el[0].classList.contains('modal')).toBe(false);
}));

});