Skip to content

Conversation

@hqhhuang
Copy link
Owner

@hqhhuang hqhhuang commented Mar 4, 2022

Bug/issue #, if applicable: 88214559, 89672818

Summary

  1. The grey ribbon shouldn't be present if the technology list is empty
  2. We should hide "framework" metadata on pages where that info matches the root framework in the breadcrumb.

Testing

Steps:
To test #1, go to a SlothCreator page.

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

  • Added tests
  • Ran npm test, and it succeeded
  • Updated documentation if necessary - NA

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];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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);
Copy link
Collaborator

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"
Copy link
Collaborator

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', () => {
Copy link
Collaborator

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.

Copy link
Collaborator

@marinaaisa marinaaisa left a 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() {
Copy link
Collaborator

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;
},

Copy link
Collaborator

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 }) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
showSummary({ shouldShowLanguageSwitcher, showmodules }) {
showSummary({ shouldShowLanguageSwitcher, showModules }) {

showSummary({ shouldShowLanguageSwitcher, showmodules }) {
// get setting
const hideSummary = getSetting(['features', 'docs', 'summary', 'hide'], false);
return !hideSummary && (shouldShowLanguageSwitcher || showmodules);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// wrapper = shallowMount(DocumentationTopic, { propsData });

@hqhhuang hqhhuang marked this pull request as draft March 14, 2022 18:41
@hqhhuang
Copy link
Owner Author

Issue was fixed with: #8
Closing this PR

@hqhhuang hqhhuang closed this Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants