diff --git a/src/components/DocumentationTopic.vue b/src/components/DocumentationTopic.vue index a303894ad..c3c03db4c 100644 --- a/src/components/DocumentationTopic.vue +++ b/src/components/DocumentationTopic.vue @@ -29,29 +29,29 @@ :platforms="platforms" :technologies="technologies" /> -
- - - - - - +
+ + +
+ +
primaryContentSections.filter(section => ( - section.kind === PrimaryContent.constants.SectionKind.content - )).length > 0 || abstract.length > 0, onThisPageSections() { return this.topicState.onThisPageSections; }, @@ -367,6 +361,18 @@ export default { @include dynamic-content-container; } +.description { + &:empty { display: none; } + + &:not(:empty) { + margin-bottom: $contenttable-spacing-single-side; + } + + /deep/ .content + * { + margin-top: $stacked-margin-large; + } +} + .sample-download { margin-top: 20px; } diff --git a/src/components/DocumentationTopic/Description.vue b/src/components/DocumentationTopic/Description.vue deleted file mode 100644 index dd4ab53a0..000000000 --- a/src/components/DocumentationTopic/Description.vue +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - diff --git a/tests/unit/components/DocumentationTopic.spec.js b/tests/unit/components/DocumentationTopic.spec.js index 7aaa8f0fc..79f7dbb9c 100644 --- a/tests/unit/components/DocumentationTopic.spec.js +++ b/tests/unit/components/DocumentationTopic.spec.js @@ -19,7 +19,6 @@ const { ContentNode, DefaultImplementations, Aside, - Description, DownloadButton, LanguageSwitcher, PrimaryContent, @@ -275,13 +274,6 @@ describe('DocumentationTopic', () => { expect(abstractComponent.props('content')).toEqual(emptyParagraph); }); - it('renders a `Description`/`Summary and PrimaryContent`', () => { - const description = wrapper.find(Description); - expect(description.exists()).toBe(true); - - expect(wrapper.find(PrimaryContent).exists()).toBe(true); - }); - it('renders a `PrimaryContent`', () => { const primary = wrapper.find(PrimaryContent); expect(primary.exists()).toBe(true); diff --git a/tests/unit/components/DocumentationTopic/Description.spec.js b/tests/unit/components/DocumentationTopic/Description.spec.js deleted file mode 100644 index 0271eb415..000000000 --- a/tests/unit/components/DocumentationTopic/Description.spec.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * This source file is part of the Swift.org open source project - * - * Copyright (c) 2021 Apple Inc. and the Swift project authors - * Licensed under Apache License v2.0 with Runtime Library Exception - * - * See https://swift.org/LICENSE.txt for license information - * See https://swift.org/CONTRIBUTORS.txt for Swift project authors -*/ - -import { shallowMount } from '@vue/test-utils'; -import Description from 'docc-render/components/DocumentationTopic/Description.vue'; - -describe('Description', () => { - it('renders `.description` at the root', () => { - const wrapper = shallowMount(Description); - expect(wrapper.classes('description')).toBe(true); - }); - - it('renders a p.nodocumentation message without content and without Primary Content Section in parent component', () => { - const wrapper = shallowMount(Description); - - const nodocs = wrapper.find('p.nodocumentation'); - expect(nodocs.exists()).toBe(true); - expect(nodocs.text()).toBe('No overview available.'); - }); - - it('does not renders a p.nodocumentation message without content but with Primary Content Section in parent component', () => { - const wrapper = shallowMount(Description); - wrapper.setProps({ hasOverview: true }); - - const nodocs = wrapper.find('p.nodocumentation'); - expect(nodocs.exists()).toBe(false); - }); - - it('renders slot content', () => { - const wrapper = shallowMount(Description, { - slots: { default: '

foobar

' }, - }); - - expect(wrapper.contains('.nodocumentation')).toBe(false); - expect(wrapper.contains('p')).toBe(true); - expect(wrapper.find('p').text()).toBe('foobar'); - }); - - it('does not render `.nodocumentation`, even if rendering empty string', () => { - const wrapper = shallowMount(Description, { - slots: { default: '

' }, - }); - expect(wrapper.contains('.nodocumentation')).toBe(false); - }); -});