Skip to content

Commit cd84383

Browse files
author
Dobromir Hristov
committed
refactor: rename TopicStyles.js to TopicSectionsStyle.js
1 parent 5acc797 commit cd84383

File tree

12 files changed

+35
-35
lines changed

12 files changed

+35
-35
lines changed

src/components/DocumentationTopic.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ import BetaLegalText from 'theme/components/DocumentationTopic/BetaLegalText.vue
114114
import LanguageSwitcher from 'theme/components/DocumentationTopic/Summary/LanguageSwitcher.vue';
115115
import DocumentationHero from 'docc-render/components/DocumentationTopic/DocumentationHero.vue';
116116
import WordBreak from 'docc-render/components/WordBreak.vue';
117-
import { TopicStyles } from 'docc-render/constants/TopicStyles';
117+
import { TopicSectionsStyle } from '@/constants/TopicSectionsStyle';
118118
import OnThisPageNav from 'theme/components/OnThisPageNav.vue';
119119
import Abstract from './DocumentationTopic/Description/Abstract.vue';
120120
import ContentNode from './DocumentationTopic/ContentNode.vue';
@@ -242,7 +242,7 @@ export default {
242242
},
243243
topicSectionsStyle: {
244244
type: String,
245-
default: TopicStyles.list,
245+
default: TopicSectionsStyle.list,
246246
},
247247
sampleCodeDownload: {
248248
type: Object,
@@ -385,7 +385,7 @@ export default {
385385
shouldRenderTopicSection: ({
386386
topicSectionsStyle,
387387
topicSections,
388-
}) => topicSections && topicSectionsStyle !== TopicStyles.hidden,
388+
}) => topicSections && topicSectionsStyle !== TopicSectionsStyle.hidden,
389389
},
390390
methods: {
391391
normalizePath(path) {

src/components/DocumentationTopic/Topics.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</template>
2121

2222
<script>
23-
import { TopicStyles } from '@/constants/TopicStyles';
23+
import { TopicSectionsStyle } from '@/constants/TopicSectionsStyle';
2424
import TopicsTable from './TopicsTable.vue';
2525
2626
export default {
@@ -33,7 +33,7 @@ export default {
3333
topicStyle: {
3434
type: String,
3535
required: true,
36-
validator: v => Object.hasOwnProperty.call(TopicStyles, v),
36+
validator: v => Object.hasOwnProperty.call(TopicSectionsStyle, v),
3737
},
3838
},
3939
};

src/components/DocumentationTopic/TopicsLinkCardGrid.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<script>
2525
import Row from 'docc-render/components/ContentNode/Row.vue';
2626
import Column from 'docc-render/components/ContentNode/Column.vue';
27-
import { TopicStyles } from 'docc-render/constants/TopicStyles';
27+
import { TopicSectionsStyle } from '@/constants/TopicSectionsStyle';
2828
import TopicsLinkCardGridItem from './TopicsLinkCardGridItem.vue';
2929
3030
export default {
@@ -37,12 +37,12 @@ export default {
3737
},
3838
topicStyle: {
3939
type: String,
40-
default: TopicStyles.compactGrid,
41-
validator: v => v === TopicStyles.compactGrid || v === TopicStyles.detailedGrid,
40+
default: TopicSectionsStyle.compactGrid,
41+
validator: v => v === TopicSectionsStyle.compactGrid || v === TopicSectionsStyle.detailedGrid,
4242
},
4343
},
4444
computed: {
45-
compactCards: ({ topicStyle }) => topicStyle === TopicStyles.compactGrid,
45+
compactCards: ({ topicStyle }) => topicStyle === TopicSectionsStyle.compactGrid,
4646
},
4747
};
4848
</script>

src/components/DocumentationTopic/TopicsTable.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<script>
5656
import ContentNode from 'docc-render/components/DocumentationTopic/ContentNode.vue';
5757
import WordBreak from 'docc-render/components/WordBreak.vue';
58-
import { TopicStyles } from 'docc-render/constants/TopicStyles';
58+
import { TopicSectionsStyle } from '@/constants/TopicSectionsStyle';
5959
import TopicsLinkCardGrid from 'docc-render/components/DocumentationTopic/TopicsLinkCardGrid.vue';
6060
import LinkableHeading from 'docc-render/components/ContentNode/LinkableHeading.vue';
6161
import ContentTable from './ContentTable.vue';
@@ -107,11 +107,11 @@ export default {
107107
},
108108
topicStyle: {
109109
type: String,
110-
default: TopicStyles.list,
110+
default: TopicSectionsStyle.list,
111111
},
112112
},
113113
computed: {
114-
shouldRenderList: ({ topicStyle }) => topicStyle === TopicStyles.list,
114+
shouldRenderList: ({ topicStyle }) => topicStyle === TopicSectionsStyle.list,
115115
sectionsWithTopics() {
116116
return this.sections.map(section => ({
117117
...section,

src/constants/TopicStyles.js renamed to src/constants/TopicSectionsStyle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010

1111
/* eslint-disable import/prefer-default-export */
12-
export const TopicStyles = {
12+
export const TopicSectionsStyle = {
1313
list: 'list',
1414
compactGrid: 'compactGrid',
1515
detailedGrid: 'detailedGrid',

tests/unit/components/DocumentationTopic.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import DocumentationTopic from 'docc-render/components/DocumentationTopic.vue';
1313
import Language from 'docc-render/constants/Language';
1414
import { TopicTypes } from '@/constants/TopicTypes';
1515
import DocumentationHero from '@/components/DocumentationTopic/DocumentationHero.vue';
16-
import { TopicStyles } from '@/constants/TopicStyles';
16+
import { TopicSectionsStyle } from '@/constants/TopicSectionsStyle';
1717
import OnThisPageNav from '@/components/OnThisPageNav.vue';
1818
import OnThisPageStickyContainer from '@/components/DocumentationTopic/OnThisPageStickyContainer.vue';
1919

@@ -479,12 +479,12 @@ describe('DocumentationTopic', () => {
479479
identifiers: ['baz'],
480480
},
481481
];
482-
wrapper.setProps({ topicSections, topicSectionsStyle: TopicStyles.detailedGrid });
482+
wrapper.setProps({ topicSections, topicSectionsStyle: TopicSectionsStyle.detailedGrid });
483483

484484
const topics = wrapper.find(Topics);
485485
expect(topics.exists()).toBe(true);
486486
expect(topics.props('sections')).toBe(topicSections);
487-
expect(topics.props('topicStyle')).toBe(TopicStyles.detailedGrid);
487+
expect(topics.props('topicStyle')).toBe(TopicSectionsStyle.detailedGrid);
488488
});
489489

490490
it('does not render the `Topics` if the `topicSectionsStyle` is `hidden`', () => {

tests/unit/components/DocumentationTopic/DefaultImplementations.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import { shallowMount } from '@vue/test-utils';
1212
import DefaultImplementations from 'docc-render/components/DocumentationTopic/DefaultImplementations.vue';
13-
import { TopicStyles } from '@/constants/TopicStyles';
13+
import { TopicSectionsStyle } from '@/constants/TopicSectionsStyle';
1414

1515
const { TopicsTable } = DefaultImplementations.components;
1616

@@ -42,7 +42,7 @@ describe('DefaultImplementations', () => {
4242
isSymbolBeta: false,
4343
title: 'Default Implementations',
4444
wrapTitle: true,
45-
topicStyle: TopicStyles.list,
45+
topicStyle: TopicSectionsStyle.list,
4646
});
4747
});
4848
});

tests/unit/components/DocumentationTopic/SeeAlso.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import { shallowMount } from '@vue/test-utils';
1212
import SeeAlso from 'docc-render/components/DocumentationTopic/SeeAlso.vue';
13-
import { TopicStyles } from '@/constants/TopicStyles';
13+
import { TopicSectionsStyle } from '@/constants/TopicSectionsStyle';
1414

1515
const { TopicsTable } = SeeAlso.components;
1616

@@ -27,7 +27,7 @@ describe('SeeAlso', () => {
2727
sections: [],
2828
title: 'See Also',
2929
wrapTitle: false,
30-
topicStyle: TopicStyles.list,
30+
topicStyle: TopicSectionsStyle.list,
3131
});
3232
});
3333
});

tests/unit/components/DocumentationTopic/Topics.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import { shallowMount } from '@vue/test-utils';
1212
import Topics from 'docc-render/components/DocumentationTopic/Topics.vue';
13-
import { TopicStyles } from '@/constants/TopicStyles';
13+
import { TopicSectionsStyle } from '@/constants/TopicSectionsStyle';
1414

1515
const { TopicsTable } = Topics.components;
1616

@@ -19,7 +19,7 @@ describe('Topics', () => {
1919
const wrapper = shallowMount(Topics, {
2020
propsData: {
2121
sections: [],
22-
topicStyle: TopicStyles.list,
22+
topicStyle: TopicSectionsStyle.list,
2323
},
2424
});
2525

@@ -32,13 +32,13 @@ describe('Topics', () => {
3232
sections: [],
3333
title: 'Topics',
3434
wrapTitle: false,
35-
topicStyle: TopicStyles.list,
35+
topicStyle: TopicSectionsStyle.list,
3636
});
3737
table.setProps({ isSymbolDeprecated: true });
3838
expect(table.props('isSymbolDeprecated')).toBe(true);
3939
table.setProps({ isSymbolBeta: true });
4040
expect(table.props('isSymbolBeta')).toBe(true);
41-
table.setProps({ topicStyle: TopicStyles.compactGrid });
42-
expect(table.props('topicStyle')).toBe(TopicStyles.compactGrid);
41+
table.setProps({ topicStyle: TopicSectionsStyle.compactGrid });
42+
expect(table.props('topicStyle')).toBe(TopicSectionsStyle.compactGrid);
4343
});
4444
});

tests/unit/components/DocumentationTopic/TopicsLinkCardGrid.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import TopicsLinkCardGrid from '@/components/DocumentationTopic/TopicsLinkCardGrid.vue';
1212
import { shallowMount } from '@vue/test-utils';
13-
import { TopicStyles } from '@/constants/TopicStyles';
13+
import { TopicSectionsStyle } from '@/constants/TopicSectionsStyle';
1414
import Row from '@/components/ContentNode/Row.vue';
1515
import Column from '@/components/ContentNode/Column.vue';
1616
import TopicsLinkCardGridItem from '@/components/DocumentationTopic/TopicsLinkCardGridItem.vue';
@@ -48,7 +48,7 @@ describe('TopicsLinkCardGrid', () => {
4848
const wrapper = createWrapper({
4949
propsData: {
5050
...defaultProps,
51-
topicStyle: TopicStyles.detailedGrid,
51+
topicStyle: TopicSectionsStyle.detailedGrid,
5252
},
5353
});
5454
expect(wrapper.find(Row).props()).toEqual({

tests/unit/components/DocumentationTopic/TopicsTable.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import { shallowMount } from '@vue/test-utils';
1212
import TopicsTable from 'docc-render/components/DocumentationTopic/TopicsTable.vue';
13-
import { TopicStyles } from '@/constants/TopicStyles';
13+
import { TopicSectionsStyle } from '@/constants/TopicSectionsStyle';
1414
import TopicsLinkCardGrid from '@/components/DocumentationTopic/TopicsLinkCardGrid.vue';
1515

1616
const {
@@ -112,21 +112,21 @@ describe('TopicsTable', () => {
112112
});
113113

114114
it('renders a `TopicsLinkCardGrid` if `topicStyle` is not `list`', () => {
115-
wrapper.setProps({ topicStyle: TopicStyles.compactGrid });
115+
wrapper.setProps({ topicStyle: TopicSectionsStyle.compactGrid });
116116
expect(wrapper.findAll(TopicsLinkBlock)).toHaveLength(0);
117117
const sections = wrapper.findAll(ContentTableSection);
118118

119119
const firstGrid = sections.at(0).find(TopicsLinkCardGrid);
120120
expect(firstGrid.classes('topic')).toBe(true);
121121
expect(firstGrid.props()).toEqual({
122-
topicStyle: TopicStyles.compactGrid,
122+
topicStyle: TopicSectionsStyle.compactGrid,
123123
items: [foo],
124124
});
125125

126126
const secondGrid = sections.at(1).find(TopicsLinkCardGrid);
127127
expect(secondGrid.classes('topic')).toBe(true);
128128
expect(secondGrid.props()).toEqual({
129-
topicStyle: TopicStyles.compactGrid,
129+
topicStyle: TopicSectionsStyle.compactGrid,
130130
items: [baz],
131131
});
132132
});

tests/unit/views/DocumentationTopic.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import AdjustableSidebarWidth from '@/components/AdjustableSidebarWidth.vue';
1717
import NavigatorDataProvider from '@/components/Navigator/NavigatorDataProvider.vue';
1818
import Language from '@/constants/Language';
1919
import Navigator from '@/components/Navigator.vue';
20-
import { TopicStyles } from '@/constants/TopicStyles';
20+
import { TopicSectionsStyle } from '@/constants/TopicSectionsStyle';
2121
import { storage } from '@/utils/storage';
2222
import { BreakpointName } from 'docc-render/utils/breakpoints';
2323
import StaticContentWidth from 'docc-render/components/DocumentationTopic/StaticContentWidth.vue';
@@ -542,7 +542,7 @@ describe('DocumentationTopic', () => {
542542
swift: ['documentation/swift'],
543543
},
544544
enableOnThisPageNav: false,
545-
topicSectionsStyle: TopicStyles.list, // default value
545+
topicSectionsStyle: TopicSectionsStyle.list, // default value
546546
});
547547
});
548548

@@ -573,12 +573,12 @@ describe('DocumentationTopic', () => {
573573
wrapper.setData({
574574
topicData: {
575575
...topicData,
576-
topicSectionsStyle: TopicStyles.detailedGrid,
576+
topicSectionsStyle: TopicSectionsStyle.detailedGrid,
577577
},
578578
});
579579

580580
const topic = wrapper.find(Topic);
581-
expect(topic.props('topicSectionsStyle')).toEqual(TopicStyles.detailedGrid);
581+
expect(topic.props('topicSectionsStyle')).toEqual(TopicSectionsStyle.detailedGrid);
582582
});
583583

584584
it('provides an empty languagePaths, even if no variants', () => {

0 commit comments

Comments
 (0)