Skip to content

Commit e97cd3c

Browse files
committed
fix: dropdown should be selectable when at least one item is present
1 parent 9875184 commit e97cd3c

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/components/snapshot/AuthDomain.test.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,14 @@ 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 = [{ groupEmail: 'email1', groupName: 'group1', role: 'READER' }];
7878
mountAuthDomain(userGroups);
79+
cy.get('#authorization-domain-select').should('not.be.disabled');
80+
});
81+
82+
it('Disables authorization domain dropdown when empty user groups', () => {
83+
mountAuthDomain([]);
7984
cy.get('#authorization-domain-select').should('be.disabled');
8085
});
8186
});

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)