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

Commit c4d0e2a

Browse files
Foxandxsspkozlowski-opensource
authored andcommitted
test(alert): add more coverage and other changes
Closes #1489
1 parent ba79abe commit c4d0e2a

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/alert/test/alert.spec.js

+13-5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ describe("alert", function () {
3535
return element.find('.close').eq(index);
3636
}
3737

38+
function findContent(index) {
39+
return element.find('span').eq(index);
40+
}
41+
3842
it("should generate alerts using ng-repeat", function () {
3943
var alerts = createAlerts();
4044
expect(alerts.length).toEqual(3);
@@ -44,11 +48,15 @@ describe("alert", function () {
4448
var alerts = createAlerts();
4549
expect(alerts.eq(0)).toHaveClass('alert-success');
4650
expect(alerts.eq(1)).toHaveClass('alert-error');
51+
expect(alerts.eq(2)).toHaveClass('alert-warning');
52+
});
4753

48-
//defaults
49-
expect(alerts.eq(2)).toHaveClass('alert');
50-
expect(alerts.eq(2)).not.toHaveClass('alert-info');
51-
expect(alerts.eq(2)).not.toHaveClass('alert-block');
54+
it('should show the alert content', function() {
55+
var alerts = createAlerts();
56+
57+
for (var i = 0, n = alerts.length; i < n; i++) {
58+
expect(findContent(i).text()).toBe(scope.alerts[i].msg);
59+
}
5260
});
5361

5462
it("should show close buttons", function () {
@@ -79,7 +87,7 @@ describe("alert", function () {
7987
expect(findCloseButton(0).css('display')).toBe('none');
8088
});
8189

82-
it('it should be possible to add additional classes for alert', function () {
90+
it('should be possible to add additional classes for alert', function () {
8391
var element = $compile('<alert class="alert-block" type="\'info\'">Default alert!</alert>')(scope);
8492
scope.$digest();
8593
expect(element).toHaveClass('alert-block');

0 commit comments

Comments
 (0)