mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge pull request #3461 from tdonohue/i18n_e2e_test
Add basic e2e testing for i18n
This commit is contained in:
@@ -10,4 +10,29 @@ describe('Header', () => {
|
|||||||
// Analyze <ds-header> for accessibility
|
// Analyze <ds-header> for accessibility
|
||||||
testA11y('ds-header');
|
testA11y('ds-header');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should allow for changing language to German (for example)', () => {
|
||||||
|
cy.visit('/');
|
||||||
|
|
||||||
|
// Click the language switcher (globe) in header
|
||||||
|
cy.get('a[data-test="lang-switch"]').click();
|
||||||
|
// Click on the "Deusch" language in dropdown
|
||||||
|
cy.get('#language-menu-list li').contains('Deutsch').click();
|
||||||
|
|
||||||
|
// HTML "lang" attribute should switch to "de"
|
||||||
|
cy.get('html').invoke('attr', 'lang').should('eq', 'de');
|
||||||
|
|
||||||
|
// Login menu should now be in German
|
||||||
|
cy.get('a[data-test="login-menu"]').contains('Anmelden');
|
||||||
|
|
||||||
|
// Change back to English from language switcher
|
||||||
|
cy.get('a[data-test="lang-switch"]').click();
|
||||||
|
cy.get('#language-menu-list li').contains('English').click();
|
||||||
|
|
||||||
|
// HTML "lang" attribute should switch to "en"
|
||||||
|
cy.get('html').invoke('attr', 'lang').should('eq', 'en');
|
||||||
|
|
||||||
|
// Login menu should now be in English
|
||||||
|
cy.get('a[data-test="login-menu"]').contains('Log In');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
aria-haspopup="menu"
|
aria-haspopup="menu"
|
||||||
[title]="'nav.language' | translate"
|
[title]="'nav.language' | translate"
|
||||||
(click)="$event.preventDefault()" data-toggle="dropdown" ngbDropdownToggle
|
(click)="$event.preventDefault()" data-toggle="dropdown" ngbDropdownToggle
|
||||||
|
data-test="lang-switch"
|
||||||
tabindex="0">
|
tabindex="0">
|
||||||
<i class="fas fa-globe-asia fa-lg fa-fw"></i>
|
<i class="fas fa-globe-asia fa-lg fa-fw"></i>
|
||||||
</a>
|
</a>
|
||||||
|
Reference in New Issue
Block a user