@@ -12,7 +12,6 @@ import LinksBlock from '@/components/ContentNode/LinksBlock.vue';
12
12
import { shallowMount } from '@vue/test-utils' ;
13
13
import { TopicSectionsStyle } from '@/constants/TopicSectionsStyle' ;
14
14
import TopicsLinkCardGrid from '@/components/DocumentationTopic/TopicsLinkCardGrid.vue' ;
15
- import TopicsLinkBlock from '@/components/DocumentationTopic/TopicsLinkBlock.vue' ;
16
15
17
16
const defaultProps = {
18
17
identifiers : [ 'foo' , 'bar' , 'baz' ] ,
@@ -29,7 +28,7 @@ const createWrapper = ({ propsData, ...others } = {}) => shallowMount(LinksBlock
29
28
...defaultProps ,
30
29
...propsData ,
31
30
} ,
32
- stubs : { TopicsLinkBlock : { props : [ 'topic' ] , template : '<div/>' } } ,
31
+ stubs : { TopicsLinkBlock : { props : [ 'topic' ] , template : '<div class="topics-link-block" />' } } ,
33
32
provide : {
34
33
store : {
35
34
state : { references } ,
@@ -51,14 +50,13 @@ describe('LinksBlock', () => {
51
50
it ( 'renders `TopicsLinkBlock` if `blockStyle` is a `list`' , ( ) => {
52
51
const wrapper = createWrapper ( {
53
52
propsData : {
54
- items : defaultProps . items ,
55
53
blockStyle : TopicSectionsStyle . list ,
56
54
} ,
57
55
} ) ;
58
56
expect ( wrapper . findComponent ( TopicsLinkCardGrid ) . exists ( ) ) . toBe ( false ) ;
59
57
expect ( wrapper . findComponent ( '.links-block' ) . exists ( ) ) . toBe ( true ) ;
60
58
// they are two, because one does not have a reference object
61
- const linkBlocks = wrapper . findAll ( TopicsLinkBlock ) ;
59
+ const linkBlocks = wrapper . findAllComponents ( '.topics-link-block' ) ;
62
60
expect ( linkBlocks ) . toHaveLength ( 2 ) ;
63
61
expect ( linkBlocks . at ( 0 ) . props ( 'topic' ) ) . toEqual ( references . foo ) ;
64
62
expect ( linkBlocks . at ( 1 ) . props ( 'topic' ) ) . toEqual ( references . bar ) ;
0 commit comments