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

Commit 794954a

Browse files
bekospkozlowski-opensource
authored andcommitted
fix(alert): add alert-dismissable class
Closes #1745
1 parent 42d6d43 commit 794954a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/alert/test/alert.spec.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ describe('alert', function () {
5959
}
6060
});
6161

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

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

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

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

9092
it('should be possible to add additional classes for alert', function () {

template/alert/alert.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class='alert' ng-class='"alert-" + (type || "warning")'>
2-
<button ng-show='closeable' type='button' class='close' ng-click='close()'>&times;</button>
1+
<div class="alert" ng-class="{'alert-{{type || 'warning'}}': true, 'alert-dismissable': closeable}">
2+
<button ng-show="closeable" type="button" class="close" ng-click="close()">&times;</button>
33
<div ng-transclude></div>
44
</div>

0 commit comments

Comments
 (0)