Skip to content

Commit

Permalink
pagination dropdown fix for view all
Browse files Browse the repository at this point in the history
  • Loading branch information
1rosehip committed Oct 12, 2016
1 parent b17ac31 commit 5000d17
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 12 deletions.
8 changes: 4 additions & 4 deletions dist/js/jplist.pagination-bundle.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/addons/pagination-bundle/js/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"build/closure/google-closure-compiler/externs/jquery-1.7.externs.js",
"build/closure/google-closure-compiler/externs/jplist.addons.externs.js"
],
"version": 26
"version": 27
}
5 changes: 2 additions & 3 deletions src/addons/pagination-bundle/js/dropdown/dropdown-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
* @param {boolean} restoredFromStorage - is status restored from storage
*/
var setStatus = function(context, status, restoredFromStorage){

var $li
,$liList
,itemsPerPageNumber;
Expand All @@ -165,8 +165,7 @@
}
}

if(jQuery.isNumeric(itemsPerPageNumber)){

if(jQuery.isNumeric(itemsPerPageNumber) || itemsPerPageNumber === 'all'){

//get li list
$liList = context.$control.find('li');
Expand Down
2 changes: 1 addition & 1 deletion src/addons/pagination-bundle/js/dropdown/select-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
}
}

if(jQuery.isNumeric(itemsPerPageNumber)) {
if(jQuery.isNumeric(itemsPerPageNumber) || itemsPerPageNumber === 'all') {

$option = context.$control.find('option[data-number="' + itemsPerPageNumber + '"]');

Expand Down
100 changes: 98 additions & 2 deletions test/selenium-tests/specs/4-pagination-items-per-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ describe('click on page #3 (top)', function() {
var boxes = browser.elements('//div[@class="list-item box"]');
expect(boxes.value.length).toBe(5);
});

it('top dropdown should have all text', function (done) {

expect(browser.getText('(//div[@class="jplist-dd-panel"])[1]')).toBe('5 per page');
browser.call(done);
});

it('bottom dropdown should have all text', function (done) {

expect(browser.getText('(//div[@class="jplist-dd-panel"])[2]')).toBe('5 per page');
browser.call(done);
});
});

describe('click on the "next" button (top)', function() {
Expand Down Expand Up @@ -239,6 +251,18 @@ describe('click on page #3 (bottom)', function() {
var boxes = browser.elements('//div[@class="list-item box"]');
expect(boxes.value.length).toBe(5);
});

it('top dropdown should have all text', function (done) {

expect(browser.getText('(//div[@class="jplist-dd-panel"])[1]')).toBe('5 per page');
browser.call(done);
});

it('bottom dropdown should have all text', function (done) {

expect(browser.getText('(//div[@class="jplist-dd-panel"])[2]')).toBe('5 per page');
browser.call(done);
});
});

describe('click on the "next" button (bottom)', function() {
Expand Down Expand Up @@ -458,6 +482,18 @@ describe('select 3 items per page (top)', function() {
var boxes = browser.elements('//div[@class="list-item box"]');
expect(boxes.value.length).toBe(3);
});

it('top dropdown should have all text', function (done) {

expect(browser.getText('(//div[@class="jplist-dd-panel"])[1]')).toBe('3 per page');
browser.call(done);
});

it('bottom dropdown should have all text', function (done) {

expect(browser.getText('(//div[@class="jplist-dd-panel"])[2]')).toBe('3 per page');
browser.call(done);
});
});

describe('select 3 items per page and click on page #4 (top)', function() {
Expand Down Expand Up @@ -501,7 +537,7 @@ describe('select 3 items per page and click on page #4 (top)', function() {
});
});

describe('select 3 items per page and click on tje "next" page (top)', function() {
describe('select 3 items per page and click on the "next" page (top)', function() {

beforeAll(function(done){

Expand Down Expand Up @@ -542,7 +578,7 @@ describe('select 3 items per page and click on tje "next" page (top)', function(
});
});

describe('select 3 items per page and click on tje "last" page (top)', function() {
describe('select 3 items per page and click on the "last" page (top)', function() {

beforeAll(function(done){

Expand Down Expand Up @@ -605,6 +641,18 @@ describe('select 3 items per page (bottom)', function() {
var boxes = browser.elements('//div[@class="list-item box"]');
expect(boxes.value.length).toBe(3);
});

it('top dropdown should have all text', function (done) {

expect(browser.getText('(//div[@class="jplist-dd-panel"])[1]')).toBe('3 per page');
browser.call(done);
});

it('bottom dropdown should have all text', function (done) {

expect(browser.getText('(//div[@class="jplist-dd-panel"])[2]')).toBe('3 per page');
browser.call(done);
});
});


Expand All @@ -630,6 +678,18 @@ describe('select 10 items per page (top)', function() {
var boxes = browser.elements('//div[@class="list-item box"]');
expect(boxes.value.length).toBe(10);
});

it('top dropdown should have all text', function (done) {

expect(browser.getText('(//div[@class="jplist-dd-panel"])[1]')).toBe('10 per page');
browser.call(done);
});

it('bottom dropdown should have all text', function (done) {

expect(browser.getText('(//div[@class="jplist-dd-panel"])[2]')).toBe('10 per page');
browser.call(done);
});
});

// ----------------- 10 items per page BOTTOM ------------------
Expand All @@ -654,6 +714,18 @@ describe('select 10 items per page (bottom)', function() {
var boxes = browser.elements('//div[@class="list-item box"]');
expect(boxes.value.length).toBe(10);
});

it('top dropdown should have all text', function (done) {

expect(browser.getText('(//div[@class="jplist-dd-panel"])[1]')).toBe('10 per page');
browser.call(done);
});

it('bottom dropdown should have all text', function (done) {

expect(browser.getText('(//div[@class="jplist-dd-panel"])[2]')).toBe('10 per page');
browser.call(done);
});
});


Expand All @@ -680,6 +752,18 @@ describe('select all items per page (top)', function() {
var boxes = browser.elements('//div[@class="list-item box"]');
expect(boxes.value.length).toBe(33);
});

it('top dropdown should have all text', function (done) {

expect(browser.getText('(//div[@class="jplist-dd-panel"])[1]')).toBe('view all');
browser.call(done);
});

it('bottom dropdown should have all text', function (done) {

expect(browser.getText('(//div[@class="jplist-dd-panel"])[2]')).toBe('view all');
browser.call(done);
});
});

// ----------------- All items BOTTOM ------------------
Expand All @@ -704,5 +788,17 @@ describe('select all items per page (bottom)', function() {
var boxes = browser.elements('//div[@class="list-item box"]');
expect(boxes.value.length).toBe(33);
});

it('top dropdown should have all text', function (done) {

expect(browser.getText('(//div[@class="jplist-dd-panel"])[1]')).toBe('view all');
browser.call(done);
});

it('bottom dropdown should have all text', function (done) {

expect(browser.getText('(//div[@class="jplist-dd-panel"])[2]')).toBe('view all');
browser.call(done);
});
});

2 changes: 1 addition & 1 deletion test/selenium-tests/wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exports.config = {

//wdio ./test/selenium-tests/wdio.conf.js --suite=temp
temp: [
'./test/selenium-tests/specs/5-filter-dropdown-bootstrap.js'
'./test/selenium-tests/specs/4-pagination-items-per-page.js'
]

//wdio ./test/selenium-tests/wdio.conf.js --suite=api
Expand Down

0 comments on commit 5000d17

Please sign in to comment.