fix test angular2 Finale release tag component #749

This commit is contained in:
Eugenio Romano
2016-10-04 15:38:30 +01:00
parent 79fc3085c0
commit 4745cb931b
11 changed files with 163 additions and 152 deletions

View File

@@ -54,18 +54,8 @@ var map = {
'ng2-translate': 'npm:ng2-translate',
'alfresco-js-api': 'npm:alfresco-js-api/dist',
'ng2-activiti-form': 'npm:ng2-activiti-form/dist',
'ng2-activiti-processlist': 'npm:ng2-activiti-processlist/dist',
'ng2-activiti-tasklist': 'npm:ng2-activiti-tasklist/dist',
'ng2-alfresco-core': 'npm:ng2-alfresco-core/dist',
'ng2-alfresco-datatable': 'npm:ng2-alfresco-datatable/dist',
'ng2-alfresco-documentlist': 'npm:ng2-alfresco-documentlist/dist',
'ng2-alfresco-login': 'npm:ng2-alfresco-login/dist',
'ng2-alfresco-search': 'npm:ng2-alfresco-search/dist',
'ng2-alfresco-tag': 'npm:ng2-alfresco-tag/dist',
'ng2-alfresco-upload': 'npm:ng2-alfresco-upload/dist',
'ng2-alfresco-viewer': 'npm:ng2-alfresco-viewer/dist',
'ng2-alfresco-webscript': 'npm:ng2-alfresco-webscript/dist'
'ng2-alfresco-tag': 'npm:ng2-alfresco-tag/dist'
};
var packages = {
@@ -74,18 +64,8 @@ var packages = {
'ng2-translate': { defaultExtension: 'js' },
'alfresco-js-api': { main: './alfresco-js-api.js', defaultExtension: 'js'},
'ng2-activiti-form': { main: './index.js', defaultExtension: 'js'},
'ng2-activiti-processlist': { main: './index.js', defaultExtension: 'js'},
'ng2-activiti-tasklist': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-core': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-datatable': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-documentlist': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-login': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-search': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-tag': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-upload': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-viewer': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-webscript': { main: './index.js', defaultExtension: 'js'}
'ng2-alfresco-tag': { main: './index.js', defaultExtension: 'js'}
};
var config = {

View File

@@ -44,18 +44,9 @@ module.exports = function (config) {
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
// ng2-components
{ pattern: 'node_modules/ng2-activiti-form/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-activiti-processlist/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-activiti-tasklist/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-core/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-datatable/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-documentlist/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-login/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-search/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-core/dist/**/*.js.map', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-tag/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-upload/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-viewer/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-webscript/dist/**/*.js', included: false, served: true, watched: false },
// paths to support debugging with source maps in dev tools
{pattern: 'src/**/*.ts', included: false, watched: false},

View File

@@ -40,15 +40,15 @@
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"@angular/upgrade": "2.0.0",
"@types/node": "^6.0.42",
"alfresco-js-api": "^0.3.0",
"core-js": "^2.4.1",
"ng2-alfresco-core": "0.3.2",
"ng2-translate": "2.5.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"zone.js": "^0.6.23",
"alfresco-js-api": "^0.3.0",
"ng2-translate": "2.5.0",
"ng2-alfresco-core": "0.3.2"
"zone.js": "^0.6.23"
},
"devDependencies": {
"@types/core-js": "^0.9.32",
@@ -78,7 +78,7 @@
],
"license-check-config": {
"src": [
"./dist/**/*.js"
"./dist/**/*.js"
],
"path": "assets/license_header.txt",
"blocking": false,

View File

@@ -15,18 +15,50 @@
* limitations under the License.
*/
/*
import { it, describe, inject, beforeEachProviders, beforeEach, afterEach } from '@angular/core/testing';
import { TestComponentBuilder } from '@angular/compiler/testing';
import { AlfrescoAuthenticationService, AlfrescoSettingsService, AlfrescoApiService } from 'ng2-alfresco-core';
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { TagActionsComponent } from '../components/tag-actions.component';
import { DebugElement } from '@angular/core';
import {
AlfrescoAuthenticationService,
AlfrescoSettingsService,
AlfrescoApiService,
CoreModule
} from 'ng2-alfresco-core';
import { TagService } from '../services/tag.service';
import { TagActionsComponent } from './tag-actions.component';
declare let jasmine: any;
describe('Tag actions list', () => {
describe('Test ng2-alfresco-tag Tag actions list', () => {
let tagActionsListFixture, element, component;
let component: any;
let fixture: ComponentFixture<TagActionsComponent>;
let debug: DebugElement;
let element: HTMLElement;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
CoreModule
],
declarations: [TagActionsComponent],
providers: [
AlfrescoSettingsService,
AlfrescoAuthenticationService,
AlfrescoApiService,
TagService
]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TagActionsComponent);
component = fixture.componentInstance;
debug = fixture.debugElement;
element = fixture.nativeElement;
component = fixture.componentInstance;
fixture.detectChanges();
});
let dataTag = {
'list': {
@@ -45,25 +77,6 @@ describe('Tag actions list', () => {
}
};
beforeEachProviders(() => {
return [
AlfrescoSettingsService,
AlfrescoAuthenticationService,
AlfrescoApiService,
TagService
];
});
beforeEach(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb
.createAsync(TagActionsComponent)
.then(fixture => {
tagActionsListFixture = fixture;
element = tagActionsListFixture.nativeElement;
component = tagActionsListFixture.componentInstance;
});
}));
describe('Rendering tests', () => {
beforeEach(() => {
@@ -78,7 +91,7 @@ describe('Tag actions list', () => {
component.nodeId = 'fake-node-id';
component.resultsEmitter.subscribe(() => {
tagActionsListFixture.detectChanges();
fixture.detectChanges();
expect(element.querySelector('#tag_name_0').innerHTML).toBe('test1');
expect(element.querySelector('#tag_name_1').innerHTML).toBe('test2');
@@ -104,12 +117,15 @@ describe('Tag actions list', () => {
component.nodeId = 'fake-node-id';
component.resultsEmitter.subscribe(() => {
tagActionsListFixture.detectChanges();
element.querySelector('#tag_delete_0').click();
tagActionsListFixture.detectChanges();
fixture.detectChanges();
expect(jasmine.Ajax.requests.at(1).url).
toBe('http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags/0ee933fa-57fc-4587-8a77-b787e814f1d2');
let deleteButton: any = element.querySelector('#tag_delete_0');
deleteButton.click();
fixture.detectChanges();
expect(jasmine.Ajax.requests.at(1).url)
.toBe('http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags/0ee933fa-57fc-4587-8a77-b787e814f1d2');
expect(jasmine.Ajax.requests.at(1).method).toBe('DELETE');
done();
});
@@ -127,13 +143,14 @@ describe('Tag actions list', () => {
component.nodeId = 'fake-node-id';
component.newTagName = 'fake-tag-name';
tagActionsListFixture.detectChanges();
fixture.detectChanges();
component.addEmitter.subscribe(() => {
done();
});
element.querySelector('#add-tag').click();
let addButton: any = element.querySelector('#add-tag');
addButton.click();
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200
@@ -141,4 +158,4 @@ describe('Tag actions list', () => {
});
});
});
*/

View File

@@ -25,10 +25,9 @@ import { TagService } from '../services/tag.service';
*
* @returns {TagComponent} .
*/
declare let __moduleName: string;
@Component({
moduleId: __moduleName,
moduleId: module.id,
selector: 'alfresco-tag-node-actions-list',
templateUrl: './tag-actions.component.html',
styleUrls: ['./tag-actions.component.css']

View File

@@ -15,24 +15,21 @@
* limitations under the License.
*/
describe('TagList', () => {
it('should be upgraded', () => {
expect(true).toBe(true);
});
});
/*
import { it, describe, inject, beforeEachProviders, beforeEach, afterEach } from '@angular/core/testing';
import { TestComponentBuilder } from '@angular/compiler/testing';
import { AlfrescoAuthenticationService, AlfrescoSettingsService, AlfrescoApiService } from 'ng2-alfresco-core';
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { TagList } from '../components/tag-list.component';
import { DebugElement } from '@angular/core';
import {
AlfrescoAuthenticationService,
AlfrescoSettingsService,
AlfrescoApiService,
CoreModule
} from 'ng2-alfresco-core';
import { TagService } from '../services/tag.service';
import { TagList } from './tag-list.component';
declare let jasmine: any;
describe('Tag list All ECM', () => {
let tagListFixture, element, component;
describe('Test ng2-alfresco-tag Tag list All ECM', () => {
let dataTag = {
'list': {
@@ -50,24 +47,36 @@ describe('Tag list All ECM', () => {
}
};
beforeEachProviders(() => {
return [
AlfrescoSettingsService,
AlfrescoAuthenticationService,
AlfrescoApiService,
TagService
];
let component: any;
let fixture: ComponentFixture<TagList>;
let debug: DebugElement;
let element: HTMLElement;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
CoreModule
],
declarations: [TagList],
providers: [
AlfrescoSettingsService,
AlfrescoAuthenticationService,
AlfrescoApiService,
TagService
]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TagList);
component = fixture.componentInstance;
debug = fixture.debugElement;
element = fixture.nativeElement;
component = fixture.componentInstance;
fixture.detectChanges();
});
beforeEach(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb
.createAsync(TagList)
.then(fixture => {
tagListFixture = fixture;
element = tagListFixture.nativeElement;
component = tagListFixture.componentInstance;
});
}));
describe('Rendering tests', () => {
@@ -83,7 +92,7 @@ describe('Tag list All ECM', () => {
component.nodeId = 'fake-node-id';
component.resultsEmitter.subscribe(() => {
tagListFixture.detectChanges();
fixture.detectChanges();
expect(element.querySelector('#tag_name_0').innerHTML).toBe('test1');
expect(element.querySelector('#tag_name_1').innerHTML).toBe('test2');
@@ -102,4 +111,3 @@ describe('Tag list All ECM', () => {
});
});
});
*/

View File

@@ -25,10 +25,9 @@ import { TagService } from '../services/tag.service';
*
* @returns {TagList} .
*/
declare let __moduleName: string;
@Component({
moduleId: __moduleName,
moduleId: module.id,
selector: 'alfresco-tag-list',
templateUrl: './tag-list.component.html'
})

View File

@@ -15,18 +15,21 @@
* limitations under the License.
*/
/*
import { it, describe, inject, beforeEachProviders, beforeEach, afterEach } from '@angular/core/testing';
import { TestComponentBuilder } from '@angular/compiler/testing';
import { AlfrescoAuthenticationService, AlfrescoSettingsService, AlfrescoApiService } from 'ng2-alfresco-core';
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { TagNodeList } from '../components/tag-node-list.component';
import { DebugElement } from '@angular/core';
import {
AlfrescoAuthenticationService,
AlfrescoSettingsService,
AlfrescoApiService,
CoreModule
} from 'ng2-alfresco-core';
import { TagService } from '../services/tag.service';
import { TagNodeList } from './tag-node-list.component';
declare let jasmine: any;
describe('Tag relative node list', () => {
let tagNodeListFixture, element, component;
let dataTag = {
'list': {
@@ -44,25 +47,36 @@ describe('Tag relative node list', () => {
}
};
beforeEachProviders(() => {
return [
AlfrescoSettingsService,
AlfrescoAuthenticationService,
AlfrescoApiService,
TagService
];
});
let component: any;
let fixture: ComponentFixture<TagNodeList>;
let debug: DebugElement;
let element: HTMLElement;
beforeEach(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb
.createAsync(TagNodeList)
.then(fixture => {
tagNodeListFixture = fixture;
element = tagNodeListFixture.nativeElement;
component = tagNodeListFixture.componentInstance;
});
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
CoreModule
],
declarations: [TagNodeList],
providers: [
AlfrescoSettingsService,
AlfrescoAuthenticationService,
AlfrescoApiService,
TagService
]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TagNodeList);
component = fixture.componentInstance;
debug = fixture.debugElement;
element = fixture.nativeElement;
component = fixture.componentInstance;
fixture.detectChanges();
});
describe('Rendering tests', () => {
beforeEach(() => {
@@ -77,7 +91,7 @@ describe('Tag relative node list', () => {
component.nodeId = 'fake-node-id';
component.resultsEmitter.subscribe(() => {
tagNodeListFixture.detectChanges();
fixture.detectChanges();
expect(element.querySelector('#tag_name_0').innerHTML).toBe('test1');
expect(element.querySelector('#tag_name_1').innerHTML).toBe('test2');
@@ -103,8 +117,10 @@ describe('Tag relative node list', () => {
component.nodeId = 'fake-node-id';
component.resultsEmitter.subscribe(() => {
tagNodeListFixture.detectChanges();
element.querySelector('#tag_delete_0').click();
fixture.detectChanges();
let deleteButton: any = element.querySelector('#tag_delete_0');
deleteButton.click();
expect(jasmine.Ajax.requests.mostRecent().url).
toBe('http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags/0ee933fa-57fc-4587-8a77-b787e814f1d2');
@@ -122,4 +138,4 @@ describe('Tag relative node list', () => {
});
});
});
*/

View File

@@ -25,10 +25,9 @@ import { TagService } from '../services/tag.service';
*
* @returns {TagNodeList} .
*/
declare let __moduleName: string;
@Component({
moduleId: __moduleName,
moduleId: module.id,
selector: 'alfresco-tag-node-list',
templateUrl: './tag-node-list.component.html',
styleUrls: ['./tag-node-list.component.css']

View File

@@ -15,30 +15,32 @@
* limitations under the License.
*/
/*
import { describe, expect, it, inject, beforeEachProviders, beforeEach, afterEach } from '@angular/core/testing';
import { AlfrescoAuthenticationService, AlfrescoSettingsService, AlfrescoApiService } from 'ng2-alfresco-core';
import { TagService } from './tag.service';
import { ReflectiveInjector } from '@angular/core';
import {
AlfrescoAuthenticationService,
AlfrescoSettingsService,
AlfrescoApiService
} from 'ng2-alfresco-core';
import { TagService } from '../services/tag.service';
declare let jasmine: any;
describe('Tag service', () => {
let service;
let service, injector;
beforeEachProviders(() => {
return [
beforeEach(() => {
injector = ReflectiveInjector.resolveAndCreate([
AlfrescoSettingsService,
AlfrescoAuthenticationService,
AlfrescoApiService,
AlfrescoAuthenticationService,
TagService
];
]);
});
beforeEach(inject([TagService], (tagService: TagService) => {
service = tagService;
}));
beforeEach(() => {
service = injector.get(TagService);
});
describe('Content tests', () => {
@@ -114,4 +116,4 @@ describe('Tag service', () => {
});
});
});
*/

View File

@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "es5",
"module": "system",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
@@ -16,7 +16,7 @@
"noImplicitUseStrict": false,
"noFallthroughCasesInSwitch": true,
"outDir": "dist",
"types": ["core-js", "jasmine"]
"types": ["core-js", "jasmine", "node"]
},
"exclude": [
"demo",