File tree Expand file tree Collapse file tree 2 files changed +2
-35
lines changed
Expand file tree Collapse file tree 2 files changed +2
-35
lines changed Original file line number Diff line number Diff line change 8282</template >
8383
8484<script >
85- import elementResizeDetectorMaker from ' element-resize-detector'
8685 import CLink from ' ../Link/CLink'
8786
8887 export default {
140139 lastButtonHtml: {
141140 type: String ,
142141 default: ' »'
143- },
144- responsive: [Boolean , Object ]
145- },
146- data () {
147- return {
148- minifiedSize: null ,
149- erd: elementResizeDetectorMaker ()
150142 }
151143 },
152144 watch: {
159151 }
160152 }
161153 },
162- mounted () {
163- if (this .responsive ) {
164- this .erd .listenTo (this .$el , this .onWrapperResize )
165- }
166- },
167154 computed: {
168- dims () {
169- return this .size === ' sm' ? ' sm' : this .minifiedSize || this .size
170- },
171155 backArrowsClasses () {
172156 return [' page-item' , { ' disabled' : this .activePage === 1 }]
173157 },
174158 nextArrowsClasses () {
175159 return [' page-item' , { ' disabled' : this .activePage === this .pages }]
176160 },
177161 computedClasses () {
178- return ` pagination pagination-${ this .dims } justify-content-${ this .align } `
162+ return ` pagination pagination-${ this .size } justify-content-${ this .align } `
179163 },
180164 showDots () {
181165 return this .dots && this .limit > 4 && this .limit < this .pages
215199 }
216200 },
217201 methods: {
218- onWrapperResize (el ) {
219- const md = this .responsive .md || 600
220- const sm = this .responsive .sm || 400
221- const wrapper = el .clientWidth
222- this .minifiedSize = wrapper > md ? null : wrapper > sm ? ' md' : ' sm'
223- },
224202 setPage (number ) {
225203 if (number !== this .activePage ) {
226204 this .$emit (' update:activePage' , number)
Original file line number Diff line number Diff line change @@ -12,8 +12,7 @@ const customWrapper = mount(Component, {
1212 limit : 7 ,
1313 dots : false ,
1414 arrows : false ,
15- doubleArrows : false ,
16- responsive : true
15+ doubleArrows : false
1716 }
1817} )
1918
@@ -39,14 +38,4 @@ describe(ComponentName, () => {
3938 links . at ( 4 ) . trigger ( 'click' )
4039 expect ( defaultWrapper . emitted ( ) [ 'update:activePage' ] ) . toBeTruthy ( )
4140 } )
42- it ( 'correctly change size on wrapper resize when responsive' , ( ) => {
43- customWrapper . vm . onWrapperResize ( { clientWidth : 700 } )
44- expect ( customWrapper . vm . dims ) . toBe ( 'lg' )
45-
46- customWrapper . vm . onWrapperResize ( { clientWidth : 500 } )
47- expect ( customWrapper . vm . dims ) . toBe ( 'md' )
48-
49- customWrapper . vm . onWrapperResize ( { clientWidth : 300 } )
50- expect ( customWrapper . vm . dims ) . toBe ( 'sm' )
51- } )
5241} )
You can’t perform that action at this time.
0 commit comments