Skip to content

Commit

Permalink
Merge pull request #13 from Callum Macrae
Browse files Browse the repository at this point in the history
  • Loading branch information
TahaSh committed Sep 3, 2016
2 parents be1f74d + 07f2c66 commit b582c5c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
5 changes: 3 additions & 2 deletions dist/vue-paginate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-paginate v2.1.0
* vue-paginate v2.1.2
* (c) 2016 Taha Shashtari
* Released under the MIT License.
*/
Expand Down Expand Up @@ -205,7 +205,7 @@
}, {
key: 'initialOfLastNav',
value: function initialOfLastNav() {
var numberOfNavs = ~ ~(this.list.numberOfPages / this.limit);
var numberOfNavs = ~~(this.list.numberOfPages / this.limit);
var rest = this.list.numberOfPages - this.limit * numberOfNavs;

rest = rest <= 1 ? rest + this.limit : rest;
Expand Down Expand Up @@ -262,6 +262,7 @@
// Update the original list when the user changes the full list.
vm.$watch('full' + utils.capitalize(this.listName), function (newVal, oldVal) {
_this.originalList = newVal;
_this.setNumberOfPages(_this.originalList.length);
vm['refresh' + utils.capitalize(_this.listName) + 'Page']();
});

Expand Down
4 changes: 2 additions & 2 deletions dist/vue-paginate.min.js

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

Binary file modified dist/vue-paginate.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-paginate",
"version": "2.1.1",
"version": "2.1.2",
"description": "A simple vue.js plugin to paginate data",
"main": "dist/vue-paginate.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions src/paginate.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
// Update the original list when the user changes the full list.
vm.$watch('full' + utils.capitalize(this.listName), (newVal, oldVal) => {
this.originalList = newVal;
this.setNumberOfPages(this.originalList.length);
vm['refresh' + utils.capitalize(this.listName) + 'Page']();
});

Expand Down
16 changes: 16 additions & 0 deletions test/functional/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,22 @@ describe('Vue-Paginate', () => {

vm.$data.limitedLangsLinks.should.eql([1, 2, 3, 4, 5, 6, 7]);
});

it('updates the links when the list is updated', (done) => {
vm = new Vue({
template: '<div v-paginate:1="langs" limit="6">Hello</div>',
data: {
langs: ['PHP']
}
}).$mount();

vm.$data.fullLangs = ['PHP', 'JavaScript', 'HTML', 'CSS', 'Ruby', 'Python', 'Erlang'];

Vue.nextTick(() => {
vm.$data.limitedLangsLinks.should.eql([1, 2, 3, 4, 5, 6, 7]);
done();
});
});
});

describe('Dynamic perPage', () => {
Expand Down

0 comments on commit b582c5c

Please sign in to comment.