Skip to content

Commit

Permalink
chore(alert): Fix test for Angular 1.2
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
chrisirhc authored and pkozlowski-opensource committed Jan 8, 2014
1 parent 7a4f06c commit b940b06
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ basePath = '.';
files = [
JASMINE,
JASMINE_ADAPTER,
'test-helpers.js',
'misc/test-lib/jquery-1.8.2.min.js',
'misc/test-lib/angular.js',
'misc/test-lib/angular-mocks.js',
Expand Down
2 changes: 1 addition & 1 deletion src/alert/test/alert.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe("alert", function () {
it('should not show close buttons if no close callback specified', function () {
element = $compile('<alert>No close</alert>')(scope);
scope.$digest();
expect(findCloseButton(0).css('display')).toBe('none');
expect(findCloseButton(0)).toBeHidden();
});

it('should be possible to add additional classes for alert', function () {
Expand Down
9 changes: 9 additions & 0 deletions test-helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
beforeEach(function () {
this.addMatchers({
toBeHidden: function () {
var element = angular.element(this.actual);
return element.hasClass('ng-hide') ||
element.css('display') == 'none';
}
});
});

0 comments on commit b940b06

Please sign in to comment.