@@ -222,7 +222,8 @@ describe('pagination directive with max size option & no rotate', function () {
222
222
$rootScope . numPages = 12 ;
223
223
$rootScope . currentPage = 7 ;
224
224
$rootScope . maxSize = 5 ;
225
- element = $compile ( '<pagination num-pages="numPages" current-page="currentPage" max-size="maxSize" rotate="false"></pagination>' ) ( $rootScope ) ;
225
+ $rootScope . rotate = false ;
226
+ element = $compile ( '<pagination num-pages="numPages" current-page="currentPage" max-size="maxSize" rotate="rotate"></pagination>' ) ( $rootScope ) ;
226
227
$rootScope . $digest ( ) ;
227
228
} ) ) ;
228
229
@@ -296,7 +297,6 @@ describe('pagination directive with added first & last links', function () {
296
297
$rootScope . $digest ( ) ;
297
298
} ) ) ;
298
299
299
-
300
300
it ( 'contains one ul and num-pages + 4 li elements' , function ( ) {
301
301
expect ( element . find ( 'ul' ) . length ) . toBe ( 1 ) ;
302
302
expect ( element . find ( 'li' ) . length ) . toBe ( 9 ) ;
@@ -331,7 +331,6 @@ describe('pagination directive with added first & last links', function () {
331
331
expect ( element . find ( 'li' ) . eq ( - 1 ) . hasClass ( 'disabled' ) ) . toBe ( true ) ;
332
332
} ) ;
333
333
334
-
335
334
it ( 'changes currentPage if the "first" link is clicked' , function ( ) {
336
335
var first = element . find ( 'li' ) . eq ( 0 ) . find ( 'a' ) . eq ( 0 ) ;
337
336
first . click ( ) ;
@@ -365,35 +364,35 @@ describe('pagination directive with added first & last links', function () {
365
364
} ) ;
366
365
367
366
it ( 'changes "first" & "last" text from attributes' , function ( ) {
368
- element = $compile ( '<pagination boundary-links="true" first-text="\' <<<\' " last-text="\' >>>\' " num-pages="numPages" current-page="currentPage"></pagination>' ) ( $rootScope ) ;
367
+ element = $compile ( '<pagination boundary-links="true" first-text="<<<" last-text=">>>" num-pages="numPages" current-page="currentPage"></pagination>' ) ( $rootScope ) ;
369
368
$rootScope . $digest ( ) ;
370
369
371
370
expect ( element . find ( 'li' ) . eq ( 0 ) . text ( ) ) . toBe ( '<<<' ) ;
372
371
expect ( element . find ( 'li' ) . eq ( - 1 ) . text ( ) ) . toBe ( '>>>' ) ;
373
372
} ) ;
374
373
375
374
it ( 'changes "previous" & "next" text from attributes' , function ( ) {
376
- element = $compile ( '<pagination boundary-links="true" previous-text="\'<<\' " next-text="\'>>\' " num-pages="numPages" current-page="currentPage"></pagination>' ) ( $rootScope ) ;
375
+ element = $compile ( '<pagination boundary-links="true" previous-text="<< " next-text=">> " num-pages="numPages" current-page="currentPage"></pagination>' ) ( $rootScope ) ;
377
376
$rootScope . $digest ( ) ;
378
377
379
378
expect ( element . find ( 'li' ) . eq ( 1 ) . text ( ) ) . toBe ( '<<' ) ;
380
379
expect ( element . find ( 'li' ) . eq ( - 2 ) . text ( ) ) . toBe ( '>>' ) ;
381
380
} ) ;
382
381
383
- it ( 'changes "first" & "last" text from attribute variables ' , function ( ) {
382
+ it ( 'changes "first" & "last" text from interpolated attributes ' , function ( ) {
384
383
$rootScope . myfirstText = '<<<' ;
385
384
$rootScope . mylastText = '>>>' ;
386
- element = $compile ( '<pagination boundary-links="true" first-text="myfirstText" last-text="mylastText" num-pages="numPages" current-page="currentPage"></pagination>' ) ( $rootScope ) ;
385
+ element = $compile ( '<pagination boundary-links="true" first-text="{{ myfirstText}} " last-text="{{ mylastText}} " num-pages="numPages" current-page="currentPage"></pagination>' ) ( $rootScope ) ;
387
386
$rootScope . $digest ( ) ;
388
387
389
388
expect ( element . find ( 'li' ) . eq ( 0 ) . text ( ) ) . toBe ( '<<<' ) ;
390
389
expect ( element . find ( 'li' ) . eq ( - 1 ) . text ( ) ) . toBe ( '>>>' ) ;
391
390
} ) ;
392
391
393
- it ( 'changes "previous" & "next" text from attribute variables ' , function ( ) {
392
+ it ( 'changes "previous" & "next" text from interpolated attributes ' , function ( ) {
394
393
$rootScope . previousText = '<<' ;
395
394
$rootScope . nextText = '>>' ;
396
- element = $compile ( '<pagination boundary-links="true" previous-text="previousText" next-text="nextText" num-pages="numPages" current-page="currentPage"></pagination>' ) ( $rootScope ) ;
395
+ element = $compile ( '<pagination boundary-links="true" previous-text="{{ previousText}} " next-text="{{ nextText}} " num-pages="numPages" current-page="currentPage"></pagination>' ) ( $rootScope ) ;
397
396
$rootScope . $digest ( ) ;
398
397
399
398
expect ( element . find ( 'li' ) . eq ( 1 ) . text ( ) ) . toBe ( '<<' ) ;
@@ -461,7 +460,6 @@ describe('pagination directive with just number links', function () {
461
460
expect ( $rootScope . currentPage ) . toBe ( 2 ) ;
462
461
} ) ;
463
462
464
-
465
463
it ( 'executes the onSelectPage expression when the current page changes' , function ( ) {
466
464
$rootScope . selectPageHandler = jasmine . createSpy ( 'selectPageHandler' ) ;
467
465
element = $compile ( '<pagination direction-links="false" num-pages="numPages" current-page="currentPage" on-select-page="selectPageHandler(page)"></pagination>' ) ( $rootScope ) ;
@@ -541,11 +539,11 @@ describe('pagination directive with first, last & number links', function () {
541
539
$rootScope = _$rootScope_ ;
542
540
$rootScope . numPages = 5 ;
543
541
$rootScope . currentPage = 3 ;
544
- element = $compile ( '<pagination boundary-links="true" direction-links="false" num-pages="numPages" current-page="currentPage"></pagination>' ) ( $rootScope ) ;
542
+ $rootScope . directions = false ;
543
+ element = $compile ( '<pagination boundary-links="true" direction-links="directions" num-pages="numPages" current-page="currentPage"></pagination>' ) ( $rootScope ) ;
545
544
$rootScope . $digest ( ) ;
546
545
} ) ) ;
547
546
548
-
549
547
it ( 'contains one ul and num-pages + 2 li elements' , function ( ) {
550
548
expect ( element . find ( 'ul' ) . length ) . toBe ( 1 ) ;
551
549
expect ( element . find ( 'li' ) . length ) . toBe ( 7 ) ;
@@ -555,7 +553,6 @@ describe('pagination directive with first, last & number links', function () {
555
553
expect ( element . find ( 'li' ) . eq ( - 1 ) . text ( ) ) . toBe ( 'Last' ) ;
556
554
} ) ;
557
555
558
-
559
556
it ( 'disables the "first" & activates "1" link if current-page is 1' , function ( ) {
560
557
$rootScope . currentPage = 1 ;
561
558
$rootScope . $digest ( ) ;
@@ -572,7 +569,6 @@ describe('pagination directive with first, last & number links', function () {
572
569
expect ( element . find ( 'li' ) . eq ( - 1 ) . hasClass ( 'disabled' ) ) . toBe ( true ) ;
573
570
} ) ;
574
571
575
-
576
572
it ( 'changes currentPage if the "first" link is clicked' , function ( ) {
577
573
var first = element . find ( 'li' ) . eq ( 0 ) . find ( 'a' ) . eq ( 0 ) ;
578
574
first . click ( ) ;
@@ -598,7 +594,7 @@ describe('pagination bypass configuration from attributes', function () {
598
594
$rootScope = _$rootScope_ ;
599
595
$rootScope . numPages = 5 ;
600
596
$rootScope . currentPage = 3 ;
601
- element = $compile ( '<pagination boundary-links="true" first-text="\'<<\' " previous-text="\'<\' " next-text="\'>\' " last-text="\'>>\' " num-pages="numPages" current-page="currentPage"></pagination>' ) ( $rootScope ) ;
597
+ element = $compile ( '<pagination boundary-links="true" first-text="<< " previous-text="< " next-text="> " last-text=">> " num-pages="numPages" current-page="currentPage"></pagination>' ) ( $rootScope ) ;
602
598
$rootScope . $digest ( ) ;
603
599
} ) ) ;
604
600
0 commit comments