Skip to content

Commit

Permalink
fix(VDataTable): footer.page-text slot not being used (#8509)
Browse files Browse the repository at this point in the history
closes #8120
  • Loading branch information
nekosaur authored and johnleider committed Aug 15, 2019
1 parent 0b4a970 commit 5f33175
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/vuetify/src/components/VDataTable/VDataTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,10 @@ export default VDataIterator.extend({
]

if (!this.hideDefaultFooter) {
children.push(this.$createElement(VDataFooter, data))
children.push(this.$createElement(VDataFooter, {
...data,
scopedSlots: getPrefixedScopedSlots('footer.', this.$scopedSlots),
}))
}

return children
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,4 +382,20 @@ describe('VDataTable.ts', () => {
page: 2,
}))
})

it('should render footer.page-text slot content', () => {
const wrapper = mountFunction({
propsData: {
headers: [],
items: [{}],
},
scopedSlots: {
'footer.page-text' ({ pageStart, pageStop }) {
return this.$createElement('div', [`foo ${pageStart} bar ${pageStop}`])
},
},
})

expect(wrapper.html()).toMatchSnapshot()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,104 @@ exports[`VDataTable.ts should render 1`] = `
</div>
`;
exports[`VDataTable.ts should render footer.page-text slot content 1`] = `
<div class="v-data-table theme--light">
<div class="v-data-table__wrapper">
<table>
<colgroup>
</colgroup>
<thead class="v-data-table-header">
<tr>
</tr>
</thead>
<tbody>
<tr>
</tr>
</tbody>
</table>
</div>
<div class="v-data-footer">
<div class="v-data-footer__select">
Rows per page:
<div class="v-input v-input--hide-details v-input--is-label-active v-input--is-dirty theme--light v-text-field v-select">
<div class="v-input__control">
<div role="button"
aria-haspopup="listbox"
aria-expanded="false"
aria-owns="list-347"
class="v-input__slot"
>
<div class="v-select__slot">
<div class="v-select__selections">
<div class="v-select__selection v-select__selection--comma">
10
</div>
<input aria-label="$vuetify.dataTable.itemsPerPageText"
id="input-347"
readonly="readonly"
type="text"
aria-readonly="true"
>
</div>
<div class="v-input__append-inner">
<div class="v-input__icon v-input__icon--append">
<i aria-hidden="true"
class="v-icon notranslate material-icons theme--light"
>
$vuetify.icons.dropdown
</i>
</div>
</div>
</div>
<div class="v-menu">
<div class="v-menu__content theme--light "
style="max-height: 304px; min-width: 0px; max-width: auto; top: 12px; left: 0px; transform-origin: top left; z-index: 0; display: none;"
>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="v-data-footer__pagination">
<div>
foo 1 bar 1
</div>
</div>
<div class="v-data-footer__icons-before">
<button type="button"
disabled="disabled"
class="v-btn v-btn--disabled v-btn--flat v-btn--icon v-btn--round v-btn--text theme--light v-size--default"
aria-label="Previous page"
>
<span class="v-btn__content">
<i aria-hidden="true"
class="v-icon notranslate material-icons theme--light"
>
$vuetify.icons.prev
</i>
</span>
</button>
</div>
<div class="v-data-footer__icons-after">
<button type="button"
disabled="disabled"
class="v-btn v-btn--disabled v-btn--flat v-btn--icon v-btn--round v-btn--text theme--light v-size--default"
aria-label="Next page"
>
<span class="v-btn__content">
<i aria-hidden="true"
class="v-icon notranslate material-icons theme--light"
>
$vuetify.icons.next
</i>
</span>
</button>
</div>
</div>
</div>
`;
exports[`VDataTable.ts should render loading state 1`] = `
<div class="v-data-table theme--light">
<div class="v-data-table__wrapper">
Expand Down

0 comments on commit 5f33175

Please sign in to comment.