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
11 changes: 9 additions & 2 deletions packages/main/src/components/SelectDialog/SelectDialog.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@ describe('SelectDialog', () => {
);
cy.findByText('Select Dialog')
.should('have.css', 'grid-column-start', 'titleStart')
.should('have.css', 'grid-column-end', 'titleCenter');
.and('have.css', 'grid-column-end', 'titleCenter')
.and('have.attr', 'level', 'H1');
cy.mount(
<SelectDialog headerText="Select Dialog" headerTextAlignCenter open>
{listItems}
</SelectDialog>,
);
cy.findByText('Select Dialog').should('have.css', 'grid-area', 'titleCenter');
cy.findByText('Select Dialog').should('have.css', 'grid-area', 'titleCenter').and('have.attr', 'level', 'H1');
cy.mount(
<SelectDialog headerText="Select Dialog" open headerTextLevel={'H2'}>
{listItems}
</SelectDialog>,
);
cy.findByText('Select Dialog').should('have.attr', 'level', 'H2');
});

it('selection', () => {
Expand Down
11 changes: 10 additions & 1 deletion packages/main/src/components/SelectDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ export interface SelectDialogPropTypes
* Specifies the `headerText` alignment.
*/
headerTextAlignCenter?: boolean;
/**
* Defines the aria-level of the `headerText`.
* Available options are: `"H1"` to `"H6"`.
* This property does not influence the style of the `headerText`.
*
* @default "H1"
*/
headerTextLevel?: TitleLevel | keyof typeof TitleLevel;
/**
* Overwrites the default text for the confirmation button.
*/
Expand Down Expand Up @@ -150,6 +158,7 @@ const SelectDialog = forwardRef<DialogDomRef, SelectDialogPropTypes>((props, ref
growing,
headerText,
headerTextAlignCenter,
headerTextLevel = TitleLevel.H1,
listProps = {},
selectionMode = ListSelectionMode.Single,
numberOfSelectedItems,
Expand Down Expand Up @@ -309,7 +318,7 @@ const SelectDialog = forwardRef<DialogDomRef, SelectDialogPropTypes>((props, ref
)}
<Title
className={clsx(classNames.title, headerTextAlignCenter && classNames.titleCenterAlign)}
level={TitleLevel.H1}
level={headerTextLevel}
>
{headerText}
</Title>
Expand Down
Loading