@@ -7,7 +7,7 @@ describe('pagination directive', function () {
7
7
$rootScope = _$rootScope_ ;
8
8
$rootScope . total = 47 ; // 5 pages
9
9
$rootScope . currentPage = 3 ;
10
- element = $compile ( '<pagination total-items="total" page ="currentPage"></pagination>' ) ( $rootScope ) ;
10
+ element = $compile ( '<pagination total-items="total" ng-model ="currentPage"></pagination>' ) ( $rootScope ) ;
11
11
$rootScope . $digest ( ) ;
12
12
} ) ) ;
13
13
@@ -125,7 +125,7 @@ describe('pagination directive', function () {
125
125
describe ( '`items-per-page`' , function ( ) {
126
126
beforeEach ( inject ( function ( ) {
127
127
$rootScope . perpage = 5 ;
128
- element = $compile ( '<pagination total-items="total" items-per-page="perpage" page="currentPage" on-select-page="selectPageHandler(page) "></pagination>' ) ( $rootScope ) ;
128
+ element = $compile ( '<pagination total-items="total" items-per-page="perpage" ng-model="currentPage "></pagination>' ) ( $rootScope ) ;
129
129
$rootScope . $digest ( ) ;
130
130
} ) ) ;
131
131
@@ -165,16 +165,16 @@ describe('pagination directive', function () {
165
165
} ) ;
166
166
} ) ;
167
167
168
- describe ( 'executes `on-select-page ` expression' , function ( ) {
168
+ describe ( 'executes `ng-change ` expression' , function ( ) {
169
169
beforeEach ( inject ( function ( ) {
170
170
$rootScope . selectPageHandler = jasmine . createSpy ( 'selectPageHandler' ) ;
171
- element = $compile ( '<pagination total-items="total" page ="currentPage" on-select-page ="selectPageHandler(page )"></pagination>' ) ( $rootScope ) ;
171
+ element = $compile ( '<pagination total-items="total" ng-model ="currentPage" ng-change ="selectPageHandler()"></pagination>' ) ( $rootScope ) ;
172
172
$rootScope . $digest ( ) ;
173
173
} ) ) ;
174
174
175
175
it ( 'when an element is clicked' , function ( ) {
176
176
clickPaginationEl ( 2 ) ;
177
- expect ( $rootScope . selectPageHandler ) . toHaveBeenCalledWith ( 2 ) ;
177
+ expect ( $rootScope . selectPageHandler ) . toHaveBeenCalled ( ) ;
178
178
} ) ;
179
179
} ) ;
180
180
@@ -198,7 +198,7 @@ describe('pagination directive', function () {
198
198
$rootScope . total = 98 ; // 10 pages
199
199
$rootScope . currentPage = 3 ;
200
200
$rootScope . maxSize = 5 ;
201
- element = $compile ( '<pagination total-items="total" page ="currentPage" max-size="maxSize"></pagination>' ) ( $rootScope ) ;
201
+ element = $compile ( '<pagination total-items="total" ng-model ="currentPage" max-size="maxSize"></pagination>' ) ( $rootScope ) ;
202
202
$rootScope . $digest ( ) ;
203
203
} ) ) ;
204
204
@@ -267,7 +267,7 @@ describe('pagination directive', function () {
267
267
$rootScope . currentPage = 7 ;
268
268
$rootScope . maxSize = 5 ;
269
269
$rootScope . rotate = false ;
270
- element = $compile ( '<pagination total-items="total" page ="currentPage" max-size="maxSize" rotate="rotate"></pagination>' ) ( $rootScope ) ;
270
+ element = $compile ( '<pagination total-items="total" ng-model ="currentPage" max-size="maxSize" rotate="rotate"></pagination>' ) ( $rootScope ) ;
271
271
$rootScope . $digest ( ) ;
272
272
} ) ) ;
273
273
@@ -326,7 +326,7 @@ describe('pagination directive', function () {
326
326
327
327
describe ( 'pagination directive with `boundary-links`' , function ( ) {
328
328
beforeEach ( inject ( function ( ) {
329
- element = $compile ( '<pagination boundary-links="true" total-items="total" page ="currentPage"></pagination>' ) ( $rootScope ) ;
329
+ element = $compile ( '<pagination boundary-links="true" total-items="total" ng-model ="currentPage"></pagination>' ) ( $rootScope ) ;
330
330
$rootScope . $digest ( ) ;
331
331
} ) ) ;
332
332
@@ -381,15 +381,15 @@ describe('pagination directive', function () {
381
381
} ) ;
382
382
383
383
it ( 'changes "first" & "last" text from attributes' , function ( ) {
384
- element = $compile ( '<pagination boundary-links="true" first-text="<<<" last-text=">>>" total-items="total" page ="currentPage"></pagination>' ) ( $rootScope ) ;
384
+ element = $compile ( '<pagination boundary-links="true" first-text="<<<" last-text=">>>" total-items="total" ng-model ="currentPage"></pagination>' ) ( $rootScope ) ;
385
385
$rootScope . $digest ( ) ;
386
386
387
387
expect ( getPaginationEl ( 0 ) . text ( ) ) . toBe ( '<<<' ) ;
388
388
expect ( getPaginationEl ( - 1 ) . text ( ) ) . toBe ( '>>>' ) ;
389
389
} ) ;
390
390
391
391
it ( 'changes "previous" & "next" text from attributes' , function ( ) {
392
- element = $compile ( '<pagination boundary-links="true" previous-text="<<" next-text=">>" total-items="total" page ="currentPage"></pagination>' ) ( $rootScope ) ;
392
+ element = $compile ( '<pagination boundary-links="true" previous-text="<<" next-text=">>" total-items="total" ng-model ="currentPage"></pagination>' ) ( $rootScope ) ;
393
393
$rootScope . $digest ( ) ;
394
394
395
395
expect ( getPaginationEl ( 1 ) . text ( ) ) . toBe ( '<<' ) ;
@@ -399,7 +399,7 @@ describe('pagination directive', function () {
399
399
it ( 'changes "first" & "last" text from interpolated attributes' , function ( ) {
400
400
$rootScope . myfirstText = '<<<' ;
401
401
$rootScope . mylastText = '>>>' ;
402
- element = $compile ( '<pagination boundary-links="true" first-text="{{myfirstText}}" last-text="{{mylastText}}" total-items="total" page ="currentPage"></pagination>' ) ( $rootScope ) ;
402
+ element = $compile ( '<pagination boundary-links="true" first-text="{{myfirstText}}" last-text="{{mylastText}}" total-items="total" ng-model ="currentPage"></pagination>' ) ( $rootScope ) ;
403
403
$rootScope . $digest ( ) ;
404
404
405
405
expect ( getPaginationEl ( 0 ) . text ( ) ) . toBe ( '<<<' ) ;
@@ -409,7 +409,7 @@ describe('pagination directive', function () {
409
409
it ( 'changes "previous" & "next" text from interpolated attributes' , function ( ) {
410
410
$rootScope . previousText = '<<' ;
411
411
$rootScope . nextText = '>>' ;
412
- element = $compile ( '<pagination boundary-links="true" previous-text="{{previousText}}" next-text="{{nextText}}" total-items="total" page ="currentPage"></pagination>' ) ( $rootScope ) ;
412
+ element = $compile ( '<pagination boundary-links="true" previous-text="{{previousText}}" next-text="{{nextText}}" total-items="total" ng-model ="currentPage"></pagination>' ) ( $rootScope ) ;
413
413
$rootScope . $digest ( ) ;
414
414
415
415
expect ( getPaginationEl ( 1 ) . text ( ) ) . toBe ( '<<' ) ;
@@ -419,7 +419,7 @@ describe('pagination directive', function () {
419
419
420
420
describe ( 'pagination directive with just number links' , function ( ) {
421
421
beforeEach ( inject ( function ( ) {
422
- element = $compile ( '<pagination direction-links="false" total-items="total" page ="currentPage"></pagination>' ) ( $rootScope ) ;
422
+ element = $compile ( '<pagination direction-links="false" total-items="total" ng-model ="currentPage"></pagination>' ) ( $rootScope ) ;
423
423
$rootScope . $digest ( ) ;
424
424
} ) ) ;
425
425
@@ -471,7 +471,7 @@ describe('pagination directive', function () {
471
471
describe ( 'with just boundary & number links' , function ( ) {
472
472
beforeEach ( inject ( function ( ) {
473
473
$rootScope . directions = false ;
474
- element = $compile ( '<pagination boundary-links="true" direction-links="directions" total-items="total" page ="currentPage"></pagination>' ) ( $rootScope ) ;
474
+ element = $compile ( '<pagination boundary-links="true" direction-links="directions" total-items="total" ng-model ="currentPage"></pagination>' ) ( $rootScope ) ;
475
475
$rootScope . $digest ( ) ;
476
476
} ) ) ;
477
477
@@ -503,7 +503,7 @@ describe('pagination directive', function () {
503
503
describe ( '`num-pages`' , function ( ) {
504
504
beforeEach ( inject ( function ( ) {
505
505
$rootScope . numpg = null ;
506
- element = $compile ( '<pagination total-items="total" page ="currentPage" num-pages="numpg"></pagination>' ) ( $rootScope ) ;
506
+ element = $compile ( '<pagination total-items="total" ng-model ="currentPage" num-pages="numpg"></pagination>' ) ( $rootScope ) ;
507
507
$rootScope . $digest ( ) ;
508
508
} ) ) ;
509
509
@@ -539,7 +539,7 @@ describe('pagination directive', function () {
539
539
paginationConfig . previousText = 'PR' ;
540
540
paginationConfig . nextText = 'NE' ;
541
541
paginationConfig . lastText = 'LA' ;
542
- element = $compile ( '<pagination total-items="total" page ="currentPage"></pagination>' ) ( $rootScope ) ;
542
+ element = $compile ( '<pagination total-items="total" ng-model ="currentPage"></pagination>' ) ( $rootScope ) ;
543
543
$rootScope . $digest ( ) ;
544
544
} ) ) ;
545
545
afterEach ( inject ( function ( paginationConfig ) {
@@ -561,7 +561,7 @@ describe('pagination directive', function () {
561
561
562
562
describe ( 'override configuration from attributes' , function ( ) {
563
563
beforeEach ( inject ( function ( ) {
564
- element = $compile ( '<pagination boundary-links="true" first-text="<<" previous-text="<" next-text=">" last-text=">>" total-items="total" page ="currentPage"></pagination>' ) ( $rootScope ) ;
564
+ element = $compile ( '<pagination boundary-links="true" first-text="<<" previous-text="<" next-text=">" last-text=">>" total-items="total" ng-model ="currentPage"></pagination>' ) ( $rootScope ) ;
565
565
$rootScope . $digest ( ) ;
566
566
} ) ) ;
567
567
0 commit comments