🌐 AI搜索 & 代理 主页
Skip to content

Commit b4a1cfa

Browse files
authored
Merge branch 'dev' into fix-tooltip-hide-when-title-empty
2 parents 1553f11 + d673e31 commit b4a1cfa

File tree

4 files changed

+155
-146
lines changed

4 files changed

+155
-146
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
"@nuxtjs/pwa": "^3.0.1",
111111
"@nuxtjs/robots": "^2.4.2",
112112
"@nuxtjs/sitemap": "^2.4.0",
113-
"@testing-library/jest-dom": "^5.11.3",
113+
"@testing-library/jest-dom": "^5.11.4",
114114
"@vue/test-utils": "^1.0.4",
115115
"autoprefixer": "^9.8.6",
116116
"babel-core": "^7.0.0-bridge.0",
@@ -142,7 +142,7 @@
142142
"html-loader": "^1.2.1",
143143
"husky": "^4.2.5",
144144
"improved-yarn-audit": "^2.3.1",
145-
"jest": "^26.4.1",
145+
"jest": "^26.4.2",
146146
"lint-staged": "^10.2.11",
147147
"loader-utils": "^2.0.0",
148148
"lodash": "^4.17.20",
@@ -152,7 +152,7 @@
152152
"postcss-cli": "^7.1.1",
153153
"prettier": "1.14.3",
154154
"require-context": "^1.1.0",
155-
"rollup": "^2.26.4",
155+
"rollup": "^2.26.5",
156156
"rollup-plugin-babel": "^4.4.0",
157157
"rollup-plugin-commonjs": "^10.1.0",
158158
"rollup-plugin-node-resolve": "^5.2.0",

src/components/pagination/pagination.spec.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,25 @@ describe('pagination', () => {
374374
wrapper.destroy()
375375
})
376376

377+
it('has correct number of links when `hide-ellipsis` is enabled', async () => {
378+
const wrapper = mount(BPagination, {
379+
propsData: {
380+
hideEllipsis: true,
381+
totalRows: 100,
382+
perPage: 10,
383+
value: 1
384+
}
385+
})
386+
expect(wrapper.element.tagName).toBe('UL')
387+
expect(wrapper.findAll('li').length).toBe(9)
388+
389+
await wrapper.setProps({ value: 5 })
390+
await waitNT(wrapper.vm)
391+
expect(wrapper.findAll('li').length).toBe(9)
392+
393+
wrapper.destroy()
394+
})
395+
377396
it('has attribute aria-controls on page links when prop aria-controls is set', async () => {
378397
const wrapper = mount(BPagination, {
379398
propsData: {

src/mixins/pagination.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,14 @@ export default {
223223
},
224224
paginationParams() {
225225
// Determine if we should show the the ellipsis
226-
const limit = this.localLimit
227-
const numberOfPages = this.localNumberOfPages
228-
const currentPage = this.computedCurrentPage
229-
const hideEllipsis = this.hideEllipsis
230-
const firstNumber = this.firstNumber
231-
const lastNumber = this.lastNumber
226+
const {
227+
localLimit: limit,
228+
localNumberOfPages: numberOfPages,
229+
computedCurrentPage: currentPage,
230+
hideEllipsis,
231+
firstNumber,
232+
lastNumber
233+
} = this
232234
let showFirstDots = false
233235
let showLastDots = false
234236
let numberOfLinks = limit
@@ -252,7 +254,7 @@ export default {
252254
} else {
253255
// We are somewhere in the middle of the page list
254256
if (limit > ELLIPSIS_THRESHOLD) {
255-
numberOfLinks = limit - 2
257+
numberOfLinks = limit - (hideEllipsis ? 0 : 2)
256258
showFirstDots = !!(!hideEllipsis || firstNumber)
257259
showLastDots = !!(!hideEllipsis || lastNumber)
258260
}

0 commit comments

Comments
 (0)