Skip to content

Commit 7bdaa9b

Browse files
committed
chore(linting): Code formatting for tests
Update code format for unit tests.
1 parent 26acd65 commit 7bdaa9b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+438
-314
lines changed

Gruntfile.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,23 @@ module.exports = function (grunt) {
146146
}
147147
},
148148
eslint: {
149-
options: {
150-
configFile: 'eslint.yaml'
149+
standard: {
150+
options: {
151+
configFile: 'eslint.yaml'
152+
},
153+
src : [
154+
'Gruntfile.js',
155+
'src/**/*.js'
156+
]
151157
},
152-
target: [
153-
'Gruntfile.js',
154-
'src/**/*.js'
155-
]
158+
tests: {
159+
options: {
160+
configFile: 'test/eslint.yaml'
161+
},
162+
src : [
163+
'test/**/*.js'
164+
]
165+
}
156166
},
157167
karma: {
158168
unit: {

eslint.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ rules:
2121
no-trailing-spaces: 2
2222
space-after-keywords: 2
2323
space-before-blocks: 2
24-
space-before-function-paren: 2
24+
space-before-function-paren: 0
2525
space-infix-ops: 2
2626
brace-style: 2
2727
semi: 2
@@ -32,10 +32,10 @@ rules:
3232
guard-for-in: 2
3333
no-else-return: 2
3434
no-loop-func: 2
35-
vars-on-top: 2
35+
vars-on-top: 1
3636
no-debugger: 2
3737
no-cond-assign: 2
38-
no-console: 2
38+
no-console: 1
3939
no-extra-semi: 2
4040
no-irregular-whitespace: 2
4141
dot-notation:

test/autofocus/autofocus.spec.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
describe('pf-autofocus', function () {
2-
3-
var $scope, $compile, $timeout;
2+
var $scope;
3+
var $compile;
4+
var $timeout;
45

56
beforeEach(module('patternfly.autofocus'));
67
beforeEach(inject(function (_$rootScope_, _$compile_, _$timeout_) {
@@ -49,7 +50,7 @@ describe('pf-autofocus', function () {
4950
var eUnFocused1 = page.find("#i1")[0];
5051
var eUnFocused2 = page.find("#i2")[0];
5152

52-
$scope.$apply(function(){
53+
$scope.$apply(function () {
5354
$scope.iFocused1 = true;
5455
$scope.iFocused2 = false;
5556
});
@@ -59,7 +60,7 @@ describe('pf-autofocus', function () {
5960
expect(eUnFocused1 === document.activeElement).toBe(true);
6061
expect(eUnFocused2 === document.activeElement).toBe(false);
6162

62-
$scope.$apply(function(){
63+
$scope.$apply(function () {
6364
$scope.iFocused1 = false;
6465
$scope.iFocused2 = true;
6566
});
@@ -88,7 +89,7 @@ describe('pf-autofocus', function () {
8889
expect(eUnFocused1 === document.activeElement).toBe(false);
8990
expect(eUnfocused2 === document.activeElement).toBe(false);
9091

91-
$scope.$apply(function(){
92+
$scope.$apply(function () {
9293
$scope.iFocused = true;
9394
});
9495

@@ -97,7 +98,7 @@ describe('pf-autofocus', function () {
9798
expect(eUnFocused1 === document.activeElement).toBe(false);
9899
expect(eUnfocused2 === document.activeElement).toBe(true);
99100

100-
$scope.$apply(function(){
101+
$scope.$apply(function () {
101102
$scope.iFocused = false;
102103
});
103104

@@ -110,4 +111,4 @@ describe('pf-autofocus', function () {
110111

111112
});
112113
});
113-
});
114+
});

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

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
describe('Component: pfAggregateStatusCard', function() {
2-
var $scope, $compile, element, cardClass, notifications;
1+
describe('Component: pfAggregateStatusCard', function () {
2+
var $scope;
3+
var $compile;
4+
var element;
5+
var cardClass;
6+
var notifications;
37

48
beforeEach(module('patternfly.card', 'card/aggregate-status/aggregate-status-card.html'));
59

6-
beforeEach(inject(function(_$compile_, _$rootScope_) {
10+
beforeEach(inject(function (_$compile_, _$rootScope_) {
711
$compile = _$compile_;
812
$scope = _$rootScope_;
913
}));
@@ -16,7 +20,7 @@ describe('Component: pfAggregateStatusCard', function() {
1620
return el;
1721
};
1822

19-
it("should set the title link, count, and icons class", function() {
23+
it("should set the title link, count, and icons class", function () {
2024

2125
$scope.status = {
2226
"title":"Nodes",
@@ -42,7 +46,7 @@ describe('Component: pfAggregateStatusCard', function() {
4246
expect(cardClass).toBeFalsy();
4347
});
4448

45-
it("No link should be present in the title", function() {
49+
it("No link should be present in the title", function () {
4650

4751
$scope.status = {
4852
"title":"Nodes",
@@ -56,24 +60,24 @@ describe('Component: pfAggregateStatusCard', function() {
5660
expect(angular.element(element).find('.card-pf-title').find('a').length).toBe(0);
5761
});
5862

59-
it("should set the notifications", function() {
63+
it("should set the notifications", function () {
6064

6165
$scope.status = {
6266
"title":"Nodes",
6367
"count":793,
6468
"href":"#",
6569
"iconClass": "fa fa-shield",
6670
"notifications":[
67-
{
68-
"iconClass":"pficon pficon-error-circle-o",
69-
"count":4,
70-
"href":"#"
71-
},
72-
{
73-
"iconClass":"pficon pficon-warning-triangle-o",
74-
"count":1
75-
}
76-
]
71+
{
72+
"iconClass":"pficon pficon-error-circle-o",
73+
"count":4,
74+
"href":"#"
75+
},
76+
{
77+
"iconClass":"pficon pficon-warning-triangle-o",
78+
"count":1
79+
}
80+
]
7781
};
7882

7983
element = compileCard('<pf-aggregate-status-card status="status"></pf-aggregate-status-card>', $scope);
@@ -96,7 +100,7 @@ describe('Component: pfAggregateStatusCard', function() {
96100
expect(notifications.eq(1).find('span')).toHaveClass('pficon pficon-warning-triangle-o');
97101
});
98102

99-
it("should show the top border", function() {
103+
it("should show the top border", function () {
100104
element = compileCard('<pf-aggregate-status-card show-top-border="true"></pf-aggregate-status-card>', $scope);
101105

102106
// showTopBorder set to true, results in having the .card-pf-accented class
@@ -105,15 +109,15 @@ describe('Component: pfAggregateStatusCard', function() {
105109

106110
});
107111

108-
it("should hide the top border", function() {
112+
it("should hide the top border", function () {
109113
element = compileCard('<pf-aggregate-status-card show-top-border="false"></pf-aggregate-status-card>', $scope);
110114

111115
// showTopBorder set to false, results in not having the .card-pf-accented class
112116
cardClass = angular.element(element).find('.card-pf').hasClass('card-pf-accented');
113117
expect(cardClass).toBeFalsy();
114118
});
115119

116-
it("should show mini layout", function() {
120+
it("should show mini layout", function () {
117121

118122
$scope.status = {
119123
"title":"Nodes",
@@ -147,15 +151,14 @@ describe('Component: pfAggregateStatusCard', function() {
147151

148152
});
149153

150-
it("should show mini layout, and hide optional items", function() {
154+
it("should show mini layout, and hide optional items", function () {
151155

152156
$scope.status = {
153157
"title":"Nodes",
154158
"count":793,
155-
"notification":
156-
{
157-
"count":6
158-
}
159+
"notification": {
160+
"count":6
161+
}
159162
};
160163

161164
element = compileCard('<pf-aggregate-status-card status="status" layout="mini"></pf-aggregate-status-card>', $scope);
@@ -180,10 +183,9 @@ describe('Component: pfAggregateStatusCard', function() {
180183
$scope.status = {
181184
"title":"Nodes",
182185
"count":793,
183-
"notification":
184-
{
185-
"iconClass":"pficon pficon-error-circle-o"
186-
}
186+
"notification": {
187+
"iconClass":"pficon pficon-error-circle-o"
188+
}
187189
};
188190

189191
element = compileCard('<pf-aggregate-status-card status="status" layout="mini"></pf-aggregate-status-card>', $scope);
@@ -197,7 +199,7 @@ describe('Component: pfAggregateStatusCard', function() {
197199
expect(notifications.eq(0).find('span').eq(1).html()).not.toBe('6');
198200
});
199201

200-
it("should set of the iconImage value", function() {
202+
it("should set of the iconImage value", function () {
201203

202204
$scope.aggStatusAlt = {
203205
"title":"Providers",

test/card/basic/card.spec.js

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
describe('Component: pfCard', function() {
2-
var $scope, $compile, element, headTitle, subTitle, cardClass, innerContent, isoScope;
1+
describe('Component: pfCard', function () {
2+
var $scope;
3+
var $compile;
4+
var element;
5+
var headTitle;
6+
var subTitle;
7+
var cardClass;
8+
var innerContent;
9+
var isoScope;
310

411
beforeEach(module(
512
'patternfly.card',
613
'card/basic/card.html',
714
'card/basic/card-filter.html'
815
));
916

10-
beforeEach(inject(function(_$compile_, _$rootScope_) {
17+
beforeEach(inject(function (_$compile_, _$rootScope_) {
1118
$compile = _$compile_;
1219
$scope = _$rootScope_;
1320
}));
@@ -21,7 +28,7 @@ describe('Component: pfCard', function() {
2128
return el;
2229
};
2330

24-
it("should set the headTitle and subTitle and inner content", function() {
31+
it("should set the headTitle and subTitle and inner content", function () {
2532

2633
element = compileCard('<pf-card head-title="My card title" sub-title="My card subtitle title"><span>Inner content goes here</span></pf-card>', $scope);
2734

@@ -40,7 +47,7 @@ describe('Component: pfCard', function() {
4047
expect(cardClass).toBeFalsy();
4148
});
4249

43-
it("should show the top border", function() {
50+
it("should show the top border", function () {
4451

4552
element = compileCard('<pf-card head-title="My card title" sub-title="My card subtitle title" show-top-border="true">Inner content goes here</pf-card>', $scope);
4653

@@ -50,7 +57,7 @@ describe('Component: pfCard', function() {
5057

5158
});
5259

53-
it("should hide the top border", function() {
60+
it("should hide the top border", function () {
5461

5562
element = compileCard('<pf-card head-title="My card title" sub-title="My card subtitle title" show-top-border="false">Inner content goes here</pf-card>', $scope);
5663

@@ -60,7 +67,7 @@ describe('Component: pfCard', function() {
6067

6168
});
6269

63-
it("should show and hide the bottom border", function() {
70+
it("should show and hide the bottom border", function () {
6471

6572
// by default, bottom border should be shown
6673
element = compileCard('<pf-card head-title="My card title" sub-title="My card subtitle title">Inner content goes here</pf-card>', $scope);
@@ -85,7 +92,7 @@ describe('Component: pfCard', function() {
8592

8693
});
8794

88-
it("should show and hide the spinner", function() {
95+
it("should show and hide the spinner", function () {
8996

9097
// When data is loaded, spinner should be hidden
9198
$scope.dataLoading = false;
@@ -100,7 +107,7 @@ describe('Component: pfCard', function() {
100107
expect(cardClass.length).toBe(1);
101108
});
102109

103-
it("should show and hide the spinner text", function() {
110+
it("should show and hide the spinner text", function () {
104111

105112
// When no spinner text is given, it should be undefined
106113
element = compileCard('<pf-card head-title="My card title" show-spinner="dataLoading" sub-title="My card subtitle title" show-top-border="false">Inner content goes here</pf-card>', $scope);
@@ -115,15 +122,15 @@ describe('Component: pfCard', function() {
115122

116123
});
117124

118-
it("should hide the action bar footer by default", function() {
125+
it("should hide the action bar footer by default", function () {
119126

120127
// by default, if footer not defined, footer should not be shown
121128
element = compileCard('<pf-card head-title="My card title" sub-title="My card subtitle title">Inner content goes here</pf-card>', $scope);
122129
cardClass = angular.element(element).find('.card-pf-footer');
123130
expect(cardClass.length).toBe(0);
124131
});
125132

126-
it("should show the action bar footer", function() {
133+
it("should show the action bar footer", function () {
127134

128135
// show a footer with a href
129136
$scope.actionBarConfig = {
@@ -164,7 +171,7 @@ describe('Component: pfCard', function() {
164171
expect(spans.eq(1).html()).toBe('View All Events');
165172
});
166173

167-
it("should hide the filter in the footer by default", function() {
174+
it("should hide the filter in the footer by default", function () {
168175

169176
// show a footer with a href
170177
$scope.actionBarConfig = {
@@ -178,15 +185,15 @@ describe('Component: pfCard', function() {
178185
expect(cardClass.length).toBe(0);
179186
});
180187

181-
it("should show the filter in the footer if specified", function() {
188+
it("should show the filter in the footer if specified", function () {
182189

183190
$scope.filterConfig = {
184191
'filters' : [{label:'Last 30 Days', value:'30'},
185192
{label:'Last 15 Days', value:'15'},
186193
{label:'Today', value:'today'}],
187194
'callBackFn': function (f) {
188195
return "Footer Filter Callback Fn Called: label='" + f.label + "' value = " + f.value;
189-
},
196+
},
190197
'defaultFilter' : 2
191198
};
192199

@@ -209,7 +216,7 @@ describe('Component: pfCard', function() {
209216
expect(filterItem.html()).toContain('Last 30 Days');
210217
});
211218

212-
it("should show the filter in the header if specified", function() {
219+
it("should show the filter in the header if specified", function () {
213220

214221
$scope.filterConfig = {
215222
'filters' : [{label:'Last 30 Days', value:'30'},
@@ -245,7 +252,7 @@ describe('Component: pfCard', function() {
245252
expect(filterItem.html()).toContain('Last 30 Days');
246253
});
247254

248-
it("should not show the header if no title or filter specified", function() {
255+
it("should not show the header if no title or filter specified", function () {
249256

250257
element = compileCard('<pf-card>Inner content</pf-card>', $scope);
251258

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
describe('Component: pfInfoStatusCard', function () {
2-
var $scope, $compile, element, cardClass;
2+
var $scope;
3+
var $compile;
4+
var element;
5+
var cardClass;
36

47
beforeEach(module('patternfly.card', 'card/info-status/info-status-card.html'));
58

0 commit comments

Comments
 (0)