Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/ContentNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ function renderNode(createElement, references) {
isActive: node.isActive,
ideTitle: reference.ideTitle,
titleStyle: reference.titleStyle,
hasInlineFormatting: !!titleInlineContent,
},
}, (
titleInlineContent ? renderChildren(titleInlineContent) : titlePlainText
Expand Down
6 changes: 5 additions & 1 deletion src/components/ContentNode/Reference.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default {
return name !== notFoundRouteName;
},
isSymbolReference() {
return this.kind === 'symbol'
return this.kind === 'symbol' && !this.hasInlineFormatting
&& (this.role === TopicRole.symbol || this.role === TopicRole.dictionarySymbol);
},
isDisplaySymbol({ isSymbolReference, titleStyle, ideTitle }) {
Expand Down Expand Up @@ -91,6 +91,10 @@ export default {
type: String,
required: false,
},
hasInlineFormatting: {
type: Boolean,
default: false,
},
},
};
</script>
2 changes: 2 additions & 0 deletions tests/unit/components/ContentNode.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,7 @@ describe('ContentNode', () => {
expect(reference.props('url')).toBe('/foo/bar');
expect(reference.props('ideTitle')).toBe('IDETitle');
expect(reference.props('titleStyle')).toBe('symbol');
expect(reference.props('hasInlineFormatting')).toBe(false);
expect(reference.isEmpty()).toBe(false);
expect(reference.text()).toBe('FooBar');
});
Expand Down Expand Up @@ -1119,6 +1120,7 @@ describe('ContentNode', () => {
const reference = wrapper.find('.content').find(Reference);
expect(reference.exists()).toBe(true);
expect(reference.props('url')).toBe('/foo/bar');
expect(reference.props('hasInlineFormatting')).toBe(true);

const emphasis = reference.find('em');
expect(emphasis.exists()).toBe(true);
Expand Down
18 changes: 18 additions & 0 deletions tests/unit/components/ContentNode/Reference.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,24 @@ describe('Reference', () => {
expect(ref.props('url')).toBe('/documentation/uikit/uiview');
});

it('renders a `ReferenceInternal` for a symbol with its own inline formatting', () => {
const wrapper = shallowMount(Reference, {
localVue,
router,
propsData: {
url: '/documentation/uikit/uiview',
kind: 'symbol',
role: TopicRole.symbol,
hasInlineFormatting: true,
},
slots: { default: 'custom text for UIView symbol' },
});
const ref = wrapper.find(ReferenceInternal);
expect(ref.exists()).toBe(true);
expect(ref.props('url')).toBe('/documentation/uikit/uiview');
expect(wrapper.find(ReferenceInternalSymbol).exists()).toBe(false);
});

it('renders a `ReferenceInternal` for external "dictionarySymbol" kind references with a human readable name', () => {
const wrapper = shallowMount(Reference, {
localVue,
Expand Down