Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
fix(alert): add alert-dismissable class
Browse files Browse the repository at this point in the history
Closes #1745
  • Loading branch information
bekos authored and pkozlowski-opensource committed Feb 7, 2014
1 parent 42d6d43 commit 794954a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/alert/test/alert.spec.js
Expand Up @@ -59,11 +59,12 @@ describe('alert', function () {
}
});

it('should show close buttons', function () {
it('should show close buttons and have the dismissable class', function () {
var alerts = createAlerts();

for (var i = 0, n = alerts.length; i < n; i++) {
expect(findCloseButton(i).css('display')).not.toBe('none');
expect(alerts.eq(i)).toHaveClass('alert-dismissable');
}
});

Expand All @@ -81,10 +82,11 @@ describe('alert', function () {
expect(scope.removeAlert).toHaveBeenCalledWith(1);
});

it('should not show close buttons if no close callback specified', function () {
it('should not show close button and have the dismissable class if no close callback specified', function () {
element = $compile('<alert>No close</alert>')(scope);
scope.$digest();
expect(findCloseButton(0)).toBeHidden();
expect(element).not.toHaveClass('alert-dismissable');
});

it('should be possible to add additional classes for alert', function () {
Expand Down
4 changes: 2 additions & 2 deletions template/alert/alert.html
@@ -1,4 +1,4 @@
<div class='alert' ng-class='"alert-" + (type || "warning")'>
<button ng-show='closeable' type='button' class='close' ng-click='close()'>&times;</button>
<div class="alert" ng-class="{'alert-{{type || 'warning'}}': true, 'alert-dismissable': closeable}">
<button ng-show="closeable" type="button" class="close" ng-click="close()">&times;</button>
<div ng-transclude></div>
</div>

0 comments on commit 794954a

Please sign in to comment.