mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
1
js/angular/directive/modal.js
vendored
1
js/angular/directive/modal.js
vendored
@@ -8,6 +8,7 @@ IonicModule
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
replace: true,
|
||||
controller: [function(){}],
|
||||
template: '<div class="modal-backdrop">' +
|
||||
'<div class="modal-wrapper" ng-transclude></div>' +
|
||||
'</div>'
|
||||
|
||||
10
js/angular/directive/view.js
vendored
10
js/angular/directive/view.js
vendored
@@ -35,13 +35,17 @@ IonicModule
|
||||
return {
|
||||
restrict: 'EA',
|
||||
priority: 1000,
|
||||
require: '^?ionNavBar',
|
||||
require: ['^?ionNavBar', '^?ionModal'],
|
||||
compile: function(tElement, tAttrs, transclude) {
|
||||
tElement.addClass('pane');
|
||||
tElement[0].removeAttribute('title');
|
||||
|
||||
return function link($scope, $element, $attr, navBarCtrl) {
|
||||
if (!navBarCtrl) {
|
||||
return function link($scope, $element, $attr, ctrls) {
|
||||
var navBarCtrl = ctrls[0];
|
||||
var modalCtrl = ctrls[1];
|
||||
|
||||
//Don't use the ionView if we're inside a modal or there's no navbar
|
||||
if (!navBarCtrl || modalCtrl) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,21 @@ describe('ionView directive', function() {
|
||||
return el;
|
||||
}
|
||||
|
||||
it('should remove title & add pane, even with no navbar', inject(function($compile, $rootScope) {
|
||||
it('should only remove title & add pane with no navbar', inject(function($compile, $rootScope) {
|
||||
var el = $compile('<ion-view title="1">')($rootScope.$new());
|
||||
$rootScope.$apply();
|
||||
expect(el.hasClass('pane')).toBe(true);
|
||||
expect(el[0].getAttribute('title')).toBe(null);
|
||||
}));
|
||||
|
||||
it('should only remove title & add pane in a modal',inject(function($compile, $rootScope) {
|
||||
var el = $compile('<ion-modal><ion-view title="1"></ion-modal>')($rootScope.$new());
|
||||
var view = jqLite(el[0].querySelector('.pane'));
|
||||
$rootScope.$apply();
|
||||
expect(view.hasClass('pane')).toBe(true);
|
||||
expect(view[0].getAttribute('title')).toBe(null);
|
||||
}));
|
||||
|
||||
it('should have content inside', function() {
|
||||
var el = setup(null, null, '<b>some</b> html');
|
||||
expect(el.html()).toBe('<b>some</b> html');
|
||||
|
||||
Reference in New Issue
Block a user