diff --git a/.gitignore b/.gitignore index 3e20c5d..fb446ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea/ *.iml bower_components -node_modules \ No newline at end of file +node_modules +package-lock.json diff --git a/LICENSE b/LICENSE index 1b3a07d..704b37b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,13 +1,13 @@ -Copyright 2014-2015 © Eugene Simakin +Copyright 2014-2018 © Eugene Simakin -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and limitations under the License. diff --git a/README.md b/README.md index 2d39510..f32a507 100644 --- a/README.md +++ b/README.md @@ -23,4 +23,4 @@ For development use grunt build to make minified file. To use grunt install packages by using: npm install ## Demo and Docs -For more information see [docs on github pages](http://esimakin.github.io/twbs-pagination/) (not completed yet) \ No newline at end of file +For more information see [docs on github pages](http://esimakin.github.io/twbs-pagination/) (not completed yet) diff --git a/bower.json b/bower.json index 1726783..cba2827 100644 --- a/bower.json +++ b/bower.json @@ -1,8 +1,9 @@ { "name": "twbs-pagination", - "version": "1.4.1", + "version": "1.4.2", "homepage": "https://github.com/esimakin/twbs-pagination", "authors": [ + "Jose Cebellán ", "Eugene Simakin " ], "description": "jQuery simple pagination plugin for bootstrap-style webpages", diff --git a/examples/bootstrap-v3.html b/examples/bootstrap-v3.html new file mode 100644 index 0000000..01e936f --- /dev/null +++ b/examples/bootstrap-v3.html @@ -0,0 +1,31 @@ + + + + + jQuery Pagination plugin + + + + + + +
+ +
+ + + diff --git a/examples/bootstrap-v4.html b/examples/bootstrap-v4.html deleted file mode 100644 index 27e4214..0000000 --- a/examples/bootstrap-v4.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - jQuery Pagination plugin - - - - - - - -
- -
- - - \ No newline at end of file diff --git a/examples/index.html b/examples/index.html index 14d734b..7485a68 100644 --- a/examples/index.html +++ b/examples/index.html @@ -3,9 +3,9 @@ jQuery Pagination plugin - - - + + + @@ -28,4 +28,4 @@ }); - \ No newline at end of file + diff --git a/jquery.twbsPagination.js b/jquery.twbsPagination.js index 64ec6d8..b0bb46a 100644 --- a/jquery.twbsPagination.js +++ b/jquery.twbsPagination.js @@ -1,8 +1,8 @@ /*! - * jQuery pagination plugin v1.4.1 + * jQuery pagination plugin v1.4.2 * http://esimakin.github.io/twbs-pagination/ * - * Copyright 2014-2016, Eugene Simakin + * Copyright 2014-2018, Eugene Simakin * Released under Apache 2.0 license * http://apache.org/licenses/LICENSE-2.0.html */ @@ -332,6 +332,6 @@ return this; }; - $.fn.twbsPagination.version = "1.4.1"; + $.fn.twbsPagination.version = "1.4.2"; })(window.jQuery, window, document); diff --git a/package.json b/package.json index a7fb8bc..9eaac75 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "twbs-pagination", "nativeName": "jQuery Bootstrap Pagination", - "version": "1.4.1", + "version": "1.4.2", "homepage": "https://github.com/esimakin/twbs-pagination", "author": "Eugene Simakin ", "description": "jQuery simple pagination plugin for bootstrap-style webpages", @@ -10,11 +10,11 @@ "jquery": ">=1.7" }, "devDependencies": { - "grunt": "^1.0.1", - "grunt-cli": "~1.2.0", - "grunt-contrib-watch": "~1.0.0", - "grunt-contrib-uglify": "^2.0.0", - "load-grunt-tasks": "^3.1.0" + "grunt": "1.0.3", + "grunt-cli": "1.2.0", + "grunt-contrib-uglify": "3.3.0", + "grunt-contrib-watch": "1.1.0", + "load-grunt-tasks": "4.0.0" }, "repository": { "type": "git", diff --git a/tests/index.html b/tests/index.html index f4146d8..af20644 100644 --- a/tests/index.html +++ b/tests/index.html @@ -5,7 +5,6 @@ All tests - - + - \ No newline at end of file + diff --git a/tests/run-test-jquery-1.8.1.html b/tests/run-test-jquery-1.8.1.html deleted file mode 100644 index 315020c..0000000 --- a/tests/run-test-jquery-1.8.1.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - Tests - - - - - - - - - -
-
- - - - - - \ No newline at end of file diff --git a/tests/run-test-jquery-latest.html b/tests/run-test-jquery-latest.html index 35c7552..fd3778f 100644 --- a/tests/run-test-jquery-latest.html +++ b/tests/run-test-jquery-latest.html @@ -4,18 +4,17 @@ Tests - + - + + -
- - \ No newline at end of file + diff --git a/tests/test.js b/tests/test.js index cadf2f7..0d1dea5 100644 --- a/tests/test.js +++ b/tests/test.js @@ -6,75 +6,75 @@ elem.twbsPagination(opts); }; - QUnit.test("Test destroy called before initialization", function () { - ok(pag1.twbsPagination('destroy')); + QUnit.test("Test destroy called before initialization", function (assert) { + assert.ok(pag1.twbsPagination('destroy')); }); - QUnit.test("Test 'getPages' method (EVEN visible pages number)", function () { + QUnit.test("Test 'getPages' method (EVEN visible pages number)", function (assert) { destroyAndCreateWithOpts(pag1, { totalPages: 30 }); - deepEqual(pag1.twbsPagination('getPages', 1), {currentPage: 1, numeric: [1, 2, 3, 4, 5]}); - deepEqual(pag1.twbsPagination('getPages', 2), {currentPage: 2, numeric: [1, 2, 3, 4, 5]}); - deepEqual(pag1.twbsPagination('getPages', 3), {currentPage: 3, numeric: [1, 2, 3, 4, 5]}); + assert.deepEqual(pag1.twbsPagination('getPages', 1), {currentPage: 1, numeric: [1, 2, 3, 4, 5]}); + assert.deepEqual(pag1.twbsPagination('getPages', 2), {currentPage: 2, numeric: [1, 2, 3, 4, 5]}); + assert.deepEqual(pag1.twbsPagination('getPages', 3), {currentPage: 3, numeric: [1, 2, 3, 4, 5]}); - deepEqual(pag1.twbsPagination('getPages', 4), {currentPage: 4, numeric: [2, 3, 4, 5, 6]}); - deepEqual(pag1.twbsPagination('getPages', 5), {currentPage: 5, numeric: [3, 4, 5, 6, 7]}); - deepEqual(pag1.twbsPagination('getPages', 20), {currentPage: 20, numeric: [18, 19, 20, 21, 22]}); + assert.deepEqual(pag1.twbsPagination('getPages', 4), {currentPage: 4, numeric: [2, 3, 4, 5, 6]}); + assert.deepEqual(pag1.twbsPagination('getPages', 5), {currentPage: 5, numeric: [3, 4, 5, 6, 7]}); + assert.deepEqual(pag1.twbsPagination('getPages', 20), {currentPage: 20, numeric: [18, 19, 20, 21, 22]}); - deepEqual(pag1.twbsPagination('getPages', 27), {currentPage: 27, numeric: [25, 26, 27, 28, 29]}); - deepEqual(pag1.twbsPagination('getPages', 28), {currentPage: 28, numeric: [26, 27, 28, 29, 30]}); - deepEqual(pag1.twbsPagination('getPages', 29), {currentPage: 29, numeric: [26, 27, 28, 29, 30]}); - deepEqual(pag1.twbsPagination('getPages', 30), {currentPage: 30, numeric: [26, 27, 28, 29, 30]}); + assert.deepEqual(pag1.twbsPagination('getPages', 27), {currentPage: 27, numeric: [25, 26, 27, 28, 29]}); + assert.deepEqual(pag1.twbsPagination('getPages', 28), {currentPage: 28, numeric: [26, 27, 28, 29, 30]}); + assert.deepEqual(pag1.twbsPagination('getPages', 29), {currentPage: 29, numeric: [26, 27, 28, 29, 30]}); + assert.deepEqual(pag1.twbsPagination('getPages', 30), {currentPage: 30, numeric: [26, 27, 28, 29, 30]}); }); - QUnit.test("Test 'getPages' method (ODD visible pages number)", function () { + QUnit.test("Test 'getPages' method (ODD visible pages number)", function (assert) { destroyAndCreateWithOpts(pag1, { totalPages: 30, visiblePages: 6 }); - deepEqual(pag1.twbsPagination('getPages', 1), {currentPage: 1, numeric: [1, 2, 3, 4, 5, 6]}); - deepEqual(pag1.twbsPagination('getPages', 2), {currentPage: 2, numeric: [1, 2, 3, 4, 5, 6]}); - deepEqual(pag1.twbsPagination('getPages', 3), {currentPage: 3, numeric: [1, 2, 3, 4, 5, 6]}); + assert.deepEqual(pag1.twbsPagination('getPages', 1), {currentPage: 1, numeric: [1, 2, 3, 4, 5, 6]}); + assert.deepEqual(pag1.twbsPagination('getPages', 2), {currentPage: 2, numeric: [1, 2, 3, 4, 5, 6]}); + assert.deepEqual(pag1.twbsPagination('getPages', 3), {currentPage: 3, numeric: [1, 2, 3, 4, 5, 6]}); - deepEqual(pag1.twbsPagination('getPages', 4), {currentPage: 4, numeric: [2, 3, 4, 5, 6, 7]}); - deepEqual(pag1.twbsPagination('getPages', 5), {currentPage: 5, numeric: [3, 4, 5, 6, 7, 8]}); - deepEqual(pag1.twbsPagination('getPages', 20), {currentPage: 20, numeric: [18, 19, 20, 21, 22, 23]}); + assert.deepEqual(pag1.twbsPagination('getPages', 4), {currentPage: 4, numeric: [2, 3, 4, 5, 6, 7]}); + assert.deepEqual(pag1.twbsPagination('getPages', 5), {currentPage: 5, numeric: [3, 4, 5, 6, 7, 8]}); + assert.deepEqual(pag1.twbsPagination('getPages', 20), {currentPage: 20, numeric: [18, 19, 20, 21, 22, 23]}); - deepEqual(pag1.twbsPagination('getPages', 27), {currentPage: 27, numeric: [25, 26, 27, 28, 29, 30]}); - deepEqual(pag1.twbsPagination('getPages', 28), {currentPage: 28, numeric: [25, 26, 27, 28, 29, 30]}); - deepEqual(pag1.twbsPagination('getPages', 29), {currentPage: 29, numeric: [25, 26, 27, 28, 29, 30]}); - deepEqual(pag1.twbsPagination('getPages', 30), {currentPage: 30, numeric: [25, 26, 27, 28, 29, 30]}); + assert.deepEqual(pag1.twbsPagination('getPages', 27), {currentPage: 27, numeric: [25, 26, 27, 28, 29, 30]}); + assert.deepEqual(pag1.twbsPagination('getPages', 28), {currentPage: 28, numeric: [25, 26, 27, 28, 29, 30]}); + assert.deepEqual(pag1.twbsPagination('getPages', 29), {currentPage: 29, numeric: [25, 26, 27, 28, 29, 30]}); + assert.deepEqual(pag1.twbsPagination('getPages', 30), {currentPage: 30, numeric: [25, 26, 27, 28, 29, 30]}); }); - QUnit.test("Test 'getPages' method (total < visible)", function () { + QUnit.test("Test 'getPages' method (total < visible)", function (assert) { destroyAndCreateWithOpts(pag1, { totalPages: 3, visiblePages: 5 }); - deepEqual(pag1.twbsPagination('getPages', 1), {currentPage: 1, numeric: [1, 2, 3]}); - deepEqual(pag1.twbsPagination('getPages', 2), {currentPage: 2, numeric: [1, 2, 3]}); - deepEqual(pag1.twbsPagination('getPages', 3), {currentPage: 3, numeric: [1, 2, 3]}); + assert.deepEqual(pag1.twbsPagination('getPages', 1), {currentPage: 1, numeric: [1, 2, 3]}); + assert.deepEqual(pag1.twbsPagination('getPages', 2), {currentPage: 2, numeric: [1, 2, 3]}); + assert.deepEqual(pag1.twbsPagination('getPages', 3), {currentPage: 3, numeric: [1, 2, 3]}); }); - QUnit.test("Test classes appended for pagination", function () { + QUnit.test("Test classes appended for pagination", function (assert) { destroyAndCreateWithOpts(pag1, { totalPages: 3, visiblePages: 5 }); - equal(pag1.find('.page-item').length, 7); - equal(pag1.find('.next').length, 1); - equal(pag1.find('.prev').length, 1); - equal(pag1.find('.last').length, 1); - equal(pag1.find('.first').length, 1); - equal(pag1.find('.page-item.active').length, 1); - equal(pag1.find('.prev.disabled').length, 1); - equal(pag1.find('.first.disabled').length, 1); + assert.equal(pag1.find('.page-item').length, 7); + assert.equal(pag1.find('.next').length, 1); + assert.equal(pag1.find('.prev').length, 1); + assert.equal(pag1.find('.last').length, 1); + assert.equal(pag1.find('.first').length, 1); + assert.equal(pag1.find('.page-item.active').length, 1); + assert.equal(pag1.find('.prev.disabled').length, 1); + assert.equal(pag1.find('.first.disabled').length, 1); }); - QUnit.test("Test custom classes appended for pagination", function () { + QUnit.test("Test custom classes appended for pagination", function (assert) { destroyAndCreateWithOpts(pag1, { totalPages: 10, visiblePages: 5, @@ -86,28 +86,28 @@ activeClass: 'my-active-class', disabledClass: 'my-disabled-class' }); - equal(pag1.find('.my-page').length, 5); - equal(pag1.find('.my-next-page').length, 1); - equal(pag1.find('.my-prev-page').length, 1); - equal(pag1.find('.my-last-page').length, 1); - equal(pag1.find('.my-first-page').length, 1); - equal(pag1.find('.my-page.my-active-class').length, 1); - equal(pag1.find('.my-prev-page.my-disabled-class').length, 1); - equal(pag1.find('.my-first-page.my-disabled-class').length, 1); + assert.equal(pag1.find('.my-page').length, 5); + assert.equal(pag1.find('.my-next-page').length, 1); + assert.equal(pag1.find('.my-prev-page').length, 1); + assert.equal(pag1.find('.my-last-page').length, 1); + assert.equal(pag1.find('.my-first-page').length, 1); + assert.equal(pag1.find('.my-page.my-active-class').length, 1); + assert.equal(pag1.find('.my-prev-page.my-disabled-class').length, 1); + assert.equal(pag1.find('.my-first-page.my-disabled-class').length, 1); }); - QUnit.test("Test page numbers text", function () { + QUnit.test("Test page numbers text", function (assert) { destroyAndCreateWithOpts(pag1, { totalPages: 2 }); - equal(pag1.find('.page-item:eq(2)').text(), '1'); - equal(pag1.find('.next').text(), 'Next'); - equal(pag1.find('.prev').text(), 'Previous'); - equal(pag1.find('.first').text(), 'First'); - equal(pag1.find('.last').text(), 'Last'); + assert.equal(pag1.find('.page-item:eq(2)').text(), '1'); + assert.equal(pag1.find('.next').text(), 'Next'); + assert.equal(pag1.find('.prev').text(), 'Previous'); + assert.equal(pag1.find('.first').text(), 'First'); + assert.equal(pag1.find('.last').text(), 'Last'); }); - QUnit.test("Test custom texts", function () { + QUnit.test("Test custom texts", function (assert) { destroyAndCreateWithOpts(pag1, { totalPages: 2, page: '[{{page}}]', @@ -116,41 +116,40 @@ next: '>>', last: '(last)[{{total_pages}}]' }); - equal(pag1.find('.page-item:eq(2)').text(), '[1]'); - equal(pag1.find('.next').text(), '>>'); - equal(pag1.find('.prev').text(), '<<'); - equal(pag1.find('.first').text(), '(first)'); - equal(pag1.find('.last').text(), '(last)[2]'); + assert.equal(pag1.find('.page-item:eq(2)').text(), '[1]'); + assert.equal(pag1.find('.next').text(), '>>'); + assert.equal(pag1.find('.prev').text(), '<<'); + assert.equal(pag1.find('.first').text(), '(first)'); + assert.equal(pag1.find('.last').text(), '(last)[2]'); }); - QUnit.test("Test 'getPageFromQueryString' method", function () { + QUnit.test("Test 'getPageFromQueryString' method", function (assert) { destroyAndCreateWithOpts(pag1, {pageVariable: 'page'}); - equal(pag1.twbsPagination('getPageFromQueryString', '?page=1'), 1); - equal(pag1.twbsPagination('getPageFromQueryString', '?page='), null); - equal(pag1.twbsPagination('getPageFromQueryString', '?page'), null); - equal(pag1.twbsPagination('getPageFromQueryString', '?'), null); - equal(pag1.twbsPagination('getPageFromQueryString', ''), null) - ; - equal(pag1.twbsPagination('getPageFromQueryString', '?page=2'), 2); - equal(pag1.twbsPagination('getPageFromQueryString', '?page=3¶m=taram'), 3); - equal(pag1.twbsPagination('getPageFromQueryString', '?page=4¶m=test&opilki'), 4); - equal(pag1.twbsPagination('getPageFromQueryString', '?page=5¶m=test or not&opilki='), 5); - equal(pag1.twbsPagination('getPageFromQueryString', '?ID=1&keyWord=net&page=6'), 6); + assert.equal(pag1.twbsPagination('getPageFromQueryString', '?page=1'), 1); + assert.equal(pag1.twbsPagination('getPageFromQueryString', '?page='), null); + assert.equal(pag1.twbsPagination('getPageFromQueryString', '?page'), null); + assert.equal(pag1.twbsPagination('getPageFromQueryString', '?'), null); + assert.equal(pag1.twbsPagination('getPageFromQueryString', ''), null); + assert.equal(pag1.twbsPagination('getPageFromQueryString', '?page=2'), 2); + assert.equal(pag1.twbsPagination('getPageFromQueryString', '?page=3¶m=taram'), 3); + assert.equal(pag1.twbsPagination('getPageFromQueryString', '?page=4¶m=test&opilki'), 4); + assert.equal(pag1.twbsPagination('getPageFromQueryString', '?page=5¶m=test or not&opilki='), 5); + assert.equal(pag1.twbsPagination('getPageFromQueryString', '?ID=1&keyWord=net&page=6'), 6); }); - QUnit.test("Test 'generateQueryString' method", function () { + QUnit.test("Test 'generateQueryString' method", function (assert) { destroyAndCreateWithOpts(pag1, {pageVariable: 'page'}); - equal(pag1.twbsPagination('generateQueryString', 1, '?page=1'), '?page=1'); - equal(pag1.twbsPagination('generateQueryString', 1, '?page='), '?page=1'); - equal(pag1.twbsPagination('generateQueryString', 1, '?page'), '?page=1'); - equal(pag1.twbsPagination('generateQueryString', 1, '?'), ''); - equal(pag1.twbsPagination('generateQueryString', 1, ''), window.location.search); - - equal(pag1.twbsPagination('generateQueryString', 2, '?page=1'), '?page=2'); - equal(pag1.twbsPagination('generateQueryString', 3, '?page=2¶m=taram'), '?page=3¶m=taram'); - equal(pag1.twbsPagination('generateQueryString', 4, '?page=3¶m=test&opilki'), '?page=4¶m=test&opilki'); - equal(pag1.twbsPagination('generateQueryString', 5, '?page=4¶m=test or not&opilki='), '?page=5¶m=test or not&opilki='); - equal(pag1.twbsPagination('generateQueryString', 6, '?ID=1&keyWord=net&page=50'), '?ID=1&keyWord=net&page=6'); + assert.equal(pag1.twbsPagination('generateQueryString', 1, '?page=1'), '?page=1'); + assert.equal(pag1.twbsPagination('generateQueryString', 1, '?page='), '?page=1'); + assert.equal(pag1.twbsPagination('generateQueryString', 1, '?page'), '?page=1'); + assert.equal(pag1.twbsPagination('generateQueryString', 1, '?'), ''); + assert.equal(pag1.twbsPagination('generateQueryString', 1, ''), window.location.search); + + assert.equal(pag1.twbsPagination('generateQueryString', 2, '?page=1'), '?page=2'); + assert.equal(pag1.twbsPagination('generateQueryString', 3, '?page=2¶m=taram'), '?page=3¶m=taram'); + assert.equal(pag1.twbsPagination('generateQueryString', 4, '?page=3¶m=test&opilki'), '?page=4¶m=test&opilki'); + assert.equal(pag1.twbsPagination('generateQueryString', 5, '?page=4¶m=test or not&opilki='), '?page=5¶m=test or not&opilki='); + assert.equal(pag1.twbsPagination('generateQueryString', 6, '?ID=1&keyWord=net&page=50'), '?ID=1&keyWord=net&page=6'); }); QUnit.test("Test 'hideOnlyOnePage' option", function (assert) { @@ -419,4 +418,4 @@ ); $html.remove(); }); -})(window.jQuery); \ No newline at end of file +})(window.jQuery); diff --git a/twbs-pagination.jquery.json b/twbs-pagination.jquery.json index 8be9dca..7cb425e 100644 --- a/twbs-pagination.jquery.json +++ b/twbs-pagination.jquery.json @@ -1,6 +1,6 @@ { "name": "twbs-pagination", - "version": "1.4.1", + "version": "1.4.2", "title": "jQuery Bootstrap Pagination", "author": { "name": "Eugene Simakin", @@ -26,4 +26,4 @@ "demo": "http://esimakin.github.io/twbs-pagination/", "download": "https://github.com/esimakin/twbs-pagination/zipball/master", "bugs": "https://github.com/esimakin/twbs-pagination/issues" -} \ No newline at end of file +}