mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
#272 Update 'upload' test config
This commit is contained in:
@@ -52,6 +52,21 @@ System.config(config);
|
|||||||
|
|
||||||
System.import('@angular/platform-browser/src/browser/browser_adapter')
|
System.import('@angular/platform-browser/src/browser/browser_adapter')
|
||||||
.then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); })
|
.then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); })
|
||||||
|
.then(function () {
|
||||||
|
return Promise.all([
|
||||||
|
System.import('@angular/core/testing'),
|
||||||
|
System.import('@angular/platform-browser-dynamic/testing')
|
||||||
|
])
|
||||||
|
})
|
||||||
|
.then(function (providers) {
|
||||||
|
var testing = providers[0];
|
||||||
|
var testingBrowser = providers[1];
|
||||||
|
|
||||||
|
testing.setBaseTestProviders(
|
||||||
|
testingBrowser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
|
||||||
|
testingBrowser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
|
||||||
|
|
||||||
|
})
|
||||||
.then(function() { return Promise.all(resolveTestFiles()); })
|
.then(function() { return Promise.all(resolveTestFiles()); })
|
||||||
.then(
|
.then(
|
||||||
function() {
|
function() {
|
||||||
|
@@ -15,13 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { describe, expect, it, inject, beforeEachProviders, setBaseTestProviders } from '@angular/core/testing';
|
import { describe, expect, it, inject, beforeEachProviders } from '@angular/core/testing';
|
||||||
import { TestComponentBuilder } from '@angular/compiler/testing';
|
import { TestComponentBuilder } from '@angular/compiler/testing';
|
||||||
import {
|
|
||||||
TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
|
|
||||||
TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS
|
|
||||||
} from '@angular/platform-browser-dynamic/testing';
|
|
||||||
import { provide } from '@angular/core';
|
|
||||||
import { FileUploadingDialogComponent } from './file-uploading-dialog.component';
|
import { FileUploadingDialogComponent } from './file-uploading-dialog.component';
|
||||||
import { FileModel } from '../models/file.model';
|
import { FileModel } from '../models/file.model';
|
||||||
import { AlfrescoTranslationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
import { AlfrescoTranslationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||||
@@ -32,13 +27,11 @@ import { Observable } from 'rxjs/Observable';
|
|||||||
|
|
||||||
describe('FileUploadDialog', () => {
|
describe('FileUploadDialog', () => {
|
||||||
|
|
||||||
setBaseTestProviders(TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
|
|
||||||
|
|
||||||
beforeEachProviders(() => {
|
beforeEachProviders(() => {
|
||||||
return [
|
return [
|
||||||
provide(AlfrescoSettingsService, {useClass: AlfrescoSettingsService}),
|
{ provide: AlfrescoSettingsService, useClass: AlfrescoSettingsService },
|
||||||
provide(AlfrescoTranslationService, {useClass: TranslationMock}),
|
{ provide: AlfrescoTranslationService, useClass: TranslationMock },
|
||||||
provide(UploadService, {useClass: UploadServiceMock})
|
{ provide: UploadService, useClass: UploadServiceMock }
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
import { describe, expect, it, inject, beforeEachProviders } from '@angular/core/testing';
|
import { describe, expect, it, inject, beforeEachProviders } from '@angular/core/testing';
|
||||||
import { TestComponentBuilder } from '@angular/compiler/testing';
|
import { TestComponentBuilder } from '@angular/compiler/testing';
|
||||||
import { provide } from '@angular/core';
|
|
||||||
import { UploadButtonComponent } from './upload-button.component';
|
import { UploadButtonComponent } from './upload-button.component';
|
||||||
import { AlfrescoTranslationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
import { AlfrescoTranslationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||||
import { TranslationMock } from '../assets/translation.service.mock';
|
import { TranslationMock } from '../assets/translation.service.mock';
|
||||||
@@ -37,9 +36,9 @@ describe('AlfrescoUploadButton', () => {
|
|||||||
|
|
||||||
beforeEachProviders(() => {
|
beforeEachProviders(() => {
|
||||||
return [
|
return [
|
||||||
provide(AlfrescoSettingsService, {useClass: AlfrescoSettingsService}),
|
{ provide: AlfrescoSettingsService },
|
||||||
provide(AlfrescoTranslationService, {useClass: TranslationMock}),
|
{ provide: AlfrescoTranslationService, useClass: TranslationMock },
|
||||||
provide(UploadService, {useClass: UploadServiceMock})
|
{ provide: UploadService, useClass: UploadServiceMock }
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -17,15 +17,12 @@
|
|||||||
|
|
||||||
import { it, describe, inject, beforeEach, beforeEachProviders } from '@angular/core/testing';
|
import { it, describe, inject, beforeEach, beforeEachProviders } from '@angular/core/testing';
|
||||||
import { UploadService } from './upload.service';
|
import { UploadService } from './upload.service';
|
||||||
import { provide } from '@angular/core';
|
|
||||||
import { FileModel } from './../models/file.model';
|
import { FileModel } from './../models/file.model';
|
||||||
import { AlfrescoSettingsService } from 'ng2-alfresco-core';
|
import { AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||||
import { AlfrescoSettingsServiceMock } from '../assets/AlfrescoSettingsService.service.mock';
|
import { AlfrescoSettingsServiceMock } from '../assets/AlfrescoSettingsService.service.mock';
|
||||||
import { AlfrescoApiMock } from '../assets/AlfrescoApi.mock';
|
import { AlfrescoApiMock } from '../assets/AlfrescoApi.mock';
|
||||||
|
|
||||||
|
|
||||||
declare var AlfrescoApi: any;
|
declare var AlfrescoApi: any;
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
|
|
||||||
let doneFn = jasmine.createSpy('success');
|
let doneFn = jasmine.createSpy('success');
|
||||||
@@ -66,10 +63,12 @@ describe('AlfrescoUploadService', () => {
|
|||||||
|
|
||||||
window['AlfrescoApi'] = AlfrescoApiMock;
|
window['AlfrescoApi'] = AlfrescoApiMock;
|
||||||
|
|
||||||
beforeEachProviders(() => [
|
beforeEachProviders(() => {
|
||||||
provide(AlfrescoSettingsService, {useClass: AlfrescoSettingsServiceMock}),
|
return [
|
||||||
provide(UploadService, {useClass: MockUploadService})
|
{ provide: AlfrescoSettingsService, useClass: AlfrescoSettingsServiceMock },
|
||||||
]);
|
{ provide: UploadService, useClass: MockUploadService }
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
beforeEach( inject([UploadService], (uploadService: UploadService) => {
|
beforeEach( inject([UploadService], (uploadService: UploadService) => {
|
||||||
jasmine.Ajax.install();
|
jasmine.Ajax.install();
|
||||||
|
Reference in New Issue
Block a user