Skip to content

Allow hiding available tags in NavigatorCard.vue #537

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

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
8 changes: 6 additions & 2 deletions src/components/Navigator/NavigatorCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ export default {
type: Boolean,
default: false,
},
hideAvailableTags: {
type: Boolean,
default: false,
},
},
mixins: [
keyboardNavigation,
Expand Down Expand Up @@ -269,9 +273,9 @@ export default {
* Shows only tags, that have children matches.
*/
availableTags: ({
selectedTags, renderableChildNodesMap, apiChangesObject,
selectedTags, renderableChildNodesMap, apiChangesObject, hideAvailableTags,
}) => {
if (selectedTags.length) return [];
if (hideAvailableTags || selectedTags.length) return [];
const apiChangesTypesSet = new Set(Object.values(apiChangesObject));
const tagLabelsSet = new Set(Object.values(FILTER_TAGS_TO_LABELS));
const generalTags = new Set([HIDE_DEPRECATED_TAG]);
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/components/Navigator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ describe('Navigator', () => {
apiChanges: null,
allowHiding: true,
navigatorReferences,
hideAvailableTags: false,
});
});

Expand Down Expand Up @@ -187,6 +188,7 @@ describe('Navigator', () => {
apiChanges: null,
allowHiding: true,
navigatorReferences,
hideAvailableTags: false,
});
});

Expand Down
13 changes: 13 additions & 0 deletions tests/unit/components/Navigator/NavigatorCard.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,19 @@ describe('NavigatorCard', () => {
expect(all.at(3).props('item')).toEqual(root0Child1GrandChild0);
});

it('allows hiding all available tags', async () => {
attachDivWithID(root0Child0.uid);
const wrapper = createWrapper();
await flushPromises();
const filter = wrapper.find(FilterInput);
expect(filter.props('tags')).toHaveLength(2);
wrapper.setProps({
hideAvailableTags: true,
});
await flushPromises();
expect(filter.props('tags')).toEqual([]);
});

it('allows filtering the items using Tags, opening all items, that have matches in children', async () => {
attachDivWithID(root0Child0.uid);
const wrapper = createWrapper();
Expand Down