From ff5bc89912ecf3cd6c167413efe24f5e24375e2a Mon Sep 17 00:00:00 2001 From: Hanqing Huang Date: Thu, 17 Mar 2022 23:09:42 -0700 Subject: [PATCH 1/6] Remove 'No Overview` from Description and fix test Remove 'No Overview` from Description and fix test --- src/components/DocumentationTopic.vue | 6 ++--- .../DocumentationTopic/Description.vue | 11 +------- .../components/DocumentationTopic.spec.js | 21 +++++++++++++++- .../DocumentationTopic/Description.spec.js | 25 +------------------ 4 files changed, 25 insertions(+), 38 deletions(-) diff --git a/src/components/DocumentationTopic.vue b/src/components/DocumentationTopic.vue index a303894ad..73b8af9a0 100644 --- a/src/components/DocumentationTopic.vue +++ b/src/components/DocumentationTopic.vue @@ -30,7 +30,7 @@ />
- + primaryContentSections.filter(section => ( + ({ primaryContentSections = [] }) => primaryContentSections.filter(section => ( section.kind === PrimaryContent.constants.SectionKind.content - )).length > 0 || abstract.length > 0, + )).length > 0, onThisPageSections() { return this.topicState.onThisPageSections; }, diff --git a/src/components/DocumentationTopic/Description.vue b/src/components/DocumentationTopic/Description.vue index dd4ab53a0..4b65cfa08 100644 --- a/src/components/DocumentationTopic/Description.vue +++ b/src/components/DocumentationTopic/Description.vue @@ -1,7 +1,7 @@ - - - - - - diff --git a/tests/unit/components/DocumentationTopic.spec.js b/tests/unit/components/DocumentationTopic.spec.js index 7d2355a74..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,25 +274,6 @@ describe('DocumentationTopic', () => { expect(abstractComponent.props('content')).toEqual(emptyParagraph); }); - it('does not render a `Description` if no description', () => { - const description = wrapper.find(Description); - expect(description.exists()).toBe(false); - }); - - it('renders a `Description` if has description', () => { - // Description includes: - // RequirementMetaData, DeprecationSummary, downloadNotAvailableSummary - wrapper.setProps({ isRequirement: true }); - expect(wrapper.contains(Description)).toBe(true); - - wrapper.setProps({ - isRequirement: false, - downloadNotAvailableSummary, - deprecationSummary, - }); - expect(wrapper.contains(Description)).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 2f5d4941c..000000000 --- a/tests/unit/components/DocumentationTopic/Description.spec.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This source file is part of the Swift.org open source project - * - * Copyright (c) 2022 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 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'); - }); -}); From 01a382be5fe7f51835a01c5b586d0d9679677393 Mon Sep 17 00:00:00 2001 From: Hanqing Huang Date: Fri, 18 Mar 2022 02:10:11 -0700 Subject: [PATCH 4/6] Move over CSS from `Description` Component Move over CSS from `Description` Component --- src/components/DocumentationTopic.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/DocumentationTopic.vue b/src/components/DocumentationTopic.vue index fcd34f6ff..768238f83 100644 --- a/src/components/DocumentationTopic.vue +++ b/src/components/DocumentationTopic.vue @@ -361,7 +361,17 @@ export default { @include dynamic-content-container; } -.description:empty { display: none; } +.description { + &:empty { display: none; } + + &:not(:empty) { + margin-bottom: $contenttable-spacing-single-side; + } + + /deep/ .content + * { + margin-top: $stacked-margin-large; + } +} .sample-download { margin-top: 20px; From 350ee7a1808d870d96caa573cbe00aa1f1fbc77b Mon Sep 17 00:00:00 2001 From: Hanqing Huang Date: Fri, 18 Mar 2022 02:28:04 -0700 Subject: [PATCH 5/6] fix tabbing fix tabbing --- src/components/DocumentationTopic.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/DocumentationTopic.vue b/src/components/DocumentationTopic.vue index 768238f83..43fc3d168 100644 --- a/src/components/DocumentationTopic.vue +++ b/src/components/DocumentationTopic.vue @@ -51,7 +51,7 @@ :conformance="conformance" :sections="primaryContentSections" /> -
+ Date: Fri, 18 Mar 2022 15:20:46 -0700 Subject: [PATCH 6/6] Fix whitespace. --- src/components/DocumentationTopic.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/DocumentationTopic.vue b/src/components/DocumentationTopic.vue index 43fc3d168..c3c03db4c 100644 --- a/src/components/DocumentationTopic.vue +++ b/src/components/DocumentationTopic.vue @@ -369,7 +369,7 @@ export default { } /deep/ .content + * { - margin-top: $stacked-margin-large; + margin-top: $stacked-margin-large; } }