Skip to content

Commit 7540f66

Browse files
committed
fix: dropdown should be selectable when at least one item is present
1 parent 6ae59e0 commit 7540f66

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/components/snapshot/AuthDomain.test.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,16 @@ describe('Test AuthDomain component', () => {
7373
cy.get('#authorization-domain-select').should('have.value', 'group2');
7474
});
7575

76-
it('Disables authorization domain dropdown when insufficient user groups', () => {
77-
const userGroups = [{ groupEmail: 'default', groupName: 'default', role: 'READER' }];
76+
it('Enables authorization domain dropdown when sufficient user groups', () => {
77+
const userGroups = [
78+
{ groupEmail: 'email1', groupName: 'group1', role: 'READER' },
79+
];
7880
mountAuthDomain(userGroups);
81+
cy.get('#authorization-domain-select').should('not.be.disabled');
82+
});
83+
84+
it('Disables authorization domain dropdown when empty user groups', () => {
85+
mountAuthDomain([]);
7986
cy.get('#authorization-domain-select').should('be.disabled');
8087
});
8188
});

src/components/snapshot/AuthDomain.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function AuthDomain({ dispatch, userGroups, setParentAuthDomain }: AuthDomainPro
4949
</Box>
5050
<JadeDropdown
5151
sx={{ height: '2.5rem' }}
52-
disabled={userGroups ? userGroups.length <= 1 : true}
52+
disabled={userGroups ? userGroups.length < 1 : true}
5353
options={userGroups ? userGroups.map((group) => group.groupName) : []}
5454
name="authorization-domain"
5555
onSelectedItem={(event) => {

0 commit comments

Comments
 (0)