mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-08-07 17:48:54 +00:00
[ADF-1103] Add custom tslint rules to avoid unwanted Class and File name prefix (#2087)
* custom tslint rules adf project name files * filename and class prefix rule * filename process service mock * fix spec filename * fix demo shell * rename mock * alias deprecated name class * core rename services * fix pacakge.json adf-rules * add exclude in whitelist
This commit is contained in:
committed by
Denys Vuika
parent
acb69503e7
commit
8b93c0b5ed
@@ -24,7 +24,7 @@ import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@a
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class AdfToolbarComponent {
|
||||
export class ToolbarComponent {
|
||||
|
||||
@Input()
|
||||
title: string = '';
|
||||
|
@@ -20,6 +20,6 @@ import { Directive, ViewContainerRef } from '@angular/core';
|
||||
@Directive({
|
||||
selector: '[adf-card-view-content-proxy]'
|
||||
})
|
||||
export class AdfCardViewContentProxyDirective {
|
||||
export class CardViewContentProxyDirective {
|
||||
constructor(public viewContainerRef: ViewContainerRef) { }
|
||||
}
|
@@ -19,8 +19,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MdDatepickerModule, MdInputModule, MdNativeDateModule } from '@angular/material';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { CardViewDateItemModel } from '../../models/card-view-dateitem.model';
|
||||
import { CardViewUpdateService } from '../../services/adf-card-view-update.service';
|
||||
import { CardViewDateItemComponent } from './adf-card-view-dateitem.component';
|
||||
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
||||
import { CardViewDateItemComponent } from './card-view-dateitem.component';
|
||||
|
||||
describe('CardViewDateItemComponent', () => {
|
||||
|
@@ -18,12 +18,12 @@
|
||||
import { Component, Input, ViewChild } from '@angular/core';
|
||||
import { MdDatepicker } from '@angular/material';
|
||||
import { CardViewDateItemModel } from '../../models/card-view-dateitem.model';
|
||||
import { CardViewUpdateService } from '../../services/adf-card-view-update.service';
|
||||
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-card-view-dateitem',
|
||||
templateUrl: './adf-card-view-dateitem.component.html',
|
||||
styleUrls: ['./adf-card-view-dateitem.component.scss']
|
||||
templateUrl: './card-view-dateitem.component.html',
|
||||
styleUrls: ['./card-view-dateitem.component.scss']
|
||||
})
|
||||
export class CardViewDateItemComponent {
|
||||
@Input()
|
@@ -20,8 +20,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
|
||||
import { CardViewItem } from '../../interface/card-view-item.interface';
|
||||
import { AdfCardViewContentProxyDirective } from './adf-card-view-content-proxy.directive';
|
||||
import { CardViewItemDispatcherComponent } from './adf-card-view-item-dispatcher.component';
|
||||
import { CardViewContentProxyDirective } from './card-view-content-proxy.directive';
|
||||
import { CardViewItemDispatcherComponent } from './card-view-item-dispatcher.component';
|
||||
|
||||
@Component({
|
||||
selector: 'whatever-you-want-to-have',
|
||||
@@ -43,7 +43,7 @@ describe('CardViewItemDispatcherComponent', () => {
|
||||
declarations: [
|
||||
CardViewItemDispatcherComponent,
|
||||
CardViewShinyCustomElementItemComponent,
|
||||
AdfCardViewContentProxyDirective
|
||||
CardViewContentProxyDirective
|
||||
],
|
||||
providers: []
|
||||
});
|
@@ -24,7 +24,7 @@ import {
|
||||
ViewChild
|
||||
} from '@angular/core';
|
||||
import { CardViewItem } from '../../interface/card-view-item.interface';
|
||||
import { AdfCardViewContentProxyDirective } from './adf-card-view-content-proxy.directive';
|
||||
import { CardViewContentProxyDirective } from './card-view-content-proxy.directive';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-card-view-item-dispatcher',
|
||||
@@ -37,8 +37,8 @@ export class CardViewItemDispatcherComponent implements OnChanges {
|
||||
@Input()
|
||||
editable: boolean;
|
||||
|
||||
@ViewChild(AdfCardViewContentProxyDirective)
|
||||
private content: AdfCardViewContentProxyDirective;
|
||||
@ViewChild(CardViewContentProxyDirective)
|
||||
private content: CardViewContentProxyDirective;
|
||||
|
||||
private loaded: boolean = false;
|
||||
private componentReference: any = null;
|
@@ -21,8 +21,8 @@ import { MdDatepickerModule, MdIconModule, MdInputModule, MdNativeDateModule } f
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { CardViewTextItemModel } from '../../models/card-view-textitem.model';
|
||||
import { CardViewUpdateService } from '../../services/adf-card-view-update.service';
|
||||
import { CardViewTextItemComponent } from './adf-card-view-textitem.component';
|
||||
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
||||
import { CardViewTextItemComponent } from './card-view-textitem.component';
|
||||
|
||||
describe('CardViewTextItemComponent', () => {
|
||||
|
@@ -17,12 +17,12 @@
|
||||
|
||||
import { Component, Input, OnChanges, ViewChild } from '@angular/core';
|
||||
import { CardViewTextItemModel } from '../../models/card-view-textitem.model';
|
||||
import { CardViewUpdateService } from '../../services/adf-card-view-update.service';
|
||||
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-card-view-textitem',
|
||||
templateUrl: './adf-card-view-textitem.component.html',
|
||||
styleUrls: ['./adf-card-view-textitem.component.scss']
|
||||
templateUrl: './card-view-textitem.component.html',
|
||||
styleUrls: ['./card-view-textitem.component.scss']
|
||||
})
|
||||
export class CardViewTextItemComponent implements OnChanges {
|
||||
@Input()
|
@@ -22,12 +22,12 @@ import { By } from '@angular/platform-browser';
|
||||
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
|
||||
import { CardViewDateItemModel } from '../../models/card-view-dateitem.model';
|
||||
import { CardViewTextItemModel } from '../../models/card-view-textitem.model';
|
||||
import { CardViewUpdateService } from '../../services/adf-card-view-update.service';
|
||||
import { AdfCardViewContentProxyDirective } from './adf-card-view-content-proxy.directive';
|
||||
import { CardViewDateItemComponent } from './adf-card-view-dateitem.component';
|
||||
import { CardViewItemDispatcherComponent } from './adf-card-view-item-dispatcher.component';
|
||||
import { CardViewTextItemComponent } from './adf-card-view-textitem.component';
|
||||
import { CardViewComponent } from './adf-card-view.component';
|
||||
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
||||
import { CardViewContentProxyDirective } from './card-view-content-proxy.directive';
|
||||
import { CardViewDateItemComponent } from './card-view-dateitem.component';
|
||||
import { CardViewItemDispatcherComponent } from './card-view-item-dispatcher.component';
|
||||
import { CardViewTextItemComponent } from './card-view-textitem.component';
|
||||
import { CardViewComponent } from './card-view.component';
|
||||
|
||||
describe('AdfCardView', () => {
|
||||
|
||||
@@ -46,7 +46,7 @@ describe('AdfCardView', () => {
|
||||
declarations: [
|
||||
CardViewComponent,
|
||||
CardViewItemDispatcherComponent,
|
||||
AdfCardViewContentProxyDirective,
|
||||
CardViewContentProxyDirective,
|
||||
CardViewTextItemComponent,
|
||||
CardViewDateItemComponent
|
||||
],
|
@@ -20,8 +20,8 @@ import { CardViewItem } from '../../interface/card-view-item.interface';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-card-view',
|
||||
templateUrl: './adf-card-view.component.html',
|
||||
styleUrls: ['./adf-card-view.component.scss']
|
||||
templateUrl: './card-view.component.html',
|
||||
styleUrls: ['./card-view.component.scss']
|
||||
})
|
||||
export class CardViewComponent {
|
||||
@Input()
|
@@ -19,11 +19,11 @@ import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MdButtonModule, MdDatepickerModule, MdIconModule, MdInputModule, MdNativeDateModule } from '@angular/material';
|
||||
import { AdfCardViewContentProxyDirective } from './adf-card-view-content-proxy.directive';
|
||||
import { CardViewDateItemComponent } from './adf-card-view-dateitem.component';
|
||||
import { CardViewItemDispatcherComponent } from './adf-card-view-item-dispatcher.component';
|
||||
import { CardViewTextItemComponent } from './adf-card-view-textitem.component';
|
||||
import { CardViewComponent } from './adf-card-view.component';
|
||||
import { CardViewContentProxyDirective } from './card-view-content-proxy.directive';
|
||||
import { CardViewDateItemComponent } from './card-view-dateitem.component';
|
||||
import { CardViewItemDispatcherComponent } from './card-view-item-dispatcher.component';
|
||||
import { CardViewTextItemComponent } from './card-view-textitem.component';
|
||||
import { CardViewComponent } from './card-view.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -38,7 +38,7 @@ import { CardViewComponent } from './adf-card-view.component';
|
||||
declarations: [
|
||||
CardViewComponent,
|
||||
CardViewItemDispatcherComponent,
|
||||
AdfCardViewContentProxyDirective,
|
||||
CardViewContentProxyDirective,
|
||||
CardViewTextItemComponent,
|
||||
CardViewDateItemComponent
|
||||
],
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { AlfrescoContentService } from './alfresco-content.service';
|
||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||
import { AppConfigModule } from './app-config.service';
|
||||
@@ -32,7 +32,7 @@ declare let jasmine: any;
|
||||
describe('AlfrescoContentService', () => {
|
||||
|
||||
let contentService: AlfrescoContentService;
|
||||
let authService: AlfrescoAuthenticationService;
|
||||
let authService: AuthenticationService;
|
||||
let settingsService: AlfrescoSettingsService;
|
||||
let storage: StorageService;
|
||||
let node: any;
|
||||
@@ -49,7 +49,7 @@ describe('AlfrescoContentService', () => {
|
||||
providers: [
|
||||
AlfrescoApiService,
|
||||
AlfrescoContentService,
|
||||
AlfrescoAuthenticationService,
|
||||
AuthenticationService,
|
||||
AlfrescoSettingsService,
|
||||
StorageService,
|
||||
UserPreferencesService,
|
||||
@@ -60,7 +60,7 @@ describe('AlfrescoContentService', () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
authService = TestBed.get(AlfrescoAuthenticationService);
|
||||
authService = TestBed.get(AuthenticationService);
|
||||
settingsService = TestBed.get(AlfrescoSettingsService);
|
||||
contentService = TestBed.get(AlfrescoContentService);
|
||||
storage = TestBed.get(StorageService);
|
||||
|
@@ -19,7 +19,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Observable, Subject } from 'rxjs/Rx';
|
||||
import { FolderCreatedEvent } from '../events/folder-created.event';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { LogService } from './log.service';
|
||||
|
||||
@Injectable()
|
||||
@@ -27,7 +27,7 @@ export class AlfrescoContentService {
|
||||
|
||||
folderCreated: Subject<FolderCreatedEvent> = new Subject<FolderCreatedEvent>();
|
||||
|
||||
constructor(public authService: AlfrescoAuthenticationService,
|
||||
constructor(public authService: AuthenticationService,
|
||||
public apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||
import { AppConfigModule } from './app-config.service';
|
||||
import { AuthGuardBpm } from './auth-guard-bpm.service';
|
||||
@@ -44,7 +44,7 @@ describe('AuthGuardService BPM', () => {
|
||||
AuthGuardBpm,
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoApiService,
|
||||
AlfrescoAuthenticationService,
|
||||
AuthenticationService,
|
||||
StorageService,
|
||||
UserPreferencesService,
|
||||
{ provide: CookieService, useClass: CookieServiceMock },
|
||||
@@ -54,7 +54,7 @@ describe('AuthGuardService BPM', () => {
|
||||
}));
|
||||
|
||||
it('if the alfresco js api is logged in should canActivate be true',
|
||||
async(inject([AuthGuardBpm, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
async(inject([AuthGuardBpm, Router, AlfrescoSettingsService, StorageService, AuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
spyOn(router, 'navigate');
|
||||
|
||||
authService.isBpmLoggedIn = () => {
|
||||
@@ -67,7 +67,7 @@ describe('AuthGuardService BPM', () => {
|
||||
);
|
||||
|
||||
it('if the alfresco js api is NOT logged in should canActivate be false',
|
||||
async(inject([AuthGuardBpm, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
async(inject([AuthGuardBpm, Router, AlfrescoSettingsService, StorageService, AuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
|
||||
spyOn(router, 'navigate');
|
||||
|
||||
|
@@ -22,11 +22,11 @@ import {
|
||||
RouterStateSnapshot
|
||||
} from '@angular/router';
|
||||
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
|
||||
@Injectable()
|
||||
export class AuthGuardBpm implements CanActivate, CanActivateChild {
|
||||
constructor(private authService: AlfrescoAuthenticationService, private router: Router) {}
|
||||
constructor(private authService: AuthenticationService, private router: Router) {}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||
// let url: string = state.url;
|
||||
|
@@ -21,7 +21,7 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||
import { AppConfigModule } from './app-config.service';
|
||||
import { AuthGuardEcm } from './auth-guard-ecm.service';
|
||||
@@ -44,7 +44,7 @@ describe('AuthGuardService ECM', () => {
|
||||
AuthGuardEcm,
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoApiService,
|
||||
AlfrescoAuthenticationService,
|
||||
AuthenticationService,
|
||||
StorageService,
|
||||
UserPreferencesService,
|
||||
{ provide: CookieService, useClass: CookieServiceMock },
|
||||
@@ -54,7 +54,7 @@ describe('AuthGuardService ECM', () => {
|
||||
}));
|
||||
|
||||
it('if the alfresco js api is logged in should canActivate be true',
|
||||
async(inject([AuthGuardEcm, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
async(inject([AuthGuardEcm, Router, AlfrescoSettingsService, StorageService, AuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
spyOn(router, 'navigate');
|
||||
|
||||
authService.isEcmLoggedIn = () => {
|
||||
@@ -67,7 +67,7 @@ describe('AuthGuardService ECM', () => {
|
||||
);
|
||||
|
||||
it('if the alfresco js api is NOT logged in should canActivate be false',
|
||||
async(inject([AuthGuardEcm, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
async(inject([AuthGuardEcm, Router, AlfrescoSettingsService, StorageService, AuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
|
||||
spyOn(router, 'navigate');
|
||||
|
||||
|
@@ -22,11 +22,11 @@ import {
|
||||
RouterStateSnapshot
|
||||
} from '@angular/router';
|
||||
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
|
||||
@Injectable()
|
||||
export class AuthGuardEcm implements CanActivate, CanActivateChild {
|
||||
constructor(private authService: AlfrescoAuthenticationService, private router: Router) {}
|
||||
constructor(private authService: AuthenticationService, private router: Router) {}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||
// let url: string = state.url;
|
||||
|
@@ -21,7 +21,7 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||
import { AppConfigModule } from './app-config.service';
|
||||
import { AuthGuard } from './auth-guard.service';
|
||||
@@ -42,7 +42,7 @@ describe('AuthGuardService', () => {
|
||||
AuthGuard,
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoApiService,
|
||||
AlfrescoAuthenticationService,
|
||||
AuthenticationService,
|
||||
UserPreferencesService,
|
||||
StorageService,
|
||||
{ provide: CookieService, useClass: CookieServiceMock },
|
||||
@@ -52,7 +52,7 @@ describe('AuthGuardService', () => {
|
||||
}));
|
||||
|
||||
it('if the alfresco js api is logged in should canActivate be true',
|
||||
async(inject([AuthGuard, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
async(inject([AuthGuard, Router, AlfrescoSettingsService, StorageService, AuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
spyOn(router, 'navigate');
|
||||
|
||||
authService.isLoggedIn = () => {
|
||||
@@ -65,7 +65,7 @@ describe('AuthGuardService', () => {
|
||||
);
|
||||
|
||||
it('if the alfresco js api is NOT logged in should canActivate be false',
|
||||
async(inject([AuthGuard, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
async(inject([AuthGuard, Router, AlfrescoSettingsService, StorageService, AuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
|
||||
spyOn(router, 'navigate');
|
||||
|
||||
|
@@ -22,11 +22,11 @@ import {
|
||||
RouterStateSnapshot
|
||||
} from '@angular/router';
|
||||
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
|
||||
@Injectable()
|
||||
export class AuthGuard implements CanActivate, CanActivateChild {
|
||||
constructor(private authService: AlfrescoAuthenticationService, private router: Router) {}
|
||||
constructor(private authService: AuthenticationService, private router: Router) {}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||
// let url: string = state.url;
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||
import { AppConfigModule } from './app-config.service';
|
||||
import { CookieService } from './cookie.service';
|
||||
@@ -28,9 +28,9 @@ import { UserPreferencesService } from './user-preferences.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
describe('AlfrescoAuthenticationService', () => {
|
||||
describe('AuthenticationService', () => {
|
||||
let apiService: AlfrescoApiService;
|
||||
let authService: AlfrescoAuthenticationService;
|
||||
let authService: AuthenticationService;
|
||||
let settingsService: AlfrescoSettingsService;
|
||||
let preferences: UserPreferencesService;
|
||||
let storage: StorageService;
|
||||
@@ -44,7 +44,7 @@ describe('AlfrescoAuthenticationService', () => {
|
||||
providers: [
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoApiService,
|
||||
AlfrescoAuthenticationService,
|
||||
AuthenticationService,
|
||||
StorageService,
|
||||
UserPreferencesService,
|
||||
{ provide: CookieService, useClass: CookieServiceMock },
|
||||
@@ -55,7 +55,7 @@ describe('AlfrescoAuthenticationService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
apiService = TestBed.get(AlfrescoApiService);
|
||||
authService = TestBed.get(AlfrescoAuthenticationService);
|
||||
authService = TestBed.get(AuthenticationService);
|
||||
settingsService = TestBed.get(AlfrescoSettingsService);
|
||||
preferences = TestBed.get(UserPreferencesService);
|
||||
cookie = TestBed.get(CookieService);
|
@@ -27,7 +27,7 @@ const REMEMBER_ME_COOKIE_KEY = 'ALFRESCO_REMEMBER_ME';
|
||||
const REMEMBER_ME_UNTIL = 1000 * 60 * 60 * 24 * 30 ;
|
||||
|
||||
@Injectable()
|
||||
export class AlfrescoAuthenticationService {
|
||||
export class AuthenticationService {
|
||||
|
||||
onLogin: Subject<any> = new Subject<any>();
|
||||
onLogout: Subject<any> = new Subject<any>();
|
||||
@@ -211,7 +211,7 @@ export class AlfrescoAuthenticationService {
|
||||
*
|
||||
* @returns {string} The username value
|
||||
*
|
||||
* @memberof AlfrescoAuthenticationService
|
||||
* @memberof AuthenticationService
|
||||
*/
|
||||
getEcmUsername(): string {
|
||||
return this.alfrescoApi.getInstance().ecmAuth.username;
|
||||
@@ -222,7 +222,7 @@ export class AlfrescoAuthenticationService {
|
||||
*
|
||||
* @returns {string} The username value
|
||||
*
|
||||
* @memberof AlfrescoAuthenticationService
|
||||
* @memberof AuthenticationService
|
||||
*/
|
||||
getBpmUsername(): string {
|
||||
return this.alfrescoApi.getInstance().bpmAuth.username;
|
@@ -1,36 +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.
|
||||
*/
|
||||
|
||||
export * from './content.service';
|
||||
export * from './storage.service';
|
||||
export * from './cookie.service';
|
||||
export * from './alfresco-api.service';
|
||||
export * from './alfresco-settings.service';
|
||||
export * from './alfresco-content.service';
|
||||
export * from './renditions.service';
|
||||
export * from './auth-guard.service';
|
||||
export * from './auth-guard-ecm.service';
|
||||
export * from './auth-guard-bpm.service';
|
||||
export * from './notification.service';
|
||||
export * from './log.service';
|
||||
export * from './alfresco-authentication.service';
|
||||
export * from './alfresco-translation.service';
|
||||
export * from './alfresco-translate-loader.service';
|
||||
export * from './app-config.service';
|
||||
export * from './thumbnail.service';
|
||||
export * from './upload.service';
|
||||
export * from './adf-card-view-update.service';
|
@@ -19,7 +19,7 @@ import { async, TestBed } from '@angular/core/testing';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { AlfrescoContentService } from './alfresco-content.service';
|
||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||
import { AppConfigService } from './app-config.service';
|
||||
@@ -40,7 +40,7 @@ describe('ThumbnailService', () => {
|
||||
],
|
||||
providers: [
|
||||
UserPreferencesService,
|
||||
AlfrescoAuthenticationService,
|
||||
AuthenticationService,
|
||||
AlfrescoContentService,
|
||||
AlfrescoSettingsService,
|
||||
AppConfigService,
|
||||
|
@@ -21,8 +21,8 @@ import { HttpModule, Response, ResponseOptions, XHRBackend } from '@angular/http
|
||||
import { MockBackend, MockConnection } from '@angular/http/testing';
|
||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import { AlfrescoTranslateLoader } from './alfresco-translate-loader.service';
|
||||
import { AlfrescoTranslationService } from './alfresco-translation.service';
|
||||
import { AlfrescoTranslateLoader } from './translate-loader.service';
|
||||
import { TranslationService } from './translation.service';
|
||||
import { LogService } from './log.service';
|
||||
|
||||
let componentJson1 = ' {"TEST": "This is a test", "TEST2": "This is another test"} ' ;
|
||||
@@ -34,7 +34,7 @@ const mockBackendResponse = (connection: MockConnection, response: string) => {
|
||||
describe('TranslateLoader', () => {
|
||||
let injector: Injector;
|
||||
let backend: any;
|
||||
let alfrescoTranslationService: AlfrescoTranslationService;
|
||||
let translationService: TranslationService;
|
||||
let connection: MockConnection; // this will be set when a new connection is emitted from the backend.
|
||||
let customLoader;
|
||||
|
||||
@@ -50,22 +50,22 @@ describe('TranslateLoader', () => {
|
||||
})
|
||||
],
|
||||
providers: [
|
||||
AlfrescoTranslationService,
|
||||
TranslationService,
|
||||
LogService,
|
||||
{provide: XHRBackend, useClass: MockBackend}
|
||||
]
|
||||
});
|
||||
injector = getTestBed();
|
||||
backend = injector.get(XHRBackend);
|
||||
alfrescoTranslationService = injector.get(AlfrescoTranslationService);
|
||||
translationService = injector.get(TranslationService);
|
||||
backend.connections.subscribe((c: MockConnection) => connection = c);
|
||||
customLoader = alfrescoTranslationService.translate.currentLoader;
|
||||
customLoader = translationService.translate.currentLoader;
|
||||
});
|
||||
|
||||
it('should be able to provide any TranslateLoader', () => {
|
||||
expect(alfrescoTranslationService).toBeDefined();
|
||||
expect(alfrescoTranslationService.translate.currentLoader).toBeDefined();
|
||||
expect(alfrescoTranslationService.translate.currentLoader instanceof AlfrescoTranslateLoader).toBeTruthy();
|
||||
expect(translationService).toBeDefined();
|
||||
expect(translationService.translate.currentLoader).toBeDefined();
|
||||
expect(translationService.translate.currentLoader instanceof AlfrescoTranslateLoader).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should add the component to the list', () => {
|
@@ -21,18 +21,18 @@ import { HttpModule, Response, ResponseOptions, XHRBackend } from '@angular/http
|
||||
import { MockBackend, MockConnection } from '@angular/http/testing';
|
||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import { AlfrescoTranslateLoader } from './alfresco-translate-loader.service';
|
||||
import { AlfrescoTranslationService } from './alfresco-translation.service';
|
||||
import { AlfrescoTranslateLoader } from './translate-loader.service';
|
||||
import { TranslationService } from './translation.service';
|
||||
import { LogService } from './log.service';
|
||||
|
||||
const mockBackendResponse = (connection: MockConnection, response: string) => {
|
||||
connection.mockRespond(new Response(new ResponseOptions({body: response})));
|
||||
};
|
||||
|
||||
describe('AlfrescoTranslationService', () => {
|
||||
describe('TranslationService', () => {
|
||||
let injector: Injector;
|
||||
let backend: any;
|
||||
let alfrescoTranslationService: AlfrescoTranslationService;
|
||||
let translationService: TranslationService;
|
||||
let connection: MockConnection; // this will be set when a new connection is emitted from the backend.
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -47,25 +47,25 @@ describe('AlfrescoTranslationService', () => {
|
||||
})
|
||||
],
|
||||
providers: [
|
||||
AlfrescoTranslationService,
|
||||
TranslationService,
|
||||
LogService,
|
||||
{provide: XHRBackend, useClass: MockBackend}
|
||||
]
|
||||
});
|
||||
injector = getTestBed();
|
||||
backend = injector.get(XHRBackend);
|
||||
alfrescoTranslationService = injector.get(AlfrescoTranslationService);
|
||||
translationService = injector.get(TranslationService);
|
||||
backend.connections.subscribe((c: MockConnection) => connection = c);
|
||||
alfrescoTranslationService.addTranslationFolder('fake-name', 'fake-path');
|
||||
translationService.addTranslationFolder('fake-name', 'fake-path');
|
||||
});
|
||||
|
||||
it('is defined', () => {
|
||||
expect(AlfrescoTranslationService).toBeDefined();
|
||||
expect(alfrescoTranslationService instanceof AlfrescoTranslationService).toBeTruthy();
|
||||
expect(translationService).toBeDefined();
|
||||
expect(translationService instanceof TranslationService).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should be able to get translations of the KEY: TEST', () => {
|
||||
alfrescoTranslationService.get('TEST').subscribe((res: string) => {
|
||||
translationService.get('TEST').subscribe((res: string) => {
|
||||
expect(res).toEqual('This is a test');
|
||||
});
|
||||
|
||||
@@ -73,7 +73,7 @@ describe('AlfrescoTranslationService', () => {
|
||||
});
|
||||
|
||||
it('should be able to get translations of the KEY: TEST2', () => {
|
||||
alfrescoTranslationService.get('TEST2').subscribe((res: string) => {
|
||||
translationService.get('TEST2').subscribe((res: string) => {
|
||||
expect(res).toEqual('This is another test');
|
||||
});
|
||||
|
@@ -18,10 +18,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { AlfrescoTranslateLoader } from './alfresco-translate-loader.service';
|
||||
import { AlfrescoTranslateLoader } from './translate-loader.service';
|
||||
|
||||
@Injectable()
|
||||
export class AlfrescoTranslationService {
|
||||
export class TranslationService {
|
||||
defaultLang: string = 'en';
|
||||
userLang: string = 'en';
|
||||
customLoader: AlfrescoTranslateLoader;
|
@@ -19,7 +19,7 @@ import { EventEmitter } from '@angular/core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { FileModel, FileUploadOptions } from '../models/file.model';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||
import { AppConfigModule } from './app-config.service';
|
||||
import { StorageService } from './storage.service';
|
||||
@@ -44,7 +44,7 @@ describe('UploadService', () => {
|
||||
UploadService,
|
||||
AlfrescoApiService,
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoAuthenticationService,
|
||||
AuthenticationService,
|
||||
StorageService
|
||||
]
|
||||
});
|
||||
|
Reference in New Issue
Block a user