Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmytro-Melnyshyn committed Sep 19, 2024
1 parent af7fdd9 commit 03f1544
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('Given SourceFileLookupModal', () => {
it('should disable Save & close button', () => {
const { getByRole } = renderSourceFileLookupModal();

const button = getByRole('button', { name: 'stripes-components.saveAndClose' });
const button = getByRole('button', { name: 'stripes-components.saveAndClose', hidden: true });

expect(button).toBeDisabled();
});
Expand All @@ -58,15 +58,15 @@ describe('Given SourceFileLookupModal', () => {
describe('when some source file value is selected', () => {
it('should enable Save & close button', async () => {
const {
getByRole,
getByLabelText,
getByText,
} = renderSourceFileLookupModal();

const select = getByLabelText('ui-quick-marc.sourceFileLookupModal.fieldLabel');

fireEvent.change(select, { target: { value: sourceFileOptions[0].value } });

const button = getByRole('button', { name: 'stripes-components.saveAndClose' });
const button = getByText('stripes-components.saveAndClose').closest('button');

expect(button).toBeEnabled();
});
Expand All @@ -75,15 +75,15 @@ describe('Given SourceFileLookupModal', () => {
describe('when confirming Source File selection', () => {
it('should call onConfirm with correct source file id', async () => {
const {
getByRole,
getByLabelText,
getByText,
} = renderSourceFileLookupModal();

const select = getByLabelText('ui-quick-marc.sourceFileLookupModal.fieldLabel');

fireEvent.change(select, { target: { value: sourceFileOptions[0].value } });

const button = getByRole('button', { name: 'stripes-components.saveAndClose' });
const button = getByText('stripes-components.saveAndClose').closest('button');

fireEvent.click(button);

Expand All @@ -93,9 +93,9 @@ describe('Given SourceFileLookupModal', () => {

describe('when closing the modal', () => {
it('should call onCancel', async () => {
const { getByRole } = renderSourceFileLookupModal();
const { getByText } = renderSourceFileLookupModal();

const button = getByRole('button', { name: 'stripes-components.cancel' });
const button = getByText('stripes-components.cancel').closest('button');

fireEvent.click(button);

Expand Down

0 comments on commit 03f1544

Please sign in to comment.