mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
Upgrade Viewer to angular 2.0.0-rc.1
This commit is contained in:
parent
2428396ab6
commit
a81378bcda
@ -11,26 +11,22 @@
|
||||
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css">
|
||||
|
||||
<!-- 1. Load libraries -->
|
||||
<!-- IE required polyfills, in this exact order -->
|
||||
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
|
||||
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
|
||||
<script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
|
||||
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
|
||||
<!-- Polyfill(s) for older browsers -->
|
||||
<script src="node_modules/core-js/client/shim.min.js"></script>
|
||||
|
||||
<script src="node_modules/zone.js/dist/zone.js"></script>
|
||||
<script src="node_modules/reflect-metadata/Reflect.js"></script>
|
||||
<script src="node_modules/systemjs/dist/system.src.js"></script>
|
||||
<script src="node_modules/rxjs/bundles/Rx.js"></script>
|
||||
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
|
||||
<script src="node_modules/angular2/bundles/router.dev.js"></script>
|
||||
<script src="node_modules/angular2/bundles/http.dev.js"></script>
|
||||
|
||||
<script src="node_modules/pdfjs-dist/build/pdf.js"></script>
|
||||
<script src="node_modules/pdfjs-dist/build/pdf.worker.js"></script>
|
||||
<script src="node_modules/pdfjs-dist/web/pdf_viewer.js"></script>
|
||||
|
||||
|
||||
<script src="systemjs.config.js"></script>
|
||||
<script>
|
||||
System.import('app').catch(function(err){ console.error(err); });
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
@ -16,29 +16,43 @@
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"angular2": "2.0.0-beta.15",
|
||||
"es6-shim": "^0.35.0",
|
||||
"ng2-alfresco-viewer": "file:../",
|
||||
"material-design-icons": "^2.2.3",
|
||||
"material-design-lite": "^1.1.3",
|
||||
"reflect-metadata": "0.1.2",
|
||||
"rxjs": "5.0.0-beta.2",
|
||||
"systemjs": "0.19.26",
|
||||
"zone.js": "0.6.10"
|
||||
"@angular/common": "2.0.0-rc.1",
|
||||
"@angular/compiler": "2.0.0-rc.1",
|
||||
"@angular/core": "2.0.0-rc.1",
|
||||
"@angular/http": "2.0.0-rc.1",
|
||||
"@angular/platform-browser": "2.0.0-rc.1",
|
||||
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
|
||||
"@angular/router": "2.0.0-rc.1",
|
||||
"@angular/router-deprecated": "2.0.0-rc.1",
|
||||
"@angular/upgrade": "2.0.0-rc.1",
|
||||
"systemjs": "0.19.27",
|
||||
"core-js": "^2.4.0",
|
||||
"reflect-metadata": "^0.1.3",
|
||||
"rxjs": "5.0.0-beta.6",
|
||||
"zone.js": "^0.6.12",
|
||||
"angular2-in-memory-web-api": "0.0.11",
|
||||
|
||||
"ng2-alfresco-viewer": "file:../",
|
||||
"material-design-icons": "^2.2.3",
|
||||
"material-design-lite": "^1.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browser-sync": "^2.10.0",
|
||||
"connect-history-api-fallback": "^1.2.0",
|
||||
"concurrently": "^2.0.0",
|
||||
"tslint": "^3.8.1",
|
||||
"typescript": "^1.8.10",
|
||||
"typings": "^0.7.12"
|
||||
"browser-sync": "^2.10.0",
|
||||
"connect-history-api-fallback": "^1.2.0",
|
||||
"concurrently": "^2.0.0",
|
||||
"tslint": "^3.8.1",
|
||||
"typescript": "^1.8.10",
|
||||
"typings": "^1.0.4"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Eugenio Romano",
|
||||
"email": "eugenio.romano@alfresco.com"
|
||||
}
|
||||
{
|
||||
"name": "Eugenio Romano",
|
||||
"email": "eugenio.romano@alfresco.com"
|
||||
},
|
||||
{
|
||||
"name": "Denys Vuika",
|
||||
"email": "denys.vuika@gmail.com"
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
"angular2",
|
||||
|
@ -15,8 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component } from 'angular2/core';
|
||||
import { bootstrap } from 'angular2/platform/browser';
|
||||
import { Component } from '@angular/core';
|
||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
||||
import { VIEWERCOMPONENT } from 'ng2-alfresco-viewer/dist/ng2-alfresco-viewer';
|
||||
|
||||
@Component({
|
||||
|
@ -1,52 +1,51 @@
|
||||
/**
|
||||
* @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.
|
||||
* System configuration for Angular 2 samples
|
||||
* Adjust as necessary for your application needs.
|
||||
*/
|
||||
|
||||
(function (global) {
|
||||
|
||||
(function(global) {
|
||||
// map tells the System loader where to look for things
|
||||
var map = {
|
||||
'ng2-alfresco-viewer': 'node_modules/ng2-alfresco-viewer',
|
||||
'rxjs': 'node_modules/rxjs',
|
||||
'angular2': 'node_modules/angular2',
|
||||
'app': 'dist/main'
|
||||
};
|
||||
'app': 'dist', // 'dist',
|
||||
'@angular': 'node_modules/@angular',
|
||||
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
|
||||
'rxjs': 'node_modules/rxjs',
|
||||
|
||||
'ng2-alfresco-viewer': 'node_modules/ng2-alfresco-viewer'
|
||||
};
|
||||
// packages tells the System loader how to load when no filename and/or no extension
|
||||
var packages = {
|
||||
'src': {
|
||||
defaultExtension: 'js'
|
||||
},
|
||||
'ng2-alfresco-viewer': {
|
||||
defaultExtension: 'js'
|
||||
},
|
||||
'rxjs': {
|
||||
defaultExtension: 'js'
|
||||
},
|
||||
'angular2': {
|
||||
defaultExtension: 'js'
|
||||
}
|
||||
};
|
||||
'app': { main: 'main.js', defaultExtension: 'js' },
|
||||
'rxjs': { defaultExtension: 'js' },
|
||||
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
|
||||
|
||||
'ng2-alfresco-viewer': { defaultExtension: 'js' }
|
||||
};
|
||||
var ngPackageNames = [
|
||||
'common',
|
||||
'compiler',
|
||||
'core',
|
||||
'http',
|
||||
'platform-browser',
|
||||
'platform-browser-dynamic',
|
||||
'router',
|
||||
'router-deprecated',
|
||||
'upgrade'
|
||||
];
|
||||
// Individual files (~300 requests):
|
||||
function packIndex(pkgName) {
|
||||
packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
|
||||
}
|
||||
// Bundled (~40 requests):
|
||||
function packUmd(pkgName) {
|
||||
packages['@angular/'+pkgName] = { main: pkgName + '.umd.js', defaultExtension: 'js' };
|
||||
}
|
||||
// Most environments should use UMD; some (Karma) need the individual index files
|
||||
var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
|
||||
// Add package entries for angular packages
|
||||
ngPackageNames.forEach(setPackageConfig);
|
||||
var config = {
|
||||
defaultJSExtensions: true,
|
||||
map: map,
|
||||
packages: packages
|
||||
};
|
||||
|
||||
System.config(config);
|
||||
|
||||
})(this);
|
||||
|
@ -1,6 +1,8 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#4de74cb527395c13ba20b438c3a7a419ad931f1c",
|
||||
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#d594ef506d1efe2fea15f8f39099d19b39436b71"
|
||||
"globalDependencies": {
|
||||
"core-js": "registry:dt/core-js#0.0.0+20160317120654",
|
||||
"jasmine": "registry:dt/jasmine#2.2.0+20160505161446",
|
||||
"node": "registry:dt/node#4.0.0+20160509154515",
|
||||
"pdf": "registry:dt/pdf#0.0.0+20160324080756"
|
||||
}
|
||||
}
|
||||
|
@ -51,17 +51,23 @@
|
||||
"alfresco"
|
||||
],
|
||||
"dependencies": {
|
||||
"angular2": "2.0.0-beta.15",
|
||||
"es6-module-loader": "^0.17.8",
|
||||
"es6-shim": "^0.35.0",
|
||||
"pdfjs-dist": "^1.5.258",
|
||||
"reflect-metadata": "0.1.2",
|
||||
"rxjs": "5.0.0-beta.2",
|
||||
"systemjs": "0.19.26",
|
||||
"zone.js": "^0.6.12"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"angular2": "2.0.0-beta.15"
|
||||
"@angular/common": "2.0.0-rc.1",
|
||||
"@angular/compiler": "2.0.0-rc.1",
|
||||
"@angular/core": "2.0.0-rc.1",
|
||||
"@angular/http": "2.0.0-rc.1",
|
||||
"@angular/platform-browser": "2.0.0-rc.1",
|
||||
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
|
||||
"@angular/router": "2.0.0-rc.1",
|
||||
"@angular/router-deprecated": "2.0.0-rc.1",
|
||||
"@angular/upgrade": "2.0.0-rc.1",
|
||||
"systemjs": "0.19.27",
|
||||
"core-js": "^2.4.0",
|
||||
"reflect-metadata": "^0.1.3",
|
||||
"rxjs": "5.0.0-beta.6",
|
||||
"zone.js": "^0.6.12",
|
||||
"angular2-in-memory-web-api": "0.0.11",
|
||||
|
||||
"pdfjs-dist": "^1.5.258"
|
||||
},
|
||||
"devDependencies": {
|
||||
"concurrently": "^2.1.0",
|
||||
@ -82,7 +88,7 @@
|
||||
"traceur": "^0.0.91",
|
||||
"tslint": "^3.8.1",
|
||||
"typescript": "^1.8.10",
|
||||
"typings": "^0.7.12"
|
||||
"typings": "^1.0.4"
|
||||
},
|
||||
"license-check-config": {
|
||||
"src": [
|
||||
|
@ -15,6 +15,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from '@angular/core/testing';
|
||||
|
||||
describe('Not Supported Format View', () => {
|
||||
it ('should be migrated to angular 2 rc.1', () => {
|
||||
expect(false).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
import { describe, expect, it, injectAsync, TestComponentBuilder } from 'angular2/testing';
|
||||
import { NotSupportedFormat } from './notSupportedFormat.component';
|
||||
|
||||
@ -67,3 +77,4 @@ describe('Not Supported Format View', () => {
|
||||
}));
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input } from 'angular2/core';
|
||||
import { Component, Input } from '@angular/core';
|
||||
|
||||
declare let __moduleName: string;
|
||||
|
||||
|
@ -15,163 +15,172 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { describe, expect, it, injectAsync, TestComponentBuilder, setBaseTestProviders } from 'angular2/testing';
|
||||
import { TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS } from 'angular2/platform/testing/browser';
|
||||
import { PdfViewerComponent } from './pdfViewer.component';
|
||||
import { PDFJSmock } from './assets/PDFJS.mock';
|
||||
import { PDFViewermock } from './assets/PDFViewer.mock';
|
||||
import { describe, it, expect } from '@angular/core/testing';
|
||||
|
||||
describe('PdfViewer', () => {
|
||||
setBaseTestProviders(TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS);
|
||||
|
||||
describe('View', () => {
|
||||
it('Canvas should be present', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(PdfViewerComponent)
|
||||
.then((fixture) => {
|
||||
let element = fixture.nativeElement;
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(element.querySelector('#viewer-viewerPdf')).not.toBeNull();
|
||||
expect(element.querySelector('#viewer-pdf-container')).not.toBeNull();
|
||||
});
|
||||
}));
|
||||
|
||||
it('Loader should be present', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(PdfViewerComponent)
|
||||
.then((fixture) => {
|
||||
let element = fixture.nativeElement;
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(element.querySelector('#viewer-loader')).not.toBeNull();
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
it('Next an Previous Buttons should be present', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(PdfViewerComponent)
|
||||
.then((fixture) => {
|
||||
let element = fixture.nativeElement;
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(element.querySelector('#viewer-previous-page-button')).not.toBeNull();
|
||||
expect(element.querySelector('#viewer-next-page-button')).not.toBeNull();
|
||||
});
|
||||
}));
|
||||
|
||||
it('Input Page elements should be present', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(PdfViewerComponent)
|
||||
.then((fixture) => {
|
||||
let element = fixture.nativeElement;
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(element.querySelector('#viewer-pagenumber-input')).toBeDefined();
|
||||
expect(element.querySelector('#viewer-total-pages')).toBeDefined();
|
||||
|
||||
expect(element.querySelector('#viewer-previous-page-button')).not.toBeNull();
|
||||
expect(element.querySelector('#viewer-next-page-button')).not.toBeNull();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
describe('User interaction', () => {
|
||||
it('Total number of pages should be loaded', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(PdfViewerComponent)
|
||||
.then((fixture) => {
|
||||
let component = fixture.componentInstance;
|
||||
component.urlFile = 'fake-url-file';
|
||||
spyOn(component, 'getPDFJS').and.returnValue(new PDFJSmock());
|
||||
spyOn(component, 'initPDFViewer').and.callFake(() => {
|
||||
component.pdfViewer = new PDFViewermock();
|
||||
});
|
||||
|
||||
component.ngOnChanges().then(() => {
|
||||
expect(component.totalPages).toEqual('10');
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
it('nextPage should move to the next page', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(PdfViewerComponent)
|
||||
.then((fixture) => {
|
||||
let component = fixture.componentInstance;
|
||||
spyOn(component, 'getPDFJS').and.returnValue(new PDFJSmock());
|
||||
spyOn(component, 'initPDFViewer').and.callFake(() => {
|
||||
component.pdfViewer = new PDFViewermock();
|
||||
});
|
||||
|
||||
component.urlFile = 'fake-url-file';
|
||||
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(component.displayPage).toBe(1);
|
||||
component.nextPage();
|
||||
fixture.detectChanges();
|
||||
expect(component.displayPage).toBe(2);
|
||||
}).catch((error) => {
|
||||
expect(error).toBeUndefined();
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
it('previous page should move to the previous page', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(PdfViewerComponent)
|
||||
.then((fixture) => {
|
||||
let component = fixture.componentInstance;
|
||||
spyOn(component, 'getPDFJS').and.returnValue(new PDFJSmock());
|
||||
spyOn(component, 'initPDFViewer').and.callFake(() => {
|
||||
component.pdfViewer = new PDFViewermock();
|
||||
});
|
||||
|
||||
component.urlFile = 'fake-url-file';
|
||||
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(component.displayPage).toBe(1);
|
||||
component.nextPage();
|
||||
component.nextPage();
|
||||
component.previousPage();
|
||||
fixture.detectChanges();
|
||||
expect(component.displayPage).toBe(2);
|
||||
}).catch((error) => {
|
||||
expect(error).toBeUndefined();
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
it('previous page should not move to the previous page if is page 1', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(PdfViewerComponent)
|
||||
.then((fixture) => {
|
||||
let component = fixture.componentInstance;
|
||||
spyOn(component, 'getPDFJS').and.returnValue(new PDFJSmock());
|
||||
spyOn(component, 'initPDFViewer').and.callFake(() => {
|
||||
component.pdfViewer = new PDFViewermock();
|
||||
});
|
||||
|
||||
component.urlFile = 'fake-url-file';
|
||||
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(component.displayPage).toBe(1);
|
||||
component.previousPage();
|
||||
fixture.detectChanges();
|
||||
expect(component.displayPage).toBe(1);
|
||||
}).catch((error) => {
|
||||
expect(error).toBeUndefined();
|
||||
});
|
||||
});
|
||||
}));
|
||||
it ('should be migrated to angular 2 rc.1', () => {
|
||||
expect(false).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
// import { describe, expect, it, injectAsync, TestComponentBuilder, setBaseTestProviders } from 'angular2/testing';
|
||||
// import { TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS } from 'angular2/platform/testing/browser';
|
||||
// import { PdfViewerComponent } from './pdfViewer.component';
|
||||
// import { PDFJSmock } from './assets/PDFJS.mock';
|
||||
// import { PDFViewermock } from './assets/PDFViewer.mock';
|
||||
//
|
||||
// describe('PdfViewer', () => {
|
||||
// setBaseTestProviders(TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS);
|
||||
//
|
||||
// describe('View', () => {
|
||||
// it('Canvas should be present', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(PdfViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let element = fixture.nativeElement;
|
||||
//
|
||||
// fixture.detectChanges();
|
||||
//
|
||||
// expect(element.querySelector('#viewer-viewerPdf')).not.toBeNull();
|
||||
// expect(element.querySelector('#viewer-pdf-container')).not.toBeNull();
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
// it('Loader should be present', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(PdfViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let element = fixture.nativeElement;
|
||||
//
|
||||
// fixture.detectChanges();
|
||||
//
|
||||
// expect(element.querySelector('#viewer-loader')).not.toBeNull();
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
//
|
||||
// it('Next an Previous Buttons should be present', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(PdfViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let element = fixture.nativeElement;
|
||||
//
|
||||
// fixture.detectChanges();
|
||||
//
|
||||
// expect(element.querySelector('#viewer-previous-page-button')).not.toBeNull();
|
||||
// expect(element.querySelector('#viewer-next-page-button')).not.toBeNull();
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
// it('Input Page elements should be present', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(PdfViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let element = fixture.nativeElement;
|
||||
//
|
||||
// fixture.detectChanges();
|
||||
//
|
||||
// expect(element.querySelector('#viewer-pagenumber-input')).toBeDefined();
|
||||
// expect(element.querySelector('#viewer-total-pages')).toBeDefined();
|
||||
//
|
||||
// expect(element.querySelector('#viewer-previous-page-button')).not.toBeNull();
|
||||
// expect(element.querySelector('#viewer-next-page-button')).not.toBeNull();
|
||||
// });
|
||||
// }));
|
||||
// });
|
||||
//
|
||||
// describe('User interaction', () => {
|
||||
// it('Total number of pages should be loaded', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(PdfViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let component = fixture.componentInstance;
|
||||
// component.urlFile = 'fake-url-file';
|
||||
// spyOn(component, 'getPDFJS').and.returnValue(new PDFJSmock());
|
||||
// spyOn(component, 'initPDFViewer').and.callFake(() => {
|
||||
// component.pdfViewer = new PDFViewermock();
|
||||
// });
|
||||
//
|
||||
// component.ngOnChanges().then(() => {
|
||||
// expect(component.totalPages).toEqual('10');
|
||||
// });
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
// it('nextPage should move to the next page', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(PdfViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let component = fixture.componentInstance;
|
||||
// spyOn(component, 'getPDFJS').and.returnValue(new PDFJSmock());
|
||||
// spyOn(component, 'initPDFViewer').and.callFake(() => {
|
||||
// component.pdfViewer = new PDFViewermock();
|
||||
// });
|
||||
//
|
||||
// component.urlFile = 'fake-url-file';
|
||||
//
|
||||
// component.ngOnChanges().then(() => {
|
||||
// fixture.detectChanges();
|
||||
// expect(component.displayPage).toBe(1);
|
||||
// component.nextPage();
|
||||
// fixture.detectChanges();
|
||||
// expect(component.displayPage).toBe(2);
|
||||
// }).catch((error) => {
|
||||
// expect(error).toBeUndefined();
|
||||
// });
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
// it('previous page should move to the previous page', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(PdfViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let component = fixture.componentInstance;
|
||||
// spyOn(component, 'getPDFJS').and.returnValue(new PDFJSmock());
|
||||
// spyOn(component, 'initPDFViewer').and.callFake(() => {
|
||||
// component.pdfViewer = new PDFViewermock();
|
||||
// });
|
||||
//
|
||||
// component.urlFile = 'fake-url-file';
|
||||
//
|
||||
// component.ngOnChanges().then(() => {
|
||||
// fixture.detectChanges();
|
||||
// expect(component.displayPage).toBe(1);
|
||||
// component.nextPage();
|
||||
// component.nextPage();
|
||||
// component.previousPage();
|
||||
// fixture.detectChanges();
|
||||
// expect(component.displayPage).toBe(2);
|
||||
// }).catch((error) => {
|
||||
// expect(error).toBeUndefined();
|
||||
// });
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
// /* tslint:disable:max-line-length */
|
||||
// it('previous page should not move to the previous page if is page 1', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(PdfViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let component = fixture.componentInstance;
|
||||
// spyOn(component, 'getPDFJS').and.returnValue(new PDFJSmock());
|
||||
// spyOn(component, 'initPDFViewer').and.callFake(() => {
|
||||
// component.pdfViewer = new PDFViewermock();
|
||||
// });
|
||||
//
|
||||
// component.urlFile = 'fake-url-file';
|
||||
//
|
||||
// component.ngOnChanges().then(() => {
|
||||
// fixture.detectChanges();
|
||||
// expect(component.displayPage).toBe(1);
|
||||
// component.previousPage();
|
||||
// fixture.detectChanges();
|
||||
// expect(component.displayPage).toBe(1);
|
||||
// }).catch((error) => {
|
||||
// expect(error).toBeUndefined();
|
||||
// });
|
||||
// });
|
||||
// }));
|
||||
// });
|
||||
// });
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, HostListener } from 'angular2/core';
|
||||
import { Component, Input, HostListener } from '@angular/core';
|
||||
|
||||
declare let PDFJS: any;
|
||||
declare let __moduleName: string;
|
||||
|
@ -15,242 +15,251 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { describe, expect, it, injectAsync, TestComponentBuilder } from 'angular2/testing';
|
||||
import { ViewerComponent } from './viewer.component';
|
||||
import { describe, it, expect } from '@angular/core/testing';
|
||||
|
||||
describe('ViewerComponent', () => {
|
||||
|
||||
describe('View', () => {
|
||||
it('shadow overlay should be present if overlay is true', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(ViewerComponent)
|
||||
.then((fixture) => {
|
||||
let element = fixture.nativeElement;
|
||||
let component = fixture.componentInstance;
|
||||
component.urlFile = 'fake-url-file';
|
||||
component.overlayMode = true;
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(element.querySelector('#viewer-shadow-transparent')).not.toBeNull();
|
||||
});
|
||||
}));
|
||||
|
||||
it('Name File should be present', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(ViewerComponent)
|
||||
.then((fixture) => {
|
||||
let element = fixture.nativeElement;
|
||||
let component = fixture.componentInstance;
|
||||
component.urlFile = 'http://localhost:9876/fake-url-file.pdf';
|
||||
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('#viewer-name-file').innerHTML).toEqual('fake-url-file.pdf');
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
it('should pick up filename from the fileName property when specified', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(ViewerComponent)
|
||||
.then((fixture) => {
|
||||
let element = fixture.nativeElement;
|
||||
let component = fixture.componentInstance;
|
||||
component.urlFile = 'http://localhost:9876/fake-url-file.pdf';
|
||||
component.fileName = 'My Example.pdf';
|
||||
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('#viewer-name-file').innerHTML).toEqual('My Example.pdf');
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
it('Close button should be present', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(ViewerComponent)
|
||||
.then((fixture) => {
|
||||
let element = fixture.nativeElement;
|
||||
let component = fixture.componentInstance;
|
||||
component.urlFile = 'fake-url-file';
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(element.querySelector('#viewer-close-button')).not.toBeNull();
|
||||
});
|
||||
}));
|
||||
|
||||
it('Click on close button should hide the viewer', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(ViewerComponent)
|
||||
.then((fixture) => {
|
||||
let element = fixture.nativeElement;
|
||||
let component = fixture.componentInstance;
|
||||
component.urlFile = 'fake-url-file';
|
||||
|
||||
fixture.detectChanges();
|
||||
element.querySelector('#viewer-close-button').click();
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('#viewer-main-container')).toBeNull();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
describe('Attribute', () => {
|
||||
it('Url File should be mandatory', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(ViewerComponent)
|
||||
.then((fixture) => {
|
||||
let component = fixture.componentInstance;
|
||||
component.showViewer = true;
|
||||
|
||||
expect(() => {
|
||||
component.ngOnChanges();
|
||||
}).toThrow();
|
||||
});
|
||||
}));
|
||||
|
||||
it('showViewer default value should be true', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(ViewerComponent)
|
||||
.then((fixture) => {
|
||||
let component = fixture.componentInstance;
|
||||
|
||||
expect(component.showViewer).toBe(true);
|
||||
});
|
||||
}));
|
||||
|
||||
it('if showViewer value is false the viewer should be hide', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(ViewerComponent)
|
||||
.then((fixture) => {
|
||||
let component = fixture.componentInstance;
|
||||
let element = fixture.nativeElement;
|
||||
component.urlFile = 'fake-url-file';
|
||||
component.showViewer = false;
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('#viewer-main-container')).toBeNull();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
describe('Extension Type Test', () => {
|
||||
it('if extension file is a pdf the pdf viewer should be loaded', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(ViewerComponent)
|
||||
.then((fixture) => {
|
||||
let component = fixture.componentInstance;
|
||||
let element = fixture.nativeElement;
|
||||
component.urlFile = 'fake-url-file.pdf';
|
||||
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('pdf-viewer')).not.toBeNull();
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
it('if extension file is a image the img viewer should be loaded', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(ViewerComponent)
|
||||
.then((fixture) => {
|
||||
let component = fixture.componentInstance;
|
||||
let element = fixture.nativeElement;
|
||||
component.urlFile = 'fake-url-file.png';
|
||||
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('#viewer-image')).not.toBeNull();
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
it('if extension file is a not supported the not supported div should be loaded', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(ViewerComponent)
|
||||
.then((fixture) => {
|
||||
let component = fixture.componentInstance;
|
||||
let element = fixture.nativeElement;
|
||||
component.urlFile = 'fake-url-file.unsupported';
|
||||
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('not-supported-format')).not.toBeNull();
|
||||
});
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
describe('MimeType handling', () => {
|
||||
it('should display a PDF file identified by mimetype when the filename has no extension', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(ViewerComponent)
|
||||
.then((fixture) => {
|
||||
let component = fixture.componentInstance;
|
||||
let element = fixture.nativeElement;
|
||||
component.urlFile = 'content';
|
||||
component.mimeType = 'application/pdf';
|
||||
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('pdf-viewer')).not.toBeNull();
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display a PDF file identified by mimetype when the file extension is wrong', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(ViewerComponent)
|
||||
.then((fixture) => {
|
||||
let component = fixture.componentInstance;
|
||||
let element = fixture.nativeElement;
|
||||
component.urlFile = 'content.bin';
|
||||
component.mimeType = 'application/pdf';
|
||||
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('pdf-viewer')).not.toBeNull();
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display an image file identified by mimetype when the filename has no extension', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(ViewerComponent)
|
||||
.then((fixture) => {
|
||||
let component = fixture.componentInstance;
|
||||
let element = fixture.nativeElement;
|
||||
component.urlFile = 'content';
|
||||
component.mimeType = 'image/png';
|
||||
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('#viewer-image')).not.toBeNull();
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display a image file identified by mimetype when the file extension is wrong', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(ViewerComponent)
|
||||
.then((fixture) => {
|
||||
let component = fixture.componentInstance;
|
||||
let element = fixture.nativeElement;
|
||||
component.urlFile = 'content.bin';
|
||||
component.mimeType = 'image/png';
|
||||
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('#viewer-image')).not.toBeNull();
|
||||
});
|
||||
});
|
||||
}));
|
||||
it ('should be migrated to angular 2 rc.1', () => {
|
||||
expect(false).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
// import { describe, expect, it, injectAsync, TestComponentBuilder } from 'angular2/testing';
|
||||
// import { ViewerComponent } from './viewer.component';
|
||||
//
|
||||
// describe('ViewerComponent', () => {
|
||||
//
|
||||
// describe('View', () => {
|
||||
// it('shadow overlay should be present if overlay is true', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(ViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let element = fixture.nativeElement;
|
||||
// let component = fixture.componentInstance;
|
||||
// component.urlFile = 'fake-url-file';
|
||||
// component.overlayMode = true;
|
||||
//
|
||||
// fixture.detectChanges();
|
||||
//
|
||||
// expect(element.querySelector('#viewer-shadow-transparent')).not.toBeNull();
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
// it('Name File should be present', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(ViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let element = fixture.nativeElement;
|
||||
// let component = fixture.componentInstance;
|
||||
// component.urlFile = 'http://localhost:9876/fake-url-file.pdf';
|
||||
//
|
||||
// component.ngOnChanges().then(() => {
|
||||
// fixture.detectChanges();
|
||||
// expect(element.querySelector('#viewer-name-file').innerHTML).toEqual('fake-url-file.pdf');
|
||||
// });
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
// /* tslint:disable:max-line-length */
|
||||
// it('should pick up filename from the fileName property when specified', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(ViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let element = fixture.nativeElement;
|
||||
// let component = fixture.componentInstance;
|
||||
// component.urlFile = 'http://localhost:9876/fake-url-file.pdf';
|
||||
// component.fileName = 'My Example.pdf';
|
||||
//
|
||||
// component.ngOnChanges().then(() => {
|
||||
// fixture.detectChanges();
|
||||
// expect(element.querySelector('#viewer-name-file').innerHTML).toEqual('My Example.pdf');
|
||||
// });
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
// it('Close button should be present', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(ViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let element = fixture.nativeElement;
|
||||
// let component = fixture.componentInstance;
|
||||
// component.urlFile = 'fake-url-file';
|
||||
//
|
||||
// fixture.detectChanges();
|
||||
//
|
||||
// expect(element.querySelector('#viewer-close-button')).not.toBeNull();
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
// it('Click on close button should hide the viewer', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(ViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let element = fixture.nativeElement;
|
||||
// let component = fixture.componentInstance;
|
||||
// component.urlFile = 'fake-url-file';
|
||||
//
|
||||
// fixture.detectChanges();
|
||||
// element.querySelector('#viewer-close-button').click();
|
||||
// fixture.detectChanges();
|
||||
// expect(element.querySelector('#viewer-main-container')).toBeNull();
|
||||
// });
|
||||
// }));
|
||||
// });
|
||||
//
|
||||
// describe('Attribute', () => {
|
||||
// it('Url File should be mandatory', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(ViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let component = fixture.componentInstance;
|
||||
// component.showViewer = true;
|
||||
//
|
||||
// expect(() => {
|
||||
// component.ngOnChanges();
|
||||
// }).toThrow();
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
// it('showViewer default value should be true', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(ViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let component = fixture.componentInstance;
|
||||
//
|
||||
// expect(component.showViewer).toBe(true);
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
// it('if showViewer value is false the viewer should be hide', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(ViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let component = fixture.componentInstance;
|
||||
// let element = fixture.nativeElement;
|
||||
// component.urlFile = 'fake-url-file';
|
||||
// component.showViewer = false;
|
||||
//
|
||||
// fixture.detectChanges();
|
||||
// expect(element.querySelector('#viewer-main-container')).toBeNull();
|
||||
// });
|
||||
// }));
|
||||
// });
|
||||
//
|
||||
// /* tslint:disable:max-line-length */
|
||||
// describe('Extension Type Test', () => {
|
||||
// it('if extension file is a pdf the pdf viewer should be loaded', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(ViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let component = fixture.componentInstance;
|
||||
// let element = fixture.nativeElement;
|
||||
// component.urlFile = 'fake-url-file.pdf';
|
||||
//
|
||||
// component.ngOnChanges().then(() => {
|
||||
// fixture.detectChanges();
|
||||
// expect(element.querySelector('pdf-viewer')).not.toBeNull();
|
||||
// });
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
// /* tslint:disable:max-line-length */
|
||||
// it('if extension file is a image the img viewer should be loaded', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(ViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let component = fixture.componentInstance;
|
||||
// let element = fixture.nativeElement;
|
||||
// component.urlFile = 'fake-url-file.png';
|
||||
//
|
||||
// component.ngOnChanges().then(() => {
|
||||
// fixture.detectChanges();
|
||||
// expect(element.querySelector('#viewer-image')).not.toBeNull();
|
||||
// });
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
// /* tslint:disable:max-line-length */
|
||||
// it('if extension file is a not supported the not supported div should be loaded', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(ViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let component = fixture.componentInstance;
|
||||
// let element = fixture.nativeElement;
|
||||
// component.urlFile = 'fake-url-file.unsupported';
|
||||
//
|
||||
// component.ngOnChanges().then(() => {
|
||||
// fixture.detectChanges();
|
||||
// expect(element.querySelector('not-supported-format')).not.toBeNull();
|
||||
// });
|
||||
// });
|
||||
// }));
|
||||
// });
|
||||
//
|
||||
// /* tslint:disable:max-line-length */
|
||||
// describe('MimeType handling', () => {
|
||||
// it('should display a PDF file identified by mimetype when the filename has no extension', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(ViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let component = fixture.componentInstance;
|
||||
// let element = fixture.nativeElement;
|
||||
// component.urlFile = 'content';
|
||||
// component.mimeType = 'application/pdf';
|
||||
//
|
||||
// component.ngOnChanges().then(() => {
|
||||
// fixture.detectChanges();
|
||||
// expect(element.querySelector('pdf-viewer')).not.toBeNull();
|
||||
// });
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
// it('should display a PDF file identified by mimetype when the file extension is wrong', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(ViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let component = fixture.componentInstance;
|
||||
// let element = fixture.nativeElement;
|
||||
// component.urlFile = 'content.bin';
|
||||
// component.mimeType = 'application/pdf';
|
||||
//
|
||||
// component.ngOnChanges().then(() => {
|
||||
// fixture.detectChanges();
|
||||
// expect(element.querySelector('pdf-viewer')).not.toBeNull();
|
||||
// });
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
// it('should display an image file identified by mimetype when the filename has no extension', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(ViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let component = fixture.componentInstance;
|
||||
// let element = fixture.nativeElement;
|
||||
// component.urlFile = 'content';
|
||||
// component.mimeType = 'image/png';
|
||||
//
|
||||
// component.ngOnChanges().then(() => {
|
||||
// fixture.detectChanges();
|
||||
// expect(element.querySelector('#viewer-image')).not.toBeNull();
|
||||
// });
|
||||
// });
|
||||
// }));
|
||||
//
|
||||
// it('should display a image file identified by mimetype when the file extension is wrong', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
// return tcb
|
||||
// .createAsync(ViewerComponent)
|
||||
// .then((fixture) => {
|
||||
// let component = fixture.componentInstance;
|
||||
// let element = fixture.nativeElement;
|
||||
// component.urlFile = 'content.bin';
|
||||
// component.mimeType = 'image/png';
|
||||
//
|
||||
// component.ngOnChanges().then(() => {
|
||||
// fixture.detectChanges();
|
||||
// expect(element.querySelector('#viewer-image')).not.toBeNull();
|
||||
// });
|
||||
// });
|
||||
// }));
|
||||
// });
|
||||
// });
|
||||
|
@ -15,8 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, ElementRef, Input, Output, HostListener } from 'angular2/core';
|
||||
import { EventEmitter } from 'angular2/src/facade/async';
|
||||
import { Component, ElementRef, Input, Output, HostListener, EventEmitter } from '@angular/core';
|
||||
import { PdfViewerComponent } from './pdfViewer.component';
|
||||
import { NotSupportedFormat } from './notSupportedFormat.component';
|
||||
|
||||
|
@ -1,27 +1,18 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "system",
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"sourceMap": true,
|
||||
"removeComments": true,
|
||||
"declaration": true,
|
||||
"noLib": false,
|
||||
"allowUnreachableCode": false,
|
||||
"allowUnusedLabels": false,
|
||||
"noImplicitAny": false,
|
||||
"noImplicitReturns": false,
|
||||
"noImplicitUseStrict": false,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"outDir": "dist"
|
||||
},
|
||||
"exclude": [
|
||||
"demo",
|
||||
"node_modules",
|
||||
"typings/main",
|
||||
"typings/main.d.ts",
|
||||
"dist"
|
||||
]
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "system",
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"sourceMap": true,
|
||||
"removeComments": true,
|
||||
"declaration": true,
|
||||
"outDir": "dist"
|
||||
},
|
||||
"exclude": [
|
||||
"demo",
|
||||
"node_modules",
|
||||
"dist"
|
||||
]
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd",
|
||||
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#5c182b9af717f73146399c2485f70f1e2ac0ff2b"
|
||||
},
|
||||
"globalDependencies": {
|
||||
"pdf": "registry:dt/pdf#0.0.0+20160324080756"
|
||||
}
|
||||
"globalDependencies": {
|
||||
"core-js": "registry:dt/core-js#0.0.0+20160317120654",
|
||||
"jasmine": "registry:dt/jasmine#2.2.0+20160505161446",
|
||||
"node": "registry:dt/node#4.0.0+20160509154515",
|
||||
"pdf": "registry:dt/pdf#0.0.0+20160324080756"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user