mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-1600] Change translation (#2574)
* Change translation * Add browser test runner to scripts * Adding option to hide the My Files option * Add documentation and fix property's name
This commit is contained in:
committed by
Eugenio Romano
parent
b67ed7e545
commit
092e07c545
@@ -1,11 +1,14 @@
|
||||
<div id="site-dropdown-container" class="adf-site-dropdown-container">
|
||||
<mat-form-field>
|
||||
<mat-select class="adf-site-dropdown-list-element" id="site-dropdown"
|
||||
<mat-select
|
||||
class="adf-site-dropdown-list-element"
|
||||
id="site-dropdown"
|
||||
placeholder="{{'DROPDOWN.PLACEHOLDER_LABEL' | translate}}"
|
||||
floatPlaceholder="never"
|
||||
data-automation-id="site-my-files-select"
|
||||
[(ngModel)]="siteSelected"
|
||||
(ngModelChange)="selectedSite()">
|
||||
<mat-option id="default_site_option" [value]="DEFAULT_VALUE">{{'DROPDOWN.DEFAULT_OPTION' | translate}}</mat-option>
|
||||
<mat-option *ngIf="!hideMyFiles" data-automation-id="site-my-files-option" id="default_site_option" [value]="MY_FILES_VALUE">{{'DROPDOWN.MY_FILES_OPTION' | translate}}</mat-option>
|
||||
<mat-option *ngFor="let site of siteList" [value]="site.guid">
|
||||
{{ site.title }}
|
||||
</mat-option>
|
||||
|
@@ -89,6 +89,11 @@ describe('DropdownSitesComponent', () => {
|
||||
|
||||
describe('Rendering tests', () => {
|
||||
|
||||
function openSelectbox() {
|
||||
const selectBox = debug.query(By.css(('[data-automation-id="site-my-files-select"] .mat-select-trigger')));
|
||||
selectBox.triggerEventHandler('click', null);
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
jasmine.Ajax.install();
|
||||
});
|
||||
@@ -96,6 +101,7 @@ describe('DropdownSitesComponent', () => {
|
||||
afterEach(() => {
|
||||
jasmine.Ajax.uninstall();
|
||||
fixture.destroy();
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
|
||||
it('Dropdown sites should be renedered', async(() => {
|
||||
@@ -115,6 +121,31 @@ describe('DropdownSitesComponent', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should show the "My files" option by default', async(() => {
|
||||
fixture.detectChanges();
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({ status: 200, contentType: 'json', responseText: sitesList });
|
||||
|
||||
openSelectbox();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(window.document.querySelector('[data-automation-id="site-my-files-option"]')).not.toBeNull();
|
||||
});
|
||||
}));
|
||||
|
||||
it('should hide the "My files" option if the developer desires that way', async(() => {
|
||||
component.hideMyFiles = true;
|
||||
fixture.detectChanges();
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({ status: 200, contentType: 'json', responseText: sitesList });
|
||||
|
||||
openSelectbox();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(window.document.querySelector('[data-automation-id="site-my-files-option"]')).toBeNull();
|
||||
});
|
||||
}));
|
||||
|
||||
// todo: something wrong with the test itself
|
||||
xit('should load sites on init', async(() => {
|
||||
fixture.detectChanges();
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { SiteModel, SitesApiService } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({
|
||||
@@ -25,17 +25,19 @@ import { SiteModel, SitesApiService } from 'ng2-alfresco-core';
|
||||
})
|
||||
export class DropdownSitesComponent implements OnInit {
|
||||
|
||||
@Input()
|
||||
hideMyFiles: boolean = false;
|
||||
|
||||
@Output()
|
||||
change: EventEmitter<SiteModel> = new EventEmitter();
|
||||
|
||||
public DEFAULT_VALUE = 'default';
|
||||
public MY_FILES_VALUE = 'default';
|
||||
|
||||
siteList = [];
|
||||
|
||||
public siteSelected: string;
|
||||
|
||||
constructor(private sitesService: SitesApiService) {
|
||||
}
|
||||
constructor(private sitesService: SitesApiService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.sitesService.getSites().subscribe((result) => {
|
||||
@@ -45,7 +47,7 @@ export class DropdownSitesComponent implements OnInit {
|
||||
|
||||
selectedSite() {
|
||||
let siteFound;
|
||||
if (this.siteSelected === this.DEFAULT_VALUE) {
|
||||
if (this.siteSelected === this.MY_FILES_VALUE) {
|
||||
siteFound = new SiteModel();
|
||||
}else {
|
||||
siteFound = this.siteList.find( site => site.guid === this.siteSelected);
|
||||
|
@@ -27,7 +27,7 @@
|
||||
},
|
||||
"DROPDOWN": {
|
||||
"PLACEHOLDER_LABEL": "Site-Liste",
|
||||
"DEFAULT_OPTION": "Standard"
|
||||
"MY_FILES_OPTION": ""
|
||||
},
|
||||
"NODE_SELECTOR": {
|
||||
"CANCEL": "Abbrechen",
|
||||
|
@@ -33,7 +33,7 @@
|
||||
},
|
||||
"DROPDOWN": {
|
||||
"PLACEHOLDER_LABEL": "Site List",
|
||||
"DEFAULT_OPTION": "Default"
|
||||
"MY_FILES_OPTION": "My files"
|
||||
},
|
||||
"NODE_SELECTOR": {
|
||||
"CANCEL": "Cancel",
|
||||
|
@@ -27,7 +27,7 @@
|
||||
},
|
||||
"DROPDOWN": {
|
||||
"PLACEHOLDER_LABEL": "Lista de sitios",
|
||||
"DEFAULT_OPTION": "Predeterminada"
|
||||
"MY_FILES_OPTION": ""
|
||||
},
|
||||
"NODE_SELECTOR": {
|
||||
"CANCEL": "Cancelar",
|
||||
|
@@ -27,7 +27,7 @@
|
||||
},
|
||||
"DROPDOWN": {
|
||||
"PLACEHOLDER_LABEL": "Liste des Sites",
|
||||
"DEFAULT_OPTION": "Par défaut"
|
||||
"MY_FILES_OPTION": ""
|
||||
},
|
||||
"NODE_SELECTOR": {
|
||||
"CANCEL": "Annuler",
|
||||
|
@@ -27,7 +27,7 @@
|
||||
},
|
||||
"DROPDOWN": {
|
||||
"PLACEHOLDER_LABEL": "Elenco sito",
|
||||
"DEFAULT_OPTION": "Predefinito"
|
||||
"MY_FILES_OPTION": ""
|
||||
},
|
||||
"NODE_SELECTOR": {
|
||||
"CANCEL": "Annulla",
|
||||
|
@@ -27,7 +27,7 @@
|
||||
},
|
||||
"DROPDOWN": {
|
||||
"PLACEHOLDER_LABEL": "サイトリスト",
|
||||
"DEFAULT_OPTION": "デフォルト"
|
||||
"MY_FILES_OPTION": ""
|
||||
},
|
||||
"NODE_SELECTOR": {
|
||||
"CANCEL": "キャンセル",
|
||||
|
@@ -27,7 +27,7 @@
|
||||
},
|
||||
"DROPDOWN": {
|
||||
"PLACEHOLDER_LABEL": "Områdeliste",
|
||||
"DEFAULT_OPTION": "Standard"
|
||||
"MY_FILES_OPTION": ""
|
||||
},
|
||||
"NODE_SELECTOR": {
|
||||
"CANCEL": "Avbryt",
|
||||
|
@@ -27,7 +27,7 @@
|
||||
},
|
||||
"DROPDOWN": {
|
||||
"PLACEHOLDER_LABEL": "Lijst met sites",
|
||||
"DEFAULT_OPTION": "Standaard"
|
||||
"MY_FILES_OPTION": ""
|
||||
},
|
||||
"NODE_SELECTOR": {
|
||||
"CANCEL": "Annuleren",
|
||||
|
@@ -27,7 +27,7 @@
|
||||
},
|
||||
"DROPDOWN": {
|
||||
"PLACEHOLDER_LABEL": "Lista do Site",
|
||||
"DEFAULT_OPTION": "Padrão"
|
||||
"MY_FILES_OPTION": ""
|
||||
},
|
||||
"NODE_SELECTOR": {
|
||||
"CANCEL": "Cancelar",
|
||||
|
@@ -27,7 +27,7 @@
|
||||
},
|
||||
"DROPDOWN": {
|
||||
"PLACEHOLDER_LABEL": "Список сайтов",
|
||||
"DEFAULT_OPTION": "По умолчанию"
|
||||
"MY_FILES_OPTION": ""
|
||||
},
|
||||
"NODE_SELECTOR": {
|
||||
"CANCEL": "Отмена",
|
||||
|
@@ -27,7 +27,7 @@
|
||||
},
|
||||
"DROPDOWN": {
|
||||
"PLACEHOLDER_LABEL": "网站列表",
|
||||
"DEFAULT_OPTION": "默认值"
|
||||
"MY_FILES_OPTION": ""
|
||||
},
|
||||
"NODE_SELECTOR": {
|
||||
"CANCEL": "取消",
|
||||
|
@@ -230,7 +230,7 @@ export class UploadButtonComponent implements OnInit, OnChanges, NodePermissionS
|
||||
|
||||
this.translateService.get('FILE_UPLOAD.MESSAGES.EXCEED_MAX_FILE_SIZE', {fileName: file.name}).subscribe((message: string) => {
|
||||
this.error.emit(message);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
return acceptableSize;
|
||||
|
Reference in New Issue
Block a user