|
| 1 | +<?php |
| 2 | + |
| 3 | +use PowerComponents\LivewirePowerGrid\Components\SetUp\Footer; |
| 4 | + |
| 5 | +/*it('sets default perPage values', function () { |
| 6 | + $footer = new Footer(); |
| 7 | +
|
| 8 | + expect($footer->perPage)->toBe(10) |
| 9 | + ->and($footer->perPageValues)->toBe([10, 25, 50, 100, 0]); |
| 10 | +});*/ |
| 11 | + |
| 12 | +it('adds custom perPage value when not in default array', function () { |
| 13 | + $footer = new Footer(); |
| 14 | + $result = $footer->showPerPage(30); |
| 15 | + |
| 16 | + expect($result->perPage)->toBe(30) |
| 17 | + ->and($result->perPageValues)->toBe([10, 25, 30, 50, 100, 0]); |
| 18 | +}); |
| 19 | + |
| 20 | +it('accepts custom perPageValues', function () { |
| 21 | + $footer = new Footer(); |
| 22 | + $perPageValues = [5, 15, 30, 50]; |
| 23 | + $result = $footer->showPerPage(15, $perPageValues); |
| 24 | + |
| 25 | + expect($result->perPage)->toBe(15) |
| 26 | + ->and($result->perPageValues)->toBe([5, 15, 30, 50]); |
| 27 | +}); |
| 28 | + |
| 29 | +it('adds custom perPage value when not in custom perPageValues without zero', function () { |
| 30 | + $footer = new Footer(); |
| 31 | + $perPageValues = [5, 15, 50]; |
| 32 | + $result = $footer->showPerPage(30, $perPageValues); |
| 33 | + |
| 34 | + expect($result->perPage)->toBe(30) |
| 35 | + ->and($result->perPageValues)->toBe([5, 15, 30, 50]); |
| 36 | +}); |
| 37 | + |
| 38 | +it('adds custom perPage value when not in custom perPageValues with zero', function () { |
| 39 | + $footer = new Footer(); |
| 40 | + $perPageValues = [5, 15, 50, 0]; |
| 41 | + $result = $footer->showPerPage(30, $perPageValues); |
| 42 | + |
| 43 | + expect($result->perPage)->toBe(30) |
| 44 | + ->and($result->perPageValues)->toBe([5, 15, 30, 50, 0]); |
| 45 | +}); |
0 commit comments