mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-1026] i18n support for "empty" screen (#2066)
* i18n support for "empty" screen * fix unit tests * fix tests * fix tests
This commit is contained in:
committed by
Eugenio Romano
parent
403d5cea85
commit
2a16bf2f34
@@ -1,6 +1,6 @@
|
||||
<div id="adf-empty-list" class="empty-list_empty_template">
|
||||
<div class="empty-list__this-space-is-empty">{{emptyMsg}}</div>
|
||||
<div class="empty-list__drag-drop">{{dragDropMsg}}</div>
|
||||
<div class="empty-list__any-files-here-to-add">{{additionalMsg}}</div>
|
||||
<div class="empty-list__this-space-is-empty">{{ emptyMsg | translate }}</div>
|
||||
<div class="empty-list__drag-drop">{{ dragDropMsg | translate }}</div>
|
||||
<div class="empty-list__any-files-here-to-add">{{ additionalMsg | translate }}</div>
|
||||
<img [src]="emptyListImageUrl" class="empty-list__empty_doc_lib">
|
||||
</div>
|
||||
|
@@ -45,9 +45,9 @@ describe('AdfEmptyListComponentComponent', () => {
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement.querySelector('.empty-list__this-space-is-empty').innerHTML).toEqual('This list is empty');
|
||||
expect(fixture.nativeElement.querySelector('.empty-list__drag-drop').innerHTML).toEqual('Drag and drop');
|
||||
expect(fixture.nativeElement.querySelector('.empty-list__any-files-here-to-add').innerHTML).toEqual('any files here to add');
|
||||
expect(fixture.nativeElement.querySelector('.empty-list__this-space-is-empty').innerHTML).toEqual('ADF-DATATABLE.EMPTY.HEADER');
|
||||
expect(fixture.nativeElement.querySelector('.empty-list__drag-drop').innerHTML).toEqual('ADF-DATATABLE.EMPTY.DRAG-AND-DROP.TITLE');
|
||||
expect(fixture.nativeElement.querySelector('.empty-list__any-files-here-to-add').innerHTML).toEqual('ADF-DATATABLE.EMPTY.DRAG-AND-DROP.SUBTITLE');
|
||||
expect(fixture.nativeElement.querySelector('.empty-list__empty_doc_lib').src).toContain('empty_doc_lib');
|
||||
});
|
||||
}));
|
||||
|
@@ -28,16 +28,12 @@ export class AdfEmptyListComponent {
|
||||
emptyListImageUrl: string = require('../../assets/images/empty_doc_lib.svg');
|
||||
|
||||
@Input()
|
||||
emptyMsg: string = 'This list is empty';
|
||||
emptyMsg: string = 'ADF-DATATABLE.EMPTY.HEADER';
|
||||
|
||||
@Input()
|
||||
dragDropMsg: string = 'Drag and drop';
|
||||
dragDropMsg: string = 'ADF-DATATABLE.EMPTY.DRAG-AND-DROP.TITLE';
|
||||
|
||||
@Input()
|
||||
additionalMsg: string = 'any files here to add';
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
additionalMsg: string = 'ADF-DATATABLE.EMPTY.DRAG-AND-DROP.SUBTITLE';
|
||||
|
||||
}
|
||||
|
@@ -59,7 +59,6 @@ describe('DataTable', () => {
|
||||
beforeEach(() => {
|
||||
// reset MDL handler
|
||||
window['componentHandler'] = null;
|
||||
// dataTable = new DataTableComponent();
|
||||
|
||||
eventMock = {
|
||||
preventDefault: function () {
|
||||
@@ -211,14 +210,14 @@ describe('DataTable', () => {
|
||||
});
|
||||
|
||||
it('should initialize default adapter', () => {
|
||||
let table = new DataTableComponent(null, null);
|
||||
let table = new DataTableComponent(null, null, null);
|
||||
expect(table.data).toBeUndefined();
|
||||
table.ngOnChanges({'data': new SimpleChange('123', {}, true)});
|
||||
expect(table.data).toEqual(jasmine.any(ObjectDataTableAdapter));
|
||||
});
|
||||
|
||||
it('should load data table on onChange', () => {
|
||||
let table = new DataTableComponent(null, null);
|
||||
let table = new DataTableComponent(null, null, null);
|
||||
let data = new ObjectDataTableAdapter([], []);
|
||||
|
||||
expect(table.data).toBeUndefined();
|
||||
|
@@ -20,7 +20,7 @@ import {
|
||||
IterableDiffers, OnChanges, Optional, Output, SimpleChange, SimpleChanges, TemplateRef
|
||||
} from '@angular/core';
|
||||
import { MdCheckboxChange } from '@angular/material';
|
||||
import { DataColumnListComponent } from 'ng2-alfresco-core';
|
||||
import { AlfrescoTranslationService, DataColumnListComponent } from 'ng2-alfresco-core';
|
||||
import { Observable, Observer, Subscription } from 'rxjs/Rx';
|
||||
import { DataColumn, DataRow, DataRowEvent, DataSorting, DataTableAdapter } from '../../data/datatable-adapter';
|
||||
import { ObjectDataRow, ObjectDataTableAdapter } from '../../data/object-datatable-adapter';
|
||||
@@ -105,12 +105,17 @@ export class DataTableComponent implements AfterContentInit, AfterViewInit, OnCh
|
||||
private multiClickStreamSub: Subscription;
|
||||
|
||||
constructor(
|
||||
translateService: AlfrescoTranslationService,
|
||||
@Optional() private el: ElementRef,
|
||||
private differs: IterableDiffers) {
|
||||
if (differs) {
|
||||
this.differ = differs.find([]).create(null);
|
||||
}
|
||||
this.click$ = new Observable<DataRowEvent>(observer => this.clickObserver = observer).share();
|
||||
|
||||
if (translateService) {
|
||||
translateService.addTranslationFolder('ng2-alfresco-datatable', 'assets/ng2-alfresco-datatable');
|
||||
}
|
||||
}
|
||||
|
||||
ngAfterContentInit() {
|
||||
|
Reference in New Issue
Block a user