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

Commit

Permalink
fix(progress): class names update
Browse files Browse the repository at this point in the history
Closes #1241
  • Loading branch information
buberdds authored and pkozlowski-opensource committed Nov 23, 2013
1 parent 42475fd commit a3d53d8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
70 changes: 35 additions & 35 deletions src/progressbar/test/progressbar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ describe('progressbar directive with no binding', function () {
expect(element.hasClass('progress')).toBe(true);
});

it('contains one child element with "bar" css class', function() {
it('contains one child element with "progress-bar" css class', function() {
expect(element.children().length).toBe(1);
expect(element.children().eq(0).hasClass('bar')).toBe(true);
expect(element.children().eq(0).hasClass('progress-bar')).toBe(true);
});

it('has a "bar" element with expected width', function() {
it('has a "progress-bar" element with expected width', function() {
expect(element.children().eq(0).css('width')).toBe('22%');
});
});
Expand All @@ -39,12 +39,12 @@ describe('progressbar directive with data-binding', function () {
expect(element.hasClass('progress')).toBe(true);
});

it('contains one child element with "bar" css class', function() {
it('contains one child element with "progress-bar" css class', function() {
expect(element.children().length).toBe(1);
expect(element.children().eq(0).hasClass('bar')).toBe(true);
expect(element.children().eq(0).hasClass('progress-bar')).toBe(true);
});

it('has a "bar" element with expected width', function() {
it('has a "progress-bar" element with expected width', function() {
expect(element.children().eq(0).css('width')).toBe('33%');
});

Expand All @@ -53,7 +53,7 @@ describe('progressbar directive with data-binding', function () {
$rootScope.$digest();
expect(element.children().length).toBe(1);
expect(element.children().eq(0).css('width')).toBe('55%');
expect(element.children().eq(0).hasClass('bar')).toBe(true);
expect(element.children().eq(0).hasClass('progress-bar')).toBe(true);

$rootScope.percent += 11;
$rootScope.$digest();
Expand All @@ -76,8 +76,8 @@ describe('progressbar directive with data-binding', function () {

var barElement = element.children().eq(0);
expect(barElement.css('width')).toBe('45%');
expect(barElement.hasClass('bar')).toBe(true);
expect(barElement.hasClass('bar-warning')).toBe(true);
expect(barElement.hasClass('progress-bar')).toBe(true);
expect(barElement.hasClass('progress-bar-warning')).toBe(true);
});

});
Expand All @@ -98,11 +98,11 @@ describe('stacked progressbar directive', function () {
expect(element.hasClass('progress')).toBe(true);
});

it('contains tree child elements with "bar" css class each', function() {
it('contains tree child elements with "progress-bar" css class each', function() {
expect(element.children().length).toBe(3);
expect(element.children().eq(0).hasClass('bar')).toBe(true);
expect(element.children().eq(1).hasClass('bar')).toBe(true);
expect(element.children().eq(2).hasClass('bar')).toBe(true);
expect(element.children().eq(0).hasClass('progress-bar')).toBe(true);
expect(element.children().eq(1).hasClass('progress-bar')).toBe(true);
expect(element.children().eq(2).hasClass('progress-bar')).toBe(true);
});

it('has a elements with expected width', function() {
Expand Down Expand Up @@ -144,18 +144,18 @@ describe('stacked progressbar directive', function () {

barElement = element.children().eq(0);
expect(barElement.css('width')).toBe('12%');
expect(barElement.hasClass('bar')).toBe(true);
expect(barElement.hasClass('bar-danger')).toBe(false);
expect(barElement.hasClass('progress-bar')).toBe(true);
expect(barElement.hasClass('progress-bar-danger')).toBe(false);

barElement = element.children().eq(1);
expect(barElement.css('width')).toBe('29%');
expect(barElement.hasClass('bar')).toBe(true);
expect(barElement.hasClass('bar-danger')).toBe(true);
expect(barElement.hasClass('progress-bar')).toBe(true);
expect(barElement.hasClass('progress-bar-danger')).toBe(true);

barElement = element.children().eq(2);
expect(barElement.css('width')).toBe('33%');
expect(barElement.hasClass('bar')).toBe(true);
expect(barElement.hasClass('bar-danger')).toBe(false);
expect(barElement.hasClass('progress-bar')).toBe(true);
expect(barElement.hasClass('progress-bar-danger')).toBe(false);
});

it('can handle mixed objects with custom classes', function() {
Expand All @@ -174,23 +174,23 @@ describe('stacked progressbar directive', function () {

barElement = element.children().eq(0);
expect(barElement.css('width')).toBe('15%');
expect(barElement.hasClass('bar-info')).toBe(true);
expect(barElement.hasClass('progress-bar-info')).toBe(true);

barElement = element.children().eq(1);
expect(barElement.css('width')).toBe('11%');
expect(barElement.hasClass('bar-info')).toBe(false);
expect(barElement.hasClass('progress-bar-info')).toBe(false);

barElement = element.children().eq(2);
expect(barElement.css('width')).toBe('9%');
expect(barElement.hasClass('bar-danger')).toBe(true);
expect(barElement.hasClass('progress-bar-danger')).toBe(true);

barElement = element.children().eq(3);
expect(barElement.css('width')).toBe('22%');
expect(barElement.hasClass('bar-warning')).toBe(true);
expect(barElement.hasClass('progress-bar-warning')).toBe(true);

barElement = element.children().eq(4);
expect(barElement.css('width')).toBe('5%');
expect(barElement.hasClass('bar-warning')).toBe(false);
expect(barElement.hasClass('progress-bar-warning')).toBe(false);
});

});
Expand Down Expand Up @@ -256,10 +256,10 @@ describe('stacked progressbar directive with auto-types', function () {
expect(element.hasClass('progress')).toBe(true);
});

it('contains tree child elements with "bar" css class each', function() {
it('contains tree child elements with "progress-bar" css class each', function() {
expect(element.children().length).toBe(5);
for (var i = 0; i < 5; i++) {
expect(element.children().eq(i).hasClass('bar')).toBe(true);
expect(element.children().eq(i).hasClass('progress-bar')).toBe(true);
}
});

Expand All @@ -275,7 +275,7 @@ describe('stacked progressbar directive with auto-types', function () {
var stackedTypes = config.stackedTypes;

for (var i = 0; i < stackedTypes.length; i++) {
expect(element.children().eq(i).hasClass('bar-' + stackedTypes[i])).toBe(true);
expect(element.children().eq(i).hasClass('progress-bar-' + stackedTypes[i])).toBe(true);
}
});

Expand All @@ -290,8 +290,8 @@ describe('stacked progressbar directive with auto-types', function () {

var bar = element.children().eq(1);
expect(bar.css('width')).toBe('18%');
expect(bar.hasClass('bar-' + stackedTypes[1])).toBe(false);
expect(bar.hasClass('bar-something')).toBe(true);
expect(bar.hasClass('progress-bar-' + stackedTypes[1])).toBe(false);
expect(bar.hasClass('progress-bar-something')).toBe(true);
});


Expand All @@ -306,8 +306,8 @@ describe('stacked progressbar directive with auto-types', function () {

var bar = element.children().eq(1);
expect(bar.css('width')).toBe('18%');
expect(bar.hasClass('bar-' + stackedTypes[1])).toBe(false);
expect(bar.hasClass('bar-something')).toBe(true);
expect(bar.hasClass('progress-bar-' + stackedTypes[1])).toBe(false);
expect(bar.hasClass('progress-bar-something')).toBe(true);
});

it('can bypass default configuration for stacked classes from attribute', function() {
Expand All @@ -316,11 +316,11 @@ describe('stacked progressbar directive with auto-types', function () {

var stackedTypes = config.stackedTypes;

expect(element.children().eq(0).hasClass('bar-danger')).toBe(true);
expect(element.children().eq(0).hasClass('bar-' + stackedTypes[0])).toBe(false);
expect(element.children().eq(0).hasClass('progress-bar-danger')).toBe(true);
expect(element.children().eq(0).hasClass('progress-bar-' + stackedTypes[0])).toBe(false);

expect(element.children().eq(1).hasClass('bar-warning')).toBe(true);
expect(element.children().eq(2).hasClass('bar-success')).toBe(true);
expect(element.children().eq(1).hasClass('progress-bar-warning')).toBe(true);
expect(element.children().eq(2).hasClass('progress-bar-success')).toBe(true);
});

});
2 changes: 1 addition & 1 deletion template/progressbar/bar.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<div class="bar" ng-class='type && "bar-" + type'></div>
<div class="progress-bar" ng-class='type && "progress-bar-" + type'></div>

0 comments on commit a3d53d8

Please sign in to comment.