From 908e27a3ae135e44cd1629aaa059956f44b28702 Mon Sep 17 00:00:00 2001 From: Maurizio Vitale Date: Wed, 21 Jun 2017 16:10:22 +0100 Subject: [PATCH] [ADF-897] - ActivitiPeopleList - use the adf prefix (#2001) * Use the adf as prexif instead of activiti * Fix typo * Fix wrong import --- .../activiti-people-list.component.css | 0 .../activiti-people-list.component.html | 7 -- .../activiti-people-list.component.spec.ts | 100 ------------------ .../activiti-people-list.component.ts | 99 ----------------- 4 files changed, 206 deletions(-) delete mode 100644 ng2-components/ng2-activiti-tasklist/src/components/activiti-people-list.component.css delete mode 100644 ng2-components/ng2-activiti-tasklist/src/components/activiti-people-list.component.html delete mode 100644 ng2-components/ng2-activiti-tasklist/src/components/activiti-people-list.component.spec.ts delete mode 100644 ng2-components/ng2-activiti-tasklist/src/components/activiti-people-list.component.ts diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-list.component.css b/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-list.component.css deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-list.component.html b/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-list.component.html deleted file mode 100644 index ad652783f0..0000000000 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-list.component.html +++ /dev/null @@ -1,7 +0,0 @@ - - \ No newline at end of file diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-list.component.spec.ts b/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-list.component.spec.ts deleted file mode 100644 index 3ec6e1a778..0000000000 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-list.component.spec.ts +++ /dev/null @@ -1,100 +0,0 @@ -/*! - * @license - * Copyright 2016 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { ComponentFixture, TestBed, async } from '@angular/core/testing'; -import { Observable } from 'rxjs/Observable'; -import { CoreModule, AlfrescoTranslationService } from 'ng2-alfresco-core'; -import { ActivitiPeopleList } from './activiti-people-list.component'; -import { User, UserEventModel } from '../models/index'; -import { DataTableModule, ObjectDataRow, DataRowEvent, DataRowActionEvent } from 'ng2-alfresco-datatable'; - -declare let jasmine: any; - -const fakeUser: User = new User({ - id: '1', - firstName: 'fake-name', - lastName: 'fake-last', - email: 'fake@mail.com' -}); - -describe('ActivitiPeopleList', () => { - - let activitiPeopleListComponent: ActivitiPeopleList; - let fixture: ComponentFixture; - let element: HTMLElement; - let componentHandler; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [ - CoreModule.forRoot(), - DataTableModule - ], - declarations: [ - ActivitiPeopleList - ] - }).compileComponents().then(() => { - - let translateService = TestBed.get(AlfrescoTranslationService); - spyOn(translateService, 'addTranslationFolder').and.stub(); - spyOn(translateService.translate, 'get').and.callFake((key) => { return Observable.of(key); }); - - fixture = TestBed.createComponent(ActivitiPeopleList); - activitiPeopleListComponent = fixture.componentInstance; - element = fixture.nativeElement; - componentHandler = jasmine.createSpyObj('componentHandler', [ - 'upgradeAllRegistered' - ]); - - window['componentHandler'] = componentHandler; - fixture.detectChanges(); - }); - })); - - it('should emit row click event', (done) => { - let row = new ObjectDataRow(fakeUser); - let rowEvent = new DataRowEvent(row, null); - - activitiPeopleListComponent.clickRow.subscribe(selectedUser => { - expect(selectedUser.id).toEqual('1'); - expect(selectedUser.email).toEqual('fake@mail.com'); - expect(activitiPeopleListComponent.user.id).toEqual('1'); - expect(activitiPeopleListComponent.user.email).toEqual('fake@mail.com'); - done(); - }); - - activitiPeopleListComponent.selectUser(rowEvent); - }); - - it('should emit row action event', (done) => { - let row = new ObjectDataRow(fakeUser); - let removeObj = { - name: 'remove', - title: 'Remove' - }; - let rowActionEvent = new DataRowActionEvent(row, removeObj); - - activitiPeopleListComponent.clickAction.subscribe((selectedAction: UserEventModel) => { - expect(selectedAction.type).toEqual('remove'); - expect(selectedAction.value.id).toEqual('1'); - expect(selectedAction.value.email).toEqual('fake@mail.com'); - done(); - }); - - activitiPeopleListComponent.onExecuteRowAction(rowActionEvent); - }); -}); diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-list.component.ts b/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-list.component.ts deleted file mode 100644 index eeb4645130..0000000000 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-people-list.component.ts +++ /dev/null @@ -1,99 +0,0 @@ -/*! - * @license - * Copyright 2016 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Component, Input, Output, EventEmitter, ViewChild, ContentChild } from '@angular/core'; -import { User, UserEventModel } from '../models/index'; -import { DataColumnListComponent } from 'ng2-alfresco-core'; -import { DataTableComponent } from 'ng2-alfresco-datatable'; - -declare let componentHandler: any; - -@Component({ - selector: 'activiti-people-list', - templateUrl: './activiti-people-list.component.html', - styleUrls: ['./activiti-people-list.component.css'] -}) - -export class ActivitiPeopleList { - - @ContentChild(DataColumnListComponent) columnList: DataColumnListComponent; - - @ViewChild(DataTableComponent) - peopleDataTable: DataTableComponent; - - @Input() - users: User[]; - - @Input() - actions: boolean = false; - - @Output() - clickRow: EventEmitter = new EventEmitter(); - - @Output() - clickAction: EventEmitter = new EventEmitter(); - - user: User; - - constructor() { - } - - ngAfterContentInit() { - this.peopleDataTable.columnList = this.columnList; - } - - ngAfterViewInit() { - this.setupMaterialComponents(componentHandler); - } - - setupMaterialComponents(handler?: any): boolean { - // workaround for MDL issues with dynamic components - let isUpgraded: boolean = false; - if (handler) { - handler.upgradeAllRegistered(); - isUpgraded = true; - } - return isUpgraded; - } - - selectUser(event: any) { - this.user = event.value.obj; - this.clickRow.emit(this.user); - } - - hasActions(): boolean { - return this.actions; - } - - onShowRowActionsMenu(event: any) { - - let removeAction = { - title: 'Remove', - name: 'remove' - }; - - event.value.actions = [ - removeAction - ]; - } - - onExecuteRowAction(event: any) { - let args = event.value; - let action = args.action; - this.clickAction.emit(new UserEventModel({type: action.name, value: args.row.obj})); - } -}