mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-10-01 14:41:14 +00:00
[ACA] 3.3.0 alpha update (#1108)
* update to 3.3.0 alpha * add arabic language * layout orientation support * take direction from parent * set direction based on language locale on initialization * test
This commit is contained in:
committed by
Denys Vuika
parent
1c18f6c555
commit
07c7f49af1
@@ -79,13 +79,16 @@ describe('AppLayoutComponent', () => {
|
||||
userPreference = TestBed.get(UserPreferencesService);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
appConfig.config.languages = [];
|
||||
appConfig.config.locale = 'en';
|
||||
});
|
||||
|
||||
describe('sidenav state', () => {
|
||||
it('should get state from configuration', () => {
|
||||
appConfig.config = {
|
||||
sideNav: {
|
||||
expandedSidenav: false,
|
||||
preserveState: false
|
||||
}
|
||||
appConfig.config.sideNav = {
|
||||
expandedSidenav: false,
|
||||
preserveState: false
|
||||
};
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -94,7 +97,7 @@ describe('AppLayoutComponent', () => {
|
||||
});
|
||||
|
||||
it('should resolve state to true is no configuration', () => {
|
||||
appConfig.config = {};
|
||||
appConfig.config.sidenav = {};
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -102,11 +105,9 @@ describe('AppLayoutComponent', () => {
|
||||
});
|
||||
|
||||
it('should get state from user settings as true', () => {
|
||||
appConfig.config = {
|
||||
sideNav: {
|
||||
expandedSidenav: false,
|
||||
preserveState: true
|
||||
}
|
||||
appConfig.config.sideNav = {
|
||||
expandedSidenav: false,
|
||||
preserveState: true
|
||||
};
|
||||
|
||||
spyOn(userPreference, 'get').and.callFake(key => {
|
||||
@@ -121,11 +122,9 @@ describe('AppLayoutComponent', () => {
|
||||
});
|
||||
|
||||
it('should get state from user settings as false', () => {
|
||||
appConfig.config = {
|
||||
sideNav: {
|
||||
expandedSidenav: false,
|
||||
preserveState: true
|
||||
}
|
||||
appConfig.config.sidenav = {
|
||||
expandedSidenav: false,
|
||||
preserveState: true
|
||||
};
|
||||
|
||||
spyOn(userPreference, 'get').and.callFake(key => {
|
||||
@@ -196,4 +195,43 @@ describe('AppLayoutComponent', () => {
|
||||
|
||||
expect(component.layout.container.toggleMenu).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should set direction `ltr` if no direction declared', () => {
|
||||
appConfig.config.languages = [
|
||||
{
|
||||
key: 'en'
|
||||
}
|
||||
];
|
||||
|
||||
spyOn(userPreference, 'get').and.callFake(key => {
|
||||
if (key === 'locale') {
|
||||
return 'en';
|
||||
}
|
||||
});
|
||||
|
||||
const spy = spyOn(userPreference, 'set');
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(spy.calls.mostRecent().args).toEqual(['textOrientation', 'ltr']);
|
||||
});
|
||||
|
||||
it('should set direction `rtl` based on locale language direction', () => {
|
||||
appConfig.config.languages = [
|
||||
{
|
||||
key: 'en',
|
||||
direction: 'rtl'
|
||||
}
|
||||
];
|
||||
|
||||
spyOn(userPreference, 'get').and.callFake(key => {
|
||||
if (key === 'locale') {
|
||||
return 'en';
|
||||
}
|
||||
});
|
||||
|
||||
const spy = spyOn(userPreference, 'set');
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(spy.calls.mostRecent().args).toEqual(['textOrientation', 'rtl']);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user