Skip to content

Commit

Permalink
chore: add repro
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiller1990 committed Feb 7, 2022
1 parent 8b5d683 commit caabd06
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/components/LastUpdated.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>
<div class="last-updated" v-if="when">
Last update: <span>{{ when }}</span>
</div>
</template>

<script>
export default {
name: "last-updated",
props: ["when"]
}
</script>
17 changes: 17 additions & 0 deletions tests/unmount.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineComponent } from 'vue'
import LastUpdated from './components/LastUpdated.vue'

import { mount } from '../src'

Expand Down Expand Up @@ -41,4 +42,20 @@ describe('Unmount', () => {
wrapper.unmount()
expect(errorHandler).not.toHaveBeenCalled()
})

it("The LastUpdated component renders the 'when' property", async () => {
const wrapper = mount(LastUpdated, { props: { when: 'today' } })

await wrapper.vm.$nextTick()
expect(wrapper.html()).toContain('<span>today</span>')
wrapper.unmount()
})

it("The LastUpdated component doesn't render when 'when' is undefined", async () => {
const wrapper = mount(LastUpdated, { props: { when: undefined } })

await wrapper.vm.$nextTick()
expect(wrapper.html()).not.toContain('<span>today</span>')
wrapper.unmount()
})
})

0 comments on commit caabd06

Please sign in to comment.