fix(client): OS specific submit button text (#55631)

Co-authored-by: Lasse Jørgensen <28780271+lasjorg@users.noreply.github.com>
pull/55695/head
Gagan Bhullar 2024-07-28 15:58:23 -06:00 committed by GitHub
parent f5404dd049
commit 2b8169dc4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 47 additions and 1 deletions

View File

@ -293,7 +293,14 @@ const LowerJaw = ({
: t('buttons.check-code')
: t('buttons.check-code-2');
const submitButtonText = isDesktop
? isMacOS
? t('buttons.submit-and-go-3')
: t('buttons.submit-and-go-2')
: t('buttons.submit-and-go');
const showSignInButton = !isSignedIn && challengeIsCompleted;
return (
<div className='action-row-container'>
{showSignInButton && (
@ -319,7 +326,7 @@ const LowerJaw = ({
{...(!challengeIsCompleted && { 'aria-hidden': true })}
ref={submitButtonRef}
>
{t('buttons.submit-and-go')}
{submitButtonText}
</Button>
<div
className={

View File

@ -156,3 +156,42 @@ test('Should display the text of the check code button accordingly based on devi
).toBeVisible();
}
});
test('should display the text of submit and go to next challenge button accordingly based on device type', async ({
page,
isMobile,
browserName
}) => {
const editor = getEditors(page);
const checkButton = page.getByRole('button', { name: 'Check Your Code' });
await focusEditor({ page, isMobile });
await clearEditor({ page, browserName });
await editor.fill(
'<h2>Cat Photos</h2>\n<p>See more cat photos in our gallery.</p>'
);
await checkButton.click();
if (isMobile) {
await expect(
page.getByRole('button', {
name: 'Submit and go to next challenge',
exact: true
})
).toBeVisible();
} else if (browserName === 'webkit') {
await expect(
page.getByRole('button', {
name: 'Submit and go to next challenge (Command + Enter)'
})
).toBeVisible();
} else {
await expect(
page.getByRole('button', {
name: 'Submit and go to next challenge (Ctrl + Enter)'
})
).toBeVisible();
}
});