fix(i18n): localize shared MUI widget controls

This commit is contained in:
cesnimda
2026-11-11 13:21:57 +01:00
parent c172427fb2
commit cb9d039786
3 changed files with 41 additions and 3 deletions
@@ -85,6 +85,13 @@ try {
const titleId = await initialEdit.getAttribute('aria-labelledby');
assert.ok(titleId);
const edit = page.locator(`[role="dialog"][aria-labelledby="${titleId}"]`);
const assertSharedLabels = async lang => {
await expect(edit.locator('.MuiAutocomplete-popupIndicator')).toHaveAttribute('aria-label', lang === 'nb' ? 'Åpne' : 'Open');
await expect(edit.locator('.MuiAutocomplete-clearIndicator')).toHaveAttribute('aria-label', lang === 'nb' ? 'Tøm' : 'Clear');
await expect(page.locator('html')).toHaveAttribute('data-color-scheme', theme);
await expect(edit.getByRole('combobox', { name: translations[lang].company, exact: true })).toHaveValue('Synthetic school');
};
await assertSharedLabels(language);
if (flatEdit) {
await expect(edit.locator('.MuiDialogContent-root .MuiPaper-outlined')).toHaveCount(0);
for (const label of [copy.editJobApplicationDetails, copy.editJobStatusUpdate, copy.editJobRoleDetails, copy.editJobAttachmentsChecklist]) {
@@ -98,8 +105,10 @@ try {
await page.evaluate(value => { localStorage.setItem('uiLanguage', value); window.dispatchEvent(new StorageEvent('storage', { key: 'uiLanguage', newValue: value })); }, language === 'nb' ? 'en' : 'nb');
const otherCopy = translations[language === 'nb' ? 'en' : 'nb'];
await assertDay(edit.getByRole('group', { name: otherCopy.editJobDeadline, exact: true }), 23, language === 'nb' ? 'en' : 'nb');
await assertSharedLabels(language === 'nb' ? 'en' : 'nb');
await page.evaluate(value => { localStorage.setItem('uiLanguage', value); window.dispatchEvent(new StorageEvent('storage', { key: 'uiLanguage', newValue: value })); }, language);
await expect(edit.getByRole('textbox', { name: copy.editJobJobTitle, exact: true })).toHaveValue('Retain teacher draft');
await assertSharedLabels(language);
assert.equal(detailReads, reads); assert.equal(writes.length, 0);
for (const label of [copy.editJobAppliedOn, copy.editJobStatusChangedOn, copy.editJobReplyReceivedOn, copy.editJobFollowUpOn, copy.editJobDeadline]) await choose24(edit.getByRole('group', { name: label, exact: true }), label === copy.editJobDeadline);
if (flatEdit) await edit.locator('.MuiDialogContent-root').evaluate(node => { node.scrollTop = 0; });