Skip to content

Commit

Permalink
#2218 Change group expand component
Browse files Browse the repository at this point in the history
  • Loading branch information
dwalizer committed Jan 10, 2025
1 parent 4fd084d commit 25b2b8f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,24 @@ const collapseAllGroups = (() => {
const resetGroupExpansion = (() => {
expandGroups.value = null
})
const items = [
{
label: 'Collapse All',
icon: 'fas fa-minus',
command: collapseAllGroups
},
{
label: 'Expand All',
icon: 'fas fa-plus',
command: expandAllGroups
},
]
const menu = ref()
const toggle = (event) => {
menu.value.toggle(event)
}
</script>
<template>
Expand Down Expand Up @@ -285,8 +303,20 @@ const resetGroupExpansion = (() => {
<div class="" data-cy="skillDetailsToggle">
<div class="flex flex-row flex-wrap align-content-center">
<div class="flex flex-wrap mr-3 gap-2" v-if="!route.params.badgeId && hasGroups">
<SkillsButton label="Expand Groups" icon="fas fa-plus" size="small" data-cy="expandGroupsButton" @click="expandAllGroups"></SkillsButton>
<SkillsButton label="Collapse Groups" icon="fas fa-minus" size="small" data-cy="collapseGroupsButton" @click="collapseAllGroups"></SkillsButton>
<Button
outlined
raised
size="small"
@click="toggle"
aria-label="Group Controls"
aria-haspopup="true"
data-cy="groupToggle"
aria-controls="group_control_menu">
<i class="fas fa-list mr-1" aria-hidden="true"></i>
<span>Groups</span>
<i class="fas fa-caret-down ml-2"></i>
</Button>
<Menu ref="menu" :model="items" :popup="true"></Menu>
</div>
<div class="flex">
<span class="text-muted pr-1 align-content-center">{{ attributes.skillDisplayName }} Details:</span>
Expand Down
12 changes: 8 additions & 4 deletions e2e-tests/cypress/e2e/client-display/client-display_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,12 @@ describe('Client Display Tests', () => {

checkGroupSkillExistence(true)

cy.get('[data-cy=collapseGroupsButton]').click()
cy.get('[data-cy=groupToggle]').click()
cy.get('[data-pc-name="menu"] [aria-label="Collapse All"]').contains('Collapse All').click();
checkGroupSkillExistence(false)

cy.get('[data-cy=expandGroupsButton]').click()
cy.get('[data-cy=groupToggle]').click()
cy.get('[data-pc-name="menu"] [aria-label="Expand All"]').contains('Expand All').click();
checkGroupSkillExistence(true)

cy.get('[data-cy="toggleGroup-group1Subj2"]').click()
Expand Down Expand Up @@ -450,13 +452,15 @@ describe('Client Display Tests', () => {

checkGroupSkillExistence(true)

cy.get('[data-cy=collapseGroupsButton]').click()
cy.get('[data-cy=groupToggle]').click()
cy.get('[data-pc-name="menu"] [aria-label="Collapse All"]').contains('Collapse All').click();
checkGroupSkillExistence(false)

cy.cdVisit('/subjects/subj2');
checkGroupSkillExistence(false)

cy.get('[data-cy=expandGroupsButton]').click()
cy.get('[data-cy=groupToggle]').click()
cy.get('[data-pc-name="menu"] [aria-label="Expand All"]').contains('Expand All').click();

cy.cdVisit('/subjects/subj2');
checkGroupSkillExistence(true)
Expand Down

0 comments on commit 25b2b8f

Please sign in to comment.