Skip to content
This repository was archived by the owner on Aug 31, 2025. It is now read-only.

Commit b940b06

Browse files
chrisirhcpkozlowski-opensource
authored andcommitted
chore(alert): Fix test for Angular 1.2
- Since Angular 1.2 is now using the ng-hide class to hide the element, it needs to be added into the DOM for styles to be computed.
1 parent 7a4f06c commit b940b06

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

karma.conf.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ basePath = '.';
66
files = [
77
JASMINE,
88
JASMINE_ADAPTER,
9+
'test-helpers.js',
910
'misc/test-lib/jquery-1.8.2.min.js',
1011
'misc/test-lib/angular.js',
1112
'misc/test-lib/angular-mocks.js',

src/alert/test/alert.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe("alert", function () {
8484
it('should not show close buttons if no close callback specified', function () {
8585
element = $compile('<alert>No close</alert>')(scope);
8686
scope.$digest();
87-
expect(findCloseButton(0).css('display')).toBe('none');
87+
expect(findCloseButton(0)).toBeHidden();
8888
});
8989

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

test-helpers.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
beforeEach(function () {
2+
this.addMatchers({
3+
toBeHidden: function () {
4+
var element = angular.element(this.actual);
5+
return element.hasClass('ng-hide') ||
6+
element.css('display') == 'none';
7+
}
8+
});
9+
});

0 commit comments

Comments
 (0)