+ components: { Paginate, PaginateLinks },
+ data: {
+ langs: LANGS,
+ paginate: { langs: { list: [], page: 0 } },
+ },
+ template: `
`,
- data: {
- langs: LANGS,
- paginate: {langs: { list: [], page: 0 }}
- },
- components: { Paginate, PaginateLinks }
- }).$mount()
- })
+ }).$mount();
+ });
- it('can show step links for limited links', (done) => {
+ it('can show step links for limited links', done => {
Vue.nextTick(() => {
- expect(vm.$el.querySelector('.paginate-links').innerHTML).to.equal([
- '
'
- ].join(''))
- done()
- })
- })
+ expect(vm.$el.querySelector('.paginate-links').innerHTML).to.equal(
+ [
+ '
',
+ ].join('')
+ );
+ done();
+ });
+ });
- it('removes disabled class from left arrow if not on first page', (done) => {
- vm.paginate.langs.page++
+ it('removes disabled class from left arrow if not on first page', done => {
+ vm.paginate.langs.page += 1;
Vue.nextTick(() => {
- expect(vm.$el.querySelector('.paginate-links').innerHTML).to.equal([
- '
'
- ].join(''))
- done()
- })
- })
+ expect(vm.$el.querySelector('.paginate-links').innerHTML).to.equal(
+ [
+ '
',
+ ].join('')
+ );
+ done();
+ });
+ });
- it('makes right arrow disabled if it is on last page', (done) => {
- vm.paginate.langs.page = 7
+ it('makes right arrow disabled if it is on last page', done => {
+ vm.paginate.langs.page = 7;
Vue.nextTick(() => {
- expect(vm.$el.querySelector('.paginate-links').innerHTML).to.equal([
- '
'
- ].join(''))
- done()
- })
- })
+ expect(vm.$el.querySelector('.paginate-links').innerHTML).to.equal(
+ [
+ '
',
+ ].join('')
+ );
+ done();
+ });
+ });
- it('customizes the step links', (done) => {
+ it('customizes the step links', done => {
vm = new Vue({
- template:
- `
+ components: { Paginate, PaginateLinks },
+ data: {
+ langs: LANGS,
+ paginate: { langs: { list: [], page: 0 } },
+ },
+ template: `
`,
- data: {
- langs: LANGS,
- paginate: {langs: { list: [], page: 0 }}
- },
- components: { Paginate, PaginateLinks }
- }).$mount()
+ }).$mount();
Vue.nextTick(() => {
- expect(vm.$el.querySelector('.paginate-links').innerHTML).to.equal([
- '
P',
- '
1',
- '
2',
- '
…',
- '
8',
- '
N'
- ].join(''))
- done()
- })
- })
-
- })
- })
+ expect(vm.$el.querySelector('.paginate-links').innerHTML).to.equal(
+ [
+ '
P',
+ '
1',
+ '
2',
+ '
…',
+ '
8',
+ '
N',
+ ].join('')
+ );
+ done();
+ });
+ });
+ });
+ });
describe('all types', () => {
- it('can be hidden if it contains a single page', (done) => {
+ it('can be hidden if it contains a single page', done => {
vm = new Vue({
- template:
- `
`,
+ components: { Paginate, PaginateLinks },
data: {
langs: LANGS,
- paginate: {langs: { list: [], page: 0 }}
+ paginate: { langs: { list: [], page: 0 } },
},
- components: { Paginate, PaginateLinks }
- }).$mount()
+ template: `
`,
+ }).$mount();
Vue.nextTick(() => {
- expect(vm.$el.querySelector('.paginate-links')).to.be.null
- done()
- })
- })
+ expect(vm.$el.querySelector('.paginate-links')).to.be.null;
+ done();
+ });
+ });
- it('should not be hidden if it contains a single page and hide-single-page=false', (done) => {
+ it('should not be hidden if it contains a single page and hide-single-page=false', done => {
vm = new Vue({
- template:
- `
`,
+ components: { Paginate, PaginateLinks },
data: {
langs: LANGS,
- paginate: {langs: { list: [], page: 0 }}
+ paginate: { langs: { list: [], page: 0 } },
},
- components: { Paginate, PaginateLinks }
- }).$mount()
+ template: `
`,
+ }).$mount();
Vue.nextTick(() => {
- expect(vm.$el.querySelector('.paginate-links')).to.be.not.null
- done()
- })
- })
- })
-
-})
+ expect(vm.$el.querySelector('.paginate-links')).to.be.not.null;
+ done();
+ });
+ });
+ });
+});
diff --git a/test/paginateDataGenerator.js b/test/paginateDataGenerator.js
index 3e6fa07..3fe7cfe 100644
--- a/test/paginateDataGenerator.js
+++ b/test/paginateDataGenerator.js
@@ -1,16 +1,17 @@
-import pdg from '../src/util/paginateDataGenerator'
+/* globals describe, it, expect */
+import pdg from '../src/util/paginateDataGenerator';
describe('PaginateDataGenerator', () => {
it('converts an array of list names into a valid paginate data object', () => {
expect(pdg(['langs', 'names'])).to.deep.equal({
langs: {
list: [],
- page: 0
+ page: 0,
},
names: {
list: [],
- page: 0
- }
- })
- })
-})
+ page: 0,
+ },
+ });
+ });
+});
diff --git a/webpack.config.js b/webpack.config.js
index 400ce64..1ca8539 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,8 +1,7 @@
-const path = require('path')
-const webpack = require('webpack')
+const path = require('path');
+const webpack = require('webpack');
module.exports = {
-
devtool: 'inline-source-map',
entry: path.join(__dirname, '/examples/main.js'),
@@ -10,7 +9,7 @@ module.exports = {
output: {
path: path.join(__dirname, '/examples/__build__'),
filename: 'app.js',
- publicPath: '/examples/__build__/'
+ publicPath: '/examples/__build__/',
},
module: {
@@ -18,40 +17,41 @@ module.exports = {
{
test: /\.js$/,
exclude: /node_modules/,
- loader: 'babel-loader'
+ loader: 'babel-loader',
},
{
test: /\.vue$/,
loader: 'vue',
- }
- ]
+ },
+ ],
},
vue: {
loaders: {
scss: 'vue-style-loader!css-loader!sass-loader', //