Work around data-testid issue by tagging the icon not the Item.

This commit is contained in:
Michael Kaye 2023-05-03 16:27:35 +01:00
parent a71a1c5c93
commit c70536996e
2 changed files with 13 additions and 3 deletions

View file

@ -116,8 +116,13 @@ export function UserMenu({
{(props) => (
<Menu {...props} label={t("User menu")} onAction={onAction}>
{items.map(({ key, icon: Icon, label, dataTestid }) => (
<Item key={key} textValue={label} data-testid={dataTestid}>
<Icon width={24} height={24} className={styles.menuIcon} />
<Item key={key} textValue={label}>
<Icon
width={24}
height={24}
className={styles.menuIcon}
data-testid={dataTestid}
/>
<Body overflowEllipsis>{label}</Body>
</Item>
))}

View file

@ -119,6 +119,7 @@ export function ProfileModal({ client, ...rest }: Props) {
placeholder={t("Display name")}
value={displayName}
onChange={onChangeDisplayName}
data-testid="profile_displayname"
/>
</FieldRow>
{error && (
@ -130,7 +131,11 @@ export function ProfileModal({ client, ...rest }: Props) {
<Button type="button" variant="secondary" onPress={onClose}>
Cancel
</Button>
<Button type="submit" disabled={loading}>
<Button
type="submit"
disabled={loading}
data-testid="profile_submit"
>
{loading ? t("Saving…") : t("Save")}
</Button>
</FieldRow>