Skip to content

Commit bef0a77

Browse files
committed
Fix stubs test
1 parent 338d9df commit bef0a77

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/__tests__/components/Stubs.vue

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
<template>
2-
<form>
3-
<label for="search"> <FontAwesomeIcon icon="search" /> Search </label>
4-
<input id="search" type="text" name="search" />
5-
<VButton text="Search now" />
6-
</form>
2+
<directive />
73
</template>
84

95
<script>
10-
import VButton from './Button'
6+
import Directive from './Directive'
117
128
export default {
13-
name: 'SearchForm',
14-
components: { VButton }
9+
name: 'Stubs',
10+
11+
components: {
12+
Directive,
13+
},
1514
}
1615
</script>

src/__tests__/stubs.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@ import '@testing-library/jest-dom'
33
import Stubs from './components/Stubs'
44

55
test('Form contains search button', () => {
6+
const DirectiveMock = {
7+
template: '<p>fake template</p>',
8+
}
9+
610
const {getByText} = render(Stubs, {
7-
stubs: ['FontAwesomeIcon'],
11+
global: {
12+
stubs: {
13+
directive: DirectiveMock,
14+
},
15+
},
816
})
17+
918
expect(getByText('Search now')).toBeInTheDocument()
1019
})

0 commit comments

Comments
 (0)