Added Unit Tests and fixed attribute bug
This commit is contained in:
+3
-2
@@ -102,7 +102,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.multiMap', 'ui.bootstrap.sta
|
||||
link: function(scope, element, attrs) {
|
||||
element.addClass(attrs.windowTopClass || '');
|
||||
scope.size = attrs.size;
|
||||
scope.scrollable = attrs.scrollable;
|
||||
scope.scrollable = attrs.scrollable === 'true';
|
||||
|
||||
scope.close = function(evt) {
|
||||
var modal = $modalStack.getTop();
|
||||
@@ -426,7 +426,8 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.multiMap', 'ui.bootstrap.sta
|
||||
openedClass: modal.openedClass,
|
||||
windowTopClass: modal.windowTopClass,
|
||||
animation: modal.animation,
|
||||
appendTo: modal.appendTo
|
||||
appendTo: modal.appendTo,
|
||||
scrollable: modal.scrollable
|
||||
});
|
||||
|
||||
openedClasses.put(modalBodyClass, modalInstance);
|
||||
|
||||
@@ -1389,6 +1389,29 @@ describe('$uibModal', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('scrollable', function() {
|
||||
it('should default to false', function() {
|
||||
open({
|
||||
template: '<div>Non scollable modal dialog</div>'
|
||||
});
|
||||
|
||||
expect($document.find('div.modal-dialog')).not.toHaveClass('modal-dialog-scrollable');
|
||||
});
|
||||
it('should add the scrollable class if scrollable set to true', function() {
|
||||
open({
|
||||
template: '<div>Large modal dialog</div>',
|
||||
scrollable: true
|
||||
});
|
||||
|
||||
expect($document.find('div.modal-dialog')).toHaveClass('modal-dialog-scrollable');
|
||||
});
|
||||
it('should allow overriding default options in a provider', function() {
|
||||
$uibModalProvider.options.scrollable = true;
|
||||
open({template: '<div>Content</div>'});
|
||||
expect($document.find('div.modal-dialog')).toHaveClass('modal-dialog-scrollable');
|
||||
});
|
||||
});
|
||||
|
||||
describe('animation', function() {
|
||||
it('should have animation fade classes by default', function() {
|
||||
open({
|
||||
|
||||
Reference in New Issue
Block a user