Skip to content

Commit

Permalink
feat(#429): add watch/fetch for DruxtBreadcrumb
Browse files Browse the repository at this point in the history
  • Loading branch information
Decipher committed Feb 3, 2022
1 parent 0436de4 commit af1c36e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/wet-foxes-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"druxt-breadcrumb": minor
---

feat(#429): Added watch for `home` and `path` to the DruxtBreadcrumb component.
8 changes: 8 additions & 0 deletions packages/breadcrumb/src/components/DruxtBreadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ export default {
*/
$route: async function() {
await this.$fetch()
},
home() {
this.$fetch()
},
path() {
this.$fetch()
}
},
Expand Down
14 changes: 14 additions & 0 deletions packages/breadcrumb/test/components/DruxtBreadcrumb.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,18 @@ describe('DruxtBreadcrumb', () => {
}],
})
})

test('watch - props $fetch', async () => {
const $fetch = jest.fn()
expect($fetch).toHaveBeenCalledTimes(0)

DruxtBreadcrumb.watch.$route.call({ $fetch })
expect($fetch).toHaveBeenCalledTimes(1)

DruxtBreadcrumb.watch.home.call({ $fetch })
expect($fetch).toHaveBeenCalledTimes(2)

DruxtBreadcrumb.watch.path.call({ $fetch })
expect($fetch).toHaveBeenCalledTimes(3)
})
})

0 comments on commit af1c36e

Please sign in to comment.