-
Notifications
You must be signed in to change notification settings - Fork 0
Remove ribbon when technology list is empty, or matches root path #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
remove ribbon for when technology is empty, matches technology
| // show modules if page | ||
| // 1. belongs to multiple technologies | ||
| // 2. if name doesn't match root of page | ||
| // const root = this.identifier.split('/documentation/')[-1].split('/')[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // const root = this.identifier.split('/documentation/')[-1].split('/')[0]; |
| showSummary({ shouldShowLanguageSwitcher, showmodules }) { | ||
| // get setting | ||
| const hideSummary = getSetting(['features', 'docs', 'summary', 'hide'], false); | ||
| return !hideSummary && (shouldShowLanguageSwitcher || showmodules); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add extendsTechnology too?
| :isSymbolDeprecated="isSymbolDeprecated" | ||
| :isSymbolBeta="isSymbolBeta" | ||
| :languagePaths="languagePaths" | ||
| :rootPath="technology.title" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably rootTitle is a better name, since we dont pass a path?
| expect(wrapper.find(Summary).exists()).toBe(false); | ||
| }); | ||
|
|
||
| it('renders the Summary, if more than 1 module', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont see a test to hide the summary.
marinaaisa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some refactor suggestions :)
| ), | ||
| shouldShowLanguageSwitcher: ({ objcPath, swiftPath }) => objcPath && swiftPath, | ||
| hideSummary: () => getSetting(['features', 'docs', 'summary', 'hide'], false), | ||
| showModules() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest simplifying this computed property as:
showModules({ modules, rootPath }) {
// show modules if page belongs to multiple technologies or if name doesn't match root of page
if (!modules) return false;
return rootPath !== modules[0].name || modules.length > 1;
},There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to make sure modules is not an empty array
| return (this.modules && this.modules.length > 1) | ||
| ? true : (this.modules && this.rootPath !== this.modules[0].name); | ||
| }, | ||
| showSummary({ shouldShowLanguageSwitcher, showmodules }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| showSummary({ shouldShowLanguageSwitcher, showmodules }) { | |
| showSummary({ shouldShowLanguageSwitcher, showModules }) { |
| showSummary({ shouldShowLanguageSwitcher, showmodules }) { | ||
| // get setting | ||
| const hideSummary = getSetting(['features', 'docs', 'summary', 'hide'], false); | ||
| return !hideSummary && (shouldShowLanguageSwitcher || showmodules); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return !hideSummary && (shouldShowLanguageSwitcher || showmodules); | |
| return !hideSummary && (shouldShowLanguageSwitcher || showModules); |
| it('renders the Summary, if more than 1 module', () => { | ||
| const modules = ['FooKit', 'BarKit']; | ||
| wrapper.setProps({ modules }); | ||
| // wrapper = shallowMount(DocumentationTopic, { propsData }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // wrapper = shallowMount(DocumentationTopic, { propsData }); |
|
Issue was fixed with: #8 |
Bug/issue #, if applicable: 88214559, 89672818
Summary
Testing
Steps:
To test #1, go to a
SlothCreatorpage.To test #2, if you have access to a documentation archive that includes a page where the “framework” metadata does not match the root framework in the breadcrumb, navigate to the page and verify that the ribbon is not rendered.
Checklist
npm test, and it succeeded