11
11
import TopicsGrid from '@/components/DocumentationTopic/TopicsGrid.vue' ;
12
12
import { shallowMount } from '@vue/test-utils' ;
13
13
import { TopicStyles } from '@/constants/TopicStyles' ;
14
- import OnThisPageSection from '@/components/DocumentationTopic/OnThisPageSection .vue' ;
14
+ import ContentTableSection from '@/components/DocumentationTopic/ContentTableSection .vue' ;
15
15
import TopicsLinkCardGrid from '@/components/DocumentationTopic/TopicsLinkCardGrid.vue' ;
16
+ import ContentTable from '@/components/DocumentationTopic/ContentTable.vue' ;
16
17
17
18
const defaultProps = {
18
19
sections : [
@@ -39,20 +40,19 @@ const createWrapper = ({ propsData, ...others } = {}) => shallowMount(TopicsGrid
39
40
describe ( 'TopicsGrid' , ( ) => {
40
41
it ( 'renders the TopicsGrid' , ( ) => {
41
42
const wrapper = createWrapper ( ) ;
42
- const sections = wrapper . findAll ( OnThisPageSection ) ;
43
+ expect ( wrapper . find ( ContentTable ) . props ( ) ) . toEqual ( {
44
+ anchor : 'topics' ,
45
+ title : 'Topics' ,
46
+ } ) ;
47
+ const sections = wrapper . findAll ( ContentTableSection ) ;
43
48
expect ( sections ) . toHaveLength ( 2 ) ;
44
49
expect ( sections . at ( 0 ) . props ( ) ) . toEqual ( {
45
50
title : defaultProps . sections [ 0 ] . title ,
46
- anchor : 'foo' ,
47
- // level: 3,
48
51
} ) ;
49
52
expect ( sections . at ( 1 ) . props ( ) ) . toEqual ( {
50
53
title : defaultProps . sections [ 1 ] . title ,
51
- anchor : 'bar' ,
52
- // level: 3,
53
54
} ) ;
54
55
// assert contents
55
- expect ( sections . at ( 0 ) . find ( 'h3.title' ) . text ( ) ) . toBe ( defaultProps . sections [ 0 ] . title ) ;
56
56
expect ( sections . at ( 0 ) . find ( TopicsLinkCardGrid ) . props ( ) ) . toEqual ( {
57
57
identifiers : defaultProps . sections [ 0 ] . identifiers ,
58
58
topicStyle : defaultProps . topicStyle ,
@@ -68,14 +68,11 @@ describe('TopicsGrid', () => {
68
68
} ] ,
69
69
} ,
70
70
} ) ;
71
- const sections = wrapper . findAll ( OnThisPageSection ) ;
71
+ const sections = wrapper . findAll ( ContentTableSection ) ;
72
72
expect ( sections ) . toHaveLength ( 1 ) ;
73
73
expect ( sections . at ( 0 ) . props ( ) ) . toEqual ( {
74
74
title : '' ,
75
- anchor : '' ,
76
- // level: 3,
77
75
} ) ;
78
- expect ( sections . at ( 0 ) . find ( '.title' ) . exists ( ) ) . toBe ( false ) ;
79
76
expect ( sections . at ( 0 ) . find ( TopicsLinkCardGrid ) . exists ( ) ) . toBe ( true ) ;
80
77
} ) ;
81
78
} ) ;
0 commit comments