mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
add alfresco core in viewer
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/*!
|
||||
* @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 { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
export class AlfrescoSettingsServiceMock {
|
||||
|
||||
static DEFAULT_HOST_ADDRESS: string = 'fakehost';
|
||||
|
||||
private providers: string[] = ['ECM', 'BPM'];
|
||||
|
||||
private _host: string = AlfrescoSettingsServiceMock.DEFAULT_HOST_ADDRESS;
|
||||
|
||||
public get ecmHost(): string {
|
||||
return this._host;
|
||||
}
|
||||
|
||||
getProviders(): string [] {
|
||||
return this.providers;
|
||||
}
|
||||
}
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { describe, expect, it, inject } from '@angular/core/testing';
|
||||
import { describe, expect, it, inject, beforeEachProviders } from '@angular/core/testing';
|
||||
import { TestComponentBuilder } from '@angular/compiler/testing';
|
||||
|
||||
import { PdfViewerComponent } from './pdfViewer.component';
|
||||
@@ -23,8 +23,20 @@ import { PDFJSmock } from './assets/PDFJS.mock';
|
||||
import { PDFViewermock } from './assets/PDFViewer.mock';
|
||||
import { EventMock } from './assets/event.mock';
|
||||
|
||||
import { HTTP_PROVIDERS } from '@angular/http';
|
||||
import { AlfrescoSettingsServiceMock } from '../src/assets/AlfrescoSettingsService.service.mock';
|
||||
import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||
|
||||
describe('PdfViewer', () => {
|
||||
|
||||
beforeEachProviders(() => {
|
||||
return [
|
||||
HTTP_PROVIDERS,
|
||||
{provide: AlfrescoSettingsService, useClass: AlfrescoSettingsServiceMock},
|
||||
{provide: AlfrescoAuthenticationService, useClass: AlfrescoAuthenticationService}
|
||||
];
|
||||
});
|
||||
|
||||
describe('View', () => {
|
||||
it('Canvas should be present', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
|
@@ -15,13 +15,25 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {describe, expect, it, inject } from '@angular/core/testing';
|
||||
import { describe, expect, it, inject, beforeEachProviders } from '@angular/core/testing';
|
||||
import { TestComponentBuilder } from '@angular/compiler/testing';
|
||||
import { ViewerComponent } from './viewer.component';
|
||||
import { EventMock } from './assets/event.mock';
|
||||
|
||||
import { HTTP_PROVIDERS } from '@angular/http';
|
||||
import { AlfrescoSettingsServiceMock } from '../src/assets/AlfrescoSettingsService.service.mock';
|
||||
import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||
|
||||
describe('ViewerComponent', () => {
|
||||
|
||||
beforeEachProviders(() => {
|
||||
return [
|
||||
HTTP_PROVIDERS,
|
||||
{provide: AlfrescoSettingsService, useClass: AlfrescoSettingsServiceMock},
|
||||
{provide: AlfrescoAuthenticationService, useClass: AlfrescoAuthenticationService}
|
||||
];
|
||||
});
|
||||
|
||||
describe('View', () => {
|
||||
it('shadow overlay should be present if is overlay mode', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
|
@@ -20,6 +20,7 @@ import { PdfViewerComponent } from './pdfViewer.component';
|
||||
import { ImgViewerComponent } from './imgViewer.component';
|
||||
import { NotSupportedFormat } from './notSupportedFormat.component';
|
||||
import { DOCUMENT } from '@angular/platform-browser';
|
||||
import { AlfrescoAuthenticationService} from 'ng2-alfresco-core';
|
||||
|
||||
declare let __moduleName: string;
|
||||
|
||||
@@ -38,6 +39,9 @@ export class ViewerComponent {
|
||||
@Input()
|
||||
fileName: string = null;
|
||||
|
||||
@Input()
|
||||
fileNodeId: string = null;
|
||||
|
||||
@Input()
|
||||
mimeType: string = null;
|
||||
|
||||
@@ -56,7 +60,7 @@ export class ViewerComponent {
|
||||
|
||||
extension: string;
|
||||
|
||||
constructor(private element: ElementRef, @Inject(DOCUMENT) private document) {
|
||||
constructor(private authService: AlfrescoAuthenticationService, private element: ElementRef, @Inject(DOCUMENT) private document) {
|
||||
}
|
||||
|
||||
ngOnChanges(changes) {
|
||||
@@ -71,7 +75,11 @@ export class ViewerComponent {
|
||||
let filenameFromUrl = this.getFilenameFromUrl(this.urlFile);
|
||||
this.displayName = this.fileName !== null ? this.fileName : filenameFromUrl;
|
||||
this.extension = this.getFileExtension(filenameFromUrl);
|
||||
} else if (this.fileNodeId) {
|
||||
console.log('call api');
|
||||
}
|
||||
|
||||
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user