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

Commit d89bbd1

Browse files
Foxandxssbekos
authored andcommitted
test(pagination): clean some injections
Closes #1895
1 parent 6a83011 commit d89bbd1

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

src/pagination/test/pager.spec.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ describe('pager directive', function () {
9797
});
9898

9999
describe('`items-per-page`', function () {
100-
beforeEach(inject(function() {
100+
beforeEach(function() {
101101
$rootScope.perpage = 5;
102-
element = $compile('<pager total-items="total" items-per-page="perpage" ng-model="currentPage"></pagination>')($rootScope);
102+
element = $compile('<pager total-items="total" items-per-page="perpage" ng-model="currentPage"></pager>')($rootScope);
103103
$rootScope.$digest();
104-
}));
104+
});
105105

106106
it('does not change the number of pages', function() {
107107
expect(getPaginationBarSize()).toBe(2);
@@ -116,7 +116,7 @@ describe('pager directive', function () {
116116
expect($rootScope.currentPage).toBe(2);
117117
expect(getPaginationBarSize()).toBe(2);
118118
expect(getPaginationEl(0)).not.toHaveClass('disabled');
119-
expect(getPaginationEl(1)).toHaveClass('disabled');
119+
expect(getPaginationEl(-1)).toHaveClass('disabled');
120120
});
121121
});
122122

@@ -131,11 +131,11 @@ describe('pager directive', function () {
131131
});
132132

133133
describe('`num-pages`', function () {
134-
beforeEach(inject(function() {
134+
beforeEach(function() {
135135
$rootScope.numpg = null;
136136
element = $compile('<pager total-items="total" ng-model="currentPage" num-pages="numpg"></pager>')($rootScope);
137137
$rootScope.$digest();
138-
}));
138+
});
139139

140140
it('equals to total number of pages', function() {
141141
expect($rootScope.numpg).toBe(5);
@@ -169,10 +169,10 @@ describe('pager directive', function () {
169169
});
170170

171171
describe('override configuration from attributes', function () {
172-
beforeEach(inject(function() {
172+
beforeEach(function() {
173173
element = $compile('<pager align="false" previous-text="<" next-text=">" total-items="total" ng-model="currentPage"></pager>')($rootScope);
174174
$rootScope.$digest();
175-
}));
175+
});
176176

177177
it('contains 2 li elements', function() {
178178
expect(getPaginationBarSize()).toBe(2);

src/pagination/test/pagination.spec.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ describe('pagination directive', function () {
123123
});
124124

125125
describe('`items-per-page`', function () {
126-
beforeEach(inject(function() {
126+
beforeEach(function() {
127127
$rootScope.perpage = 5;
128128
element = $compile('<pagination total-items="total" items-per-page="perpage" ng-model="currentPage"></pagination>')($rootScope);
129129
$rootScope.$digest();
130-
}));
130+
});
131131

132132
it('changes the number of pages', function() {
133133
expect(getPaginationBarSize()).toBe(12);
@@ -166,11 +166,11 @@ describe('pagination directive', function () {
166166
});
167167

168168
describe('executes `ng-change` expression', function () {
169-
beforeEach(inject(function() {
169+
beforeEach(function() {
170170
$rootScope.selectPageHandler = jasmine.createSpy('selectPageHandler');
171171
element = $compile('<pagination total-items="total" ng-model="currentPage" ng-change="selectPageHandler()"></pagination>')($rootScope);
172172
$rootScope.$digest();
173-
}));
173+
});
174174

175175
it('when an element is clicked', function() {
176176
clickPaginationEl(2);
@@ -194,13 +194,13 @@ describe('pagination directive', function () {
194194
});
195195

196196
describe('with `max-size` option', function () {
197-
beforeEach(inject(function() {
197+
beforeEach(function() {
198198
$rootScope.total = 98; // 10 pages
199199
$rootScope.currentPage = 3;
200200
$rootScope.maxSize = 5;
201201
element = $compile('<pagination total-items="total" ng-model="currentPage" max-size="maxSize"></pagination>')($rootScope);
202202
$rootScope.$digest();
203-
}));
203+
});
204204

205205
it('contains maxsize + 2 li elements', function() {
206206
expect(getPaginationBarSize()).toBe($rootScope.maxSize + 2);
@@ -230,7 +230,7 @@ describe('pagination directive', function () {
230230
clickPaginationEl(0);
231231

232232
expect($rootScope.currentPage).toBe(6);
233-
expect(getPaginationEl(3)).toHaveClass('active');
233+
expect(getPaginationEl(3)).toHaveClass('active');
234234
expect(getPaginationEl(3).text()).toBe(''+$rootScope.currentPage);
235235
});
236236

@@ -262,14 +262,14 @@ describe('pagination directive', function () {
262262
});
263263

264264
describe('with `max-size` option & no `rotate`', function () {
265-
beforeEach(inject(function() {
265+
beforeEach(function() {
266266
$rootScope.total = 115; // 12 pages
267267
$rootScope.currentPage = 7;
268268
$rootScope.maxSize = 5;
269269
$rootScope.rotate = false;
270270
element = $compile('<pagination total-items="total" ng-model="currentPage" max-size="maxSize" rotate="rotate"></pagination>')($rootScope);
271271
$rootScope.$digest();
272-
}));
272+
});
273273

274274
it('contains maxsize + 4 elements', function() {
275275
expect(getPaginationBarSize()).toBe($rootScope.maxSize + 4);
@@ -325,10 +325,10 @@ describe('pagination directive', function () {
325325
});
326326

327327
describe('pagination directive with `boundary-links`', function () {
328-
beforeEach(inject(function() {
328+
beforeEach(function() {
329329
element = $compile('<pagination boundary-links="true" total-items="total" ng-model="currentPage"></pagination>')($rootScope);
330330
$rootScope.$digest();
331-
}));
331+
});
332332

333333
it('contains num-pages + 4 li elements', function() {
334334
expect(getPaginationBarSize()).toBe(9);
@@ -418,10 +418,10 @@ describe('pagination directive', function () {
418418
});
419419

420420
describe('pagination directive with just number links', function () {
421-
beforeEach(inject(function() {
421+
beforeEach(function() {
422422
element = $compile('<pagination direction-links="false" total-items="total" ng-model="currentPage"></pagination>')($rootScope);
423423
$rootScope.$digest();
424-
}));
424+
});
425425

426426
it('contains num-pages li elements', function() {
427427
expect(getPaginationBarSize()).toBe(5);
@@ -469,11 +469,11 @@ describe('pagination directive', function () {
469469
});
470470

471471
describe('with just boundary & number links', function () {
472-
beforeEach(inject(function() {
472+
beforeEach(function() {
473473
$rootScope.directions = false;
474474
element = $compile('<pagination boundary-links="true" direction-links="directions" total-items="total" ng-model="currentPage"></pagination>')($rootScope);
475475
$rootScope.$digest();
476-
}));
476+
});
477477

478478
it('contains number of pages + 2 li elements', function() {
479479
expect(getPaginationBarSize()).toBe(7);
@@ -501,11 +501,11 @@ describe('pagination directive', function () {
501501
});
502502

503503
describe('`num-pages`', function () {
504-
beforeEach(inject(function() {
504+
beforeEach(function() {
505505
$rootScope.numpg = null;
506506
element = $compile('<pagination total-items="total" ng-model="currentPage" num-pages="numpg"></pagination>')($rootScope);
507507
$rootScope.$digest();
508-
}));
508+
});
509509

510510
it('equals to total number of pages', function() {
511511
expect($rootScope.numpg).toBe(5);
@@ -573,10 +573,10 @@ describe('pagination directive', function () {
573573
});
574574

575575
describe('override configuration from attributes', function () {
576-
beforeEach(inject(function() {
576+
beforeEach(function() {
577577
element = $compile('<pagination boundary-links="true" first-text="<<" previous-text="<" next-text=">" last-text=">>" total-items="total" ng-model="currentPage"></pagination>')($rootScope);
578578
$rootScope.$digest();
579-
}));
579+
});
580580

581581
it('contains number of pages + 4 li elements', function() {
582582
expect(getPaginationBarSize()).toBe(9);

0 commit comments

Comments
 (0)