mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-10-01 14:41:14 +00:00
committed by
Suzana Dirla
parent
14adbad1a9
commit
9fef05b69f
@@ -7,7 +7,6 @@
|
||||
[hideSidenav]="hideSidenav"
|
||||
[expandedSidenav]="expandedSidenav"
|
||||
(expanded)="onExpanded($event)"
|
||||
[direction]="direction"
|
||||
>
|
||||
<adf-sidenav-layout-header>
|
||||
<ng-template>
|
||||
|
@@ -195,43 +195,4 @@ 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']);
|
||||
});
|
||||
});
|
||||
|
@@ -26,9 +26,7 @@
|
||||
import {
|
||||
AppConfigService,
|
||||
SidenavLayoutComponent,
|
||||
UserPreferencesService,
|
||||
LanguageItem,
|
||||
AppConfigValues
|
||||
UserPreferencesService
|
||||
} from '@alfresco/adf-core';
|
||||
import {
|
||||
Component,
|
||||
@@ -151,18 +149,6 @@ export class AppLayoutComponent implements OnInit, OnDestroy {
|
||||
takeUntil(this.onDestroy$)
|
||||
)
|
||||
.subscribe(() => this.store.dispatch(new SetSelectedNodesAction([])));
|
||||
|
||||
this.userPreferenceService
|
||||
.select('textOrientation')
|
||||
.subscribe((textOrientation: Directionality) => {
|
||||
this.direction = textOrientation;
|
||||
});
|
||||
|
||||
this.userPreferenceService.set(
|
||||
'textOrientation',
|
||||
this.getCurrentLanguage(this.userPreferenceService.get('locale'))
|
||||
.direction || 'ltr'
|
||||
);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
@@ -221,12 +207,4 @@ export class AppLayoutComponent implements OnInit, OnDestroy {
|
||||
|
||||
return expand;
|
||||
}
|
||||
|
||||
private getCurrentLanguage(key: string): LanguageItem {
|
||||
return (
|
||||
this.appConfigService
|
||||
.get<Array<LanguageItem>>(AppConfigValues.APP_CONFIG_LANGUAGES_KEY)
|
||||
.find(language => language.key === key) || <LanguageItem>{}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user