Skip to content

Commit 249fa20

Browse files
Replaced usage of the jQueyry #size() method with the .length property
1 parent 19ff924 commit 249fa20

File tree

6 files changed

+37
-37
lines changed

6 files changed

+37
-37
lines changed

test/card/aggregate-status/aggregate-status-card.component.spec.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('Component: pfAggregateStatusCard', function() {
3131
expect(angular.element(element).find('.card-pf-aggregate-status-count').html()).toBe("793");
3232

3333
//Make sure a link renders in the title
34-
expect(angular.element(element).find('.card-pf-title').find('a').size()).toBe(1);
34+
expect(angular.element(element).find('.card-pf-title').find('a').length).toBe(1);
3535

3636
//Make sure the class is getting set for the title icon
3737
expect(angular.element(element).find('.card-pf-title').find('.fa').hasClass('fa-shield')).toBeTruthy();
@@ -53,7 +53,7 @@ describe('Component: pfAggregateStatusCard', function() {
5353
element = compileCard('<pf-aggregate-status-card status="status"></pf-aggregate-status-card>', $scope);
5454

5555
//Make sure a link renders in the title
56-
expect(angular.element(element).find('.card-pf-title').find('a').size()).toBe(0);
56+
expect(angular.element(element).find('.card-pf-title').find('a').length).toBe(0);
5757
});
5858

5959
it("should set the notifications", function() {
@@ -81,13 +81,13 @@ describe('Component: pfAggregateStatusCard', function() {
8181
notifications = angular.element(element).find('.card-pf-aggregate-status-notification');
8282

8383
//Make sure two notifications render
84-
expect(notifications.size()).toBe(2);
84+
expect(notifications.length).toBe(2);
8585

8686
//First notification should have a link
87-
expect(notifications.eq(0).find('a').size()).toBe(1);
87+
expect(notifications.eq(0).find('a').length).toBe(1);
8888

8989
//Second notification should not have a link
90-
expect(notifications.eq(1).find('a').size()).toBe(0);
90+
expect(notifications.eq(1).find('a').length).toBe(0);
9191

9292
//first notification should have the following class
9393
expect(notifications.eq(0).find('span')).toHaveClass('pficon pficon-error-circle-o');
@@ -135,7 +135,7 @@ describe('Component: pfAggregateStatusCard', function() {
135135

136136
// should show the main icon
137137
cardClass = angular.element(element).find('.fa-shield');
138-
expect(cardClass.size()).toBe(1);
138+
expect(cardClass.length).toBe(1);
139139

140140
notifications = angular.element(element).find('.card-pf-aggregate-status-notification');
141141

@@ -166,7 +166,7 @@ describe('Component: pfAggregateStatusCard', function() {
166166

167167
// should not show the main icon
168168
cardClass = angular.element(element).find('.fa-shield');
169-
expect(cardClass.size()).toBe(0);
169+
expect(cardClass.length).toBe(0);
170170

171171
notifications = angular.element(element).find('.card-pf-aggregate-status-notification');
172172

test/card/basic/card.spec.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,23 @@ describe('Component: pfCard', function() {
6565
// by default, bottom border should be shown
6666
element = compileCard('<pf-card head-title="My card title" sub-title="My card subtitle title">Inner content goes here</pf-card>', $scope);
6767
cardClass = angular.element(element).find('.card-pf-heading');
68-
expect(cardClass.size()).toBe(1);
68+
expect(cardClass.length).toBe(1);
6969
cardClass = angular.element(element).find('.card-pf-heading-no-bottom');
70-
expect(cardClass.size()).toBe(0);
70+
expect(cardClass.length).toBe(0);
7171

7272
// setting to false should hide the bottom border
7373
element = compileCard('<pf-card head-title="My card title" sub-title="My card subtitle title" show-titles-separator="false">Inner content goes here</pf-card>', $scope);
7474
cardClass = angular.element(element).find('.card-pf-heading');
75-
expect(cardClass.size()).toBe(0);
75+
expect(cardClass.length).toBe(0);
7676
cardClass = angular.element(element).find('.card-pf-heading-no-bottom');
77-
expect(cardClass.size()).toBe(1);
77+
expect(cardClass.length).toBe(1);
7878

7979
// setting to true should show the bottom border
8080
element = compileCard('<pf-card head-title="My card title" sub-title="My card subtitle title" show-titles-separator="true">Inner content goes here</pf-card>', $scope);
8181
cardClass = angular.element(element).find('.card-pf-heading');
82-
expect(cardClass.size()).toBe(1);
82+
expect(cardClass.length).toBe(1);
8383
cardClass = angular.element(element).find('.card-pf-heading-no-bottom');
84-
expect(cardClass.size()).toBe(0);
84+
expect(cardClass.length).toBe(0);
8585

8686
});
8787

@@ -90,7 +90,7 @@ describe('Component: pfCard', function() {
9090
// by default, if footer not defined, footer should not be shown
9191
element = compileCard('<pf-card head-title="My card title" sub-title="My card subtitle title">Inner content goes here</pf-card>', $scope);
9292
cardClass = angular.element(element).find('.card-pf-footer');
93-
expect(cardClass.size()).toBe(0);
93+
expect(cardClass.length).toBe(0);
9494
});
9595

9696
it("should show the action bar footer", function() {
@@ -106,7 +106,7 @@ describe('Component: pfCard', function() {
106106
cardClass = angular.element(element).find('a');
107107
expect(cardClass.attr('href')).toBe('#addCluster');
108108
var spans = cardClass.find('span');
109-
expect(spans.size()).toBe(2);
109+
expect(spans.length).toBe(2);
110110
expect(spans.eq(0)).toHaveClass('fa fa-plus-circle');
111111
expect(spans.eq(1).html()).toBe('Add New Cluster');
112112

@@ -129,7 +129,7 @@ describe('Component: pfCard', function() {
129129
expect(isoScope.footerCallBackResult).toEqual('Footer Callback Fn Called');
130130

131131
var spans = cardClass.find('span');
132-
expect(spans.size()).toBe(2);
132+
expect(spans.length).toBe(2);
133133
expect(spans.eq(0)).toHaveClass('fa fa-flag');
134134
expect(spans.eq(1).html()).toBe('View All Events');
135135
});
@@ -145,7 +145,7 @@ describe('Component: pfCard', function() {
145145

146146
element = compileCard('<pf-card head-title="title" footer="actionBarConfig">Inner content</pf-card>', $scope);
147147
cardClass = angular.element(element).find('.card-pf-footer').find('button');
148-
expect(cardClass.size()).toBe(0);
148+
expect(cardClass.length).toBe(0);
149149
});
150150

151151
it("should show the filter in the footer if specified", function() {
@@ -164,7 +164,7 @@ describe('Component: pfCard', function() {
164164

165165
// should find 3 filters
166166
cardClass = angular.element(element).find('.card-pf-footer').find('a');
167-
expect(cardClass.size()).toBe(3);
167+
expect(cardClass.length).toBe(3);
168168

169169
// test setting default menu item
170170
var filterItem = angular.element(element).find('.card-pf-footer').find('button');
@@ -196,11 +196,11 @@ describe('Component: pfCard', function() {
196196

197197
// should NOT find any filters in the footer
198198
cardClass = angular.element(element).find('.card-pf-footer').find('a');
199-
expect(cardClass.size()).toBe(0);
199+
expect(cardClass.length).toBe(0);
200200

201201
// should find filters in the header
202202
cardClass = angular.element(element).find('.card-pf-heading').find('a');
203-
expect(cardClass.size()).toBe(3);
203+
expect(cardClass.length).toBe(3);
204204

205205
// test setting default menu item
206206
var filterItem = angular.element(element).find('.card-pf-heading').find('button');
@@ -221,11 +221,11 @@ describe('Component: pfCard', function() {
221221

222222
// should NOT find any header artifacts
223223
cardClass = angular.element(element).find('.card-pf-heading');
224-
expect(cardClass.size()).toBe(0);
224+
expect(cardClass.length).toBe(0);
225225

226226
// should find filters in the header
227227
cardClass = angular.element(element).find('.card-pf-heading-no-bottom');
228-
expect(cardClass.size()).toBe(0);
228+
expect(cardClass.length).toBe(0);
229229
});
230230
});
231231

test/charts/heatmap/heatmap-legend.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('Directive: pfHeatmapLegend', function() {
2222

2323
it("should use the default legend text and colors", function() {
2424
element = compileChart('<pf-heatmap-legend ></pf-heatmap-legend>',$scope);
25-
expect(angular.element(element).find('li').size()).toBe(4);
25+
expect(angular.element(element).find('li').length).toBe(4);
2626

2727
legendItem = angular.element(element).find('li')[0];
2828
legendText = legendItem.querySelector('.legend-pf-text');
@@ -35,7 +35,7 @@ describe('Directive: pfHeatmapLegend', function() {
3535
$scope.heatmapColorPattern = ['#d4f0fa', '#F9D67A'];
3636

3737
element = compileChart('<pf-heatmap-legend legend="legendLabels" legend-colors="heatmapColorPattern"></pf-heatmap-legend>',$scope);
38-
expect(angular.element(element).find('li').size()).toBe(2);
38+
expect(angular.element(element).find('li').length).toBe(2);
3939

4040
legendItem = angular.element(element).find('li')[0];
4141
legendText = legendItem.querySelector('.legend-pf-text');

test/charts/heatmap/heatmap.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('Component: pfHeatmap', function() {
4242
it("should generate 7 blocks", function() {
4343
element = compileChart('<pf-heatmap chart-title="title" data="data"></pf-heatmap>',$scope);
4444

45-
expect(angular.element(element).find('.heatmap-pf-svg').find('rect').size()).toBe(7);
45+
expect(angular.element(element).find('.heatmap-pf-svg').find('rect').length).toBe(7);
4646
});
4747

4848
it("should set color and tooltip of the block based on defaults", function() {

test/charts/trends/trends-chart.spec.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,20 @@ describe('Directive: pfTrendsChart', function() {
6666
it("should show large or small trend card layouts", function() {
6767
// by default, should show a large card
6868
trendCard = element.find('.trend-card-large-pf');
69-
expect(trendCard.size()).toBe(1);
69+
expect(trendCard.length).toBe(1);
7070
// check small card isn't being shown by default
7171
expect(trendCard.hasClass('.trend-card-small-pf')).toBeFalsy();
7272

7373
$scope.config.layout = 'small';
7474
$scope.$digest();
7575
trendCard = element.find('.trend-card-small-pf');
76-
expect(trendCard.size()).toBe(1);
76+
expect(trendCard.length).toBe(1);
7777
expect(trendCard.hasClass('.trend-card-large-pf')).toBeFalsy();
7878

7979
$scope.config.layout = 'large';
8080
$scope.$digest();
8181
trendCard = element.find('.trend-card-large-pf');
82-
expect(trendCard.size()).toBe(1);
82+
expect(trendCard.length).toBe(1);
8383
expect(trendCard.hasClass('.trend-card-small-pf')).toBeFalsy();
8484
});
8585

@@ -88,23 +88,23 @@ describe('Directive: pfTrendsChart', function() {
8888
$scope.$digest();
8989

9090
trendCard = element.find('.trend-row');
91-
expect(trendCard.size()).toBe(1);
91+
expect(trendCard.length).toBe(1);
9292
trendCard = element.find('.trend-title-compact-big-pf');
93-
expect(trendCard.size()).toBe(1);
93+
expect(trendCard.length).toBe(1);
9494
trendCard = element.find('.trend-title-compact-small-pf');
95-
expect(trendCard.size()).toBe(1);
95+
expect(trendCard.length).toBe(1);
9696
});
9797

9898
it("should show inline card layout", function() {
9999
$scope.config.layout = 'inline';
100100
$scope.$digest();
101101

102102
trendCard = element.find('.trend-row');
103-
expect(trendCard.size()).toBe(1);
103+
expect(trendCard.length).toBe(1);
104104
trendCard = element.find('.trend-flat-col');
105-
expect(trendCard.size()).toBe(2);
105+
expect(trendCard.length).toBe(2);
106106
trendCard = element.find('.trend-label-flat-strong-pf');
107-
expect(trendCard.size()).toBe(1);
107+
expect(trendCard.length).toBe(1);
108108

109109
trendCard = element.find('.trend-title-flat-big-pf');
110110
expect(trendCard.html()).toBe('76%');

test/charts/utilization-bar/utilization-bar.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('Directive: pfUtilizationBarChart', function() {
6565

6666
element = compileChart("<pf-utilization-bar-chart chart-data=data layout=layoutInline chart-title=title units=units></pf-utilization-bar-chart>", $scope);
6767
utilizationBar = angular.element(element).find('.progress-container');
68-
expect(utilizationBar.size()).toBe(1);
68+
expect(utilizationBar.length).toBe(1);
6969

7070
utilizationBar = angular.element(element).find('.progress-container').css('padding-left');
7171
expect(utilizationBar).toBe("120px");
@@ -77,12 +77,12 @@ describe('Directive: pfUtilizationBarChart', function() {
7777
element = compileChart("<pf-utilization-bar-chart chart-data=data threshold-error='85' threshold-warning='45' chart-title=title units=units></pf-utilization-bar-chart>", $scope);
7878

7979
utilizationBar = angular.element(element).find('.progress-bar-warning');
80-
expect(utilizationBar.size()).toBe(1);
80+
expect(utilizationBar.length).toBe(1);
8181

8282
element = compileChart("<pf-utilization-bar-chart chart-data=data threshold-error='45' threshold-warning='15' chart-title=title units=units></pf-utilization-bar-chart>", $scope);
8383

8484
utilizationBar = angular.element(element).find('.progress-bar-danger');
85-
expect(utilizationBar.size()).toBe(1);
85+
expect(utilizationBar.length).toBe(1);
8686
});
8787

8888
it("should use custom footer labels", function() {

0 commit comments

Comments
 (0)