File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -25,17 +25,21 @@ module.exports = {
25
25
template : '<ul class="pagination" v-if="data.total > data.per_page">\
26
26
<li class="page-item pagination-prev-nav" v-if="data.prev_page_url">\
27
27
<a class="page-link" href="#" aria-label="Previous" @click.prevent="selectPage(--data.current_page)">\
28
+ <slot name="prev-nav">\
28
29
<span aria-hidden="true">«</span>\
29
30
<span class="sr-only">Previous</span>\
31
+ </slot>\
30
32
</a>\
31
33
</li>\
32
34
<li class="page-item pagination-page-nav" v-for="n in getPages()" :class="{ \'active\': n == data.current_page }">\
33
35
<a class="page-link" href="#" @click.prevent="selectPage(n)">{{ n }}</a>\
34
36
</li>\
35
37
<li class="page-item pagination-next-nav" v-if="data.next_page_url">\
36
38
<a class="page-link" href="#" aria-label="Next" @click.prevent="selectPage(++data.current_page)">\
39
+ <slot name="next-nav">\
37
40
<span aria-hidden="true">»</span>\
38
41
<span class="sr-only">Next</span>\
42
+ </slot>\
39
43
</a>\
40
44
</li>\
41
45
</ul>' ,
Original file line number Diff line number Diff line change @@ -99,4 +99,17 @@ describe('LaravelVuePagination', function() {
99
99
100
100
vm . selectPage ( 2 ) ;
101
101
} ) ;
102
+
103
+ it ( 'has correct DOM structure when using slots' , function ( ) {
104
+ const wrapper = mount ( LaravelVuePagination , {
105
+ propsData : { data : exampleData } ,
106
+ slots : {
107
+ 'prev-nav' : '<span class="custom-prev-nav">Previous</span>' ,
108
+ 'next-nav' : '<span>Next</span>'
109
+ }
110
+ } ) ;
111
+
112
+ expect ( wrapper . html ( ) ) . toContain ( '<span class="custom-prev-nav">Previous</span>' ) ;
113
+ expect ( wrapper . html ( ) ) . toContain ( '<span>Next</span>' ) ;
114
+ } ) ;
102
115
} ) ;
You can’t perform that action at this time.
0 commit comments