Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,20 @@ const mockSection = {
},
} as any;

// Section with only the current passage (single dropdown option)
const mockSectionSinglePassage = {
id: 'section-1',
relationships: {
passages: {
data: [{ type: 'passage', id: 'p-1' }],
},
},
} as any;

const mockSectionPassageRecordsSingle = {
'passage:p-1': mockSectionPassageRecords['passage:p-1'],
};

const mockCurrentPassage = {
id: 'p-1',
attributes: { sequencenum: 1, reference: '1:1', book: 'GEN' },
Expand Down Expand Up @@ -389,7 +403,12 @@ describe('MobileWorkflowSteps', () => {
});

it('blocks passage dropdown and shows wait message when remote is busy', () => {
mountMobileWorkflowSteps({ isStepProgression: true, remoteBusy: true });
mountMobileWorkflowSteps({
isStepProgression: true,
remoteBusy: true,
section: mockSection,
extraMemoryRecords: mockSectionPassageRecords,
});

cy.get('[data-cy="passage-dropdown"]').click();

Expand Down Expand Up @@ -417,6 +436,23 @@ describe('MobileWorkflowSteps', () => {
cy.get('[role="menuitem"]').eq(0).should('contain.text', 'GEN 1:1');
});

it('does not open the dropdown when the section has only one passage', () => {
mountMobileWorkflowSteps({
isStepProgression: true,
section: mockSectionSinglePassage,
extraMemoryRecords: mockSectionPassageRecordsSingle,
});

cy.get('[data-cy="passage-dropdown"]')
.should('contain.text', 'GEN 1:1')
.find('[data-testid="ArrowDropDownIcon"]')
.should('not.exist');

cy.get('[data-cy="passage-dropdown"]').click();

cy.get('[role="menu"]').should('not.exist');
});

it('renders the step label as plain text when the current step has no tip', () => {
mountMobileWorkflowSteps({
isStepProgression: true,
Expand Down Expand Up @@ -467,6 +503,21 @@ describe('MobileWorkflowSteps', () => {
cy.get('[role="menuitem"]').should('have.length', 2);
});

it('does not open the dropdown when there is only one workflow step', () => {
mountMobileWorkflowSteps({
workflow: [{ id: 'step-1', label: 'Record' }],
});

cy.get('[data-cy="passage-dropdown"]')
.should('contain.text', 'Record')
.find('[data-testid="ArrowDropDownIcon"]')
.should('not.exist');

cy.get('[data-cy="passage-dropdown"]').click();

cy.get('[role="menu"]').should('not.exist');
});

it('blocks passage click while recording', () => {
mountMobileWorkflowSteps({
section: mockSection,
Expand Down Expand Up @@ -540,20 +591,4 @@ describe('MobileWorkflowSteps', () => {
cy.get('@setCurrentStep').should('not.have.been.called');
});
});

describe('spacer responsive behavior', () => {
it('hides the spacer below 840px to prevent extra horizontal scroll', () => {
cy.viewport(839, 600);
mountMobileWorkflowSteps({ isStepProgression: true });

cy.get('[data-cy="step-spacer"]').should('have.css', 'display', 'none');
});

it('shows the spacer at 840px and above to preserve parallelogram centering', () => {
cy.viewport(840, 600);
mountMobileWorkflowSteps({ isStepProgression: true });

cy.get('[data-cy="step-spacer"]').should('have.css', 'display', 'block');
});
});
});
Loading
Loading