mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
Fix unit tests and code coverage for document list
This commit is contained in:
parent
bbcd83b377
commit
b84b63b2f9
73
ng2-components/ng2-alfresco-documentlist/karma-test-shim.js
Normal file
73
ng2-components/ng2-alfresco-documentlist/karma-test-shim.js
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
// Tun on full stack traces in errors to help debugging
|
||||||
|
Error.stackTraceLimit = Infinity;
|
||||||
|
|
||||||
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
|
||||||
|
|
||||||
|
// // Cancel Karma's synchronous start,
|
||||||
|
// // we will call `__karma__.start()` later, once all the specs are loaded.
|
||||||
|
__karma__.loaded = function() {};
|
||||||
|
|
||||||
|
System.config({
|
||||||
|
packages: {
|
||||||
|
'base/dist': {
|
||||||
|
defaultExtension: 'js',
|
||||||
|
format: 'register',
|
||||||
|
map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {})
|
||||||
|
},
|
||||||
|
'ng2-alfresco-services': {
|
||||||
|
defaultExtension: 'js'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
map: {
|
||||||
|
'ng2-alfresco-core': '/base/dist/node_modules/ng2-alfresco-core'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
System.import('angular2/src/platform/browser/browser_adapter')
|
||||||
|
.then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); })
|
||||||
|
.then(function() { return Promise.all(resolveTestFiles()); })
|
||||||
|
.then(
|
||||||
|
function() {
|
||||||
|
__karma__.start();
|
||||||
|
},
|
||||||
|
function(error) {
|
||||||
|
__karma__.error(error.stack || error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
function createPathRecords(pathsMapping, appPath) {
|
||||||
|
// creates local module name mapping to global path with karma's fingerprint in path, e.g.:
|
||||||
|
// './vg-player/vg-player':
|
||||||
|
// '/base/dist/vg-player/vg-player.js?f4523daf879cfb7310ef6242682ccf10b2041b3e'
|
||||||
|
var moduleName = './' + resolveKeyPathForMapping('base/dist/', appPath);
|
||||||
|
moduleName = moduleName.replace(/\.js$/, '');
|
||||||
|
pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath];
|
||||||
|
return pathsMapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onlyAppFiles(filePath) {
|
||||||
|
return /\/base\/dist\/(?!.*\.spec\.js$).*\.js$/.test(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onlySpecFiles(path) {
|
||||||
|
return /\.spec\.js$/.test(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveTestFiles() {
|
||||||
|
return Object.keys(window.__karma__.files) // All files served by Karma.
|
||||||
|
.filter(onlySpecFiles)
|
||||||
|
.map(function(moduleName) {
|
||||||
|
// loads all spec files via their global module names (e.g.
|
||||||
|
// 'base/dist/vg-player/vg-player.spec')
|
||||||
|
return System.import(moduleName);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveKeyPathForMapping(basePathWhereToStart, appPath) {
|
||||||
|
var location = appPath.indexOf(basePathWhereToStart);
|
||||||
|
if (location > -1) {
|
||||||
|
return appPath.substring(basePathWhereToStart.length + 1);
|
||||||
|
} else {
|
||||||
|
return appPath;
|
||||||
|
}
|
||||||
|
}
|
@ -1,129 +1,68 @@
|
|||||||
// Karma configuration
|
|
||||||
// Generated on Wed Jul 15 2015 09:44:02 GMT+0200 (Romance Daylight Time)
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var argv = require('yargs').argv;
|
|
||||||
|
|
||||||
module.exports = function(config) {
|
module.exports = function(config) {
|
||||||
config.set({
|
config.set({
|
||||||
|
|
||||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
basePath: '.',
|
||||||
basePath: './',
|
|
||||||
|
|
||||||
|
|
||||||
// frameworks to use
|
|
||||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
|
||||||
frameworks: ['jasmine'],
|
frameworks: ['jasmine'],
|
||||||
|
|
||||||
|
|
||||||
// list of files / patterns to load in the browser
|
|
||||||
files: [
|
files: [
|
||||||
'node_modules/zone.js/dist/zone.js',
|
// paths loaded by Karma
|
||||||
'node_modules/zone.js/dist/long-stack-trace-zone.js',
|
{pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: true},
|
||||||
'node_modules/zone.js/dist/jasmine-patch.js',
|
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true},
|
||||||
'node_modules/zone.js/dist/async-test.js',
|
{pattern: 'node_modules/rxjs/bundles/Rx.js', included: true, watched: true},
|
||||||
'node_modules/zone.js/dist/fake-async-test.js',
|
{pattern: 'node_modules/angular2/bundles/angular2.dev.js', included: true, watched: true},
|
||||||
'node_modules/es6-module-loader/dist/es6-module-loader.js',
|
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: true},
|
||||||
'node_modules/traceur/bin/traceur-runtime.js', // Required by PhantomJS2, otherwise it shouts ReferenceError: Can't find variable: require
|
{pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, watched: true},
|
||||||
'node_modules/traceur/bin/traceur.js',
|
{pattern: 'node_modules/alfresco-core-rest-api/bundle.js', included: true, watched: false},
|
||||||
'node_modules/systemjs/dist/system.src.js',
|
|
||||||
'node_modules/reflect-metadata/Reflect.js',
|
|
||||||
'node_modules/angular2/es6/dev/src/testing/shims_for_IE.js',
|
|
||||||
{ pattern: 'node_modules/angular2/**/*.js', included: false, watched: false },
|
|
||||||
{ pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
|
|
||||||
{ pattern: 'dist/**/*.js', included: false, watched: true },
|
|
||||||
{ pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: false, watched: false }, // PhantomJS2 (and possibly others) might require it
|
|
||||||
{ pattern: 'node_modules/ng2-alfresco-core/services.js', included: false, watched: false }, // source files
|
|
||||||
{ pattern: 'node_modules/ng2-alfresco-core/services/*.js', included: false, watched: false }, // source files
|
|
||||||
|
|
||||||
// suppress annoying 404 warnings for resources, images, etc.
|
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||||
//{ pattern: 'dist/src/assets/**/*', watched: false, included: false, served: true },
|
|
||||||
|
|
||||||
'test-main.js'
|
// paths loaded via module imports
|
||||||
|
{pattern: 'dist/**/*.js', included: false, watched: true},
|
||||||
|
|
||||||
|
// paths to support debugging with source maps in dev tools
|
||||||
|
{pattern: 'src/**/*.ts', included: false, watched: false},
|
||||||
|
{pattern: 'dist/**/*.js.map', included: false, watched: false}
|
||||||
],
|
],
|
||||||
|
|
||||||
// must go along with above, suppress annoying 404 warnings.
|
// proxied base paths
|
||||||
proxies: {
|
proxies: {
|
||||||
'/assets/': '/base/dist/dev/assets/'
|
// required for component assets fetched by Angular's compiler
|
||||||
|
'/src/': '/base/src/'
|
||||||
},
|
},
|
||||||
|
|
||||||
// list of files to exclude
|
port: 9876,
|
||||||
exclude: [
|
|
||||||
'node_modules/angular2/**/*spec.js'
|
logLevel: config.LOG_DEBUG,
|
||||||
|
|
||||||
|
colors: true,
|
||||||
|
|
||||||
|
autoWatch: true,
|
||||||
|
|
||||||
|
browsers: ['Chrome'],
|
||||||
|
|
||||||
|
// Karma plugins loaded
|
||||||
|
plugins: [
|
||||||
|
'karma-jasmine',
|
||||||
|
'karma-coverage',
|
||||||
|
'karma-chrome-launcher'
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// Coverage reporter generates the coverage
|
||||||
|
reporters: ['progress', 'dots', 'coverage'],
|
||||||
|
|
||||||
// preprocess matching files before serving them to the browser
|
// Source files that you wanna generate coverage for.
|
||||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
// Do not include tests or libraries (these files will be instrumented by Istanbul)
|
||||||
preprocessors: {
|
preprocessors: {
|
||||||
'dist/**/!(*spec).js': ['coverage']
|
'dist/**/!(*spec).js': ['coverage']
|
||||||
},
|
},
|
||||||
|
|
||||||
// test results reporter to use
|
|
||||||
// possible values: 'dots', 'progress'
|
|
||||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
|
||||||
reporters: ['mocha', 'coverage'],
|
|
||||||
|
|
||||||
|
|
||||||
// web server port
|
|
||||||
port: 9876,
|
|
||||||
|
|
||||||
|
|
||||||
// enable / disable colors in the output (reporters and logs)
|
|
||||||
colors: true,
|
|
||||||
|
|
||||||
|
|
||||||
// level of logging
|
|
||||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
|
||||||
logLevel: config.LOG_INFO,
|
|
||||||
|
|
||||||
|
|
||||||
// enable / disable watching file and executing tests whenever any file changes
|
|
||||||
autoWatch: true,
|
|
||||||
|
|
||||||
|
|
||||||
// start these browsers
|
|
||||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
|
||||||
browsers: [
|
|
||||||
'PhantomJS',
|
|
||||||
'Chrome'
|
|
||||||
],
|
|
||||||
|
|
||||||
|
|
||||||
customLaunchers: {
|
|
||||||
Chrome_travis_ci: {
|
|
||||||
base: 'Chrome',
|
|
||||||
flags: ['--no-sandbox']
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
coverageReporter: {
|
coverageReporter: {
|
||||||
dir: 'coverage/',
|
reporters:[
|
||||||
reporters: [
|
{type: 'json', subdir: '.', file: 'coverage-final.json'}
|
||||||
{ type: 'text-summary' },
|
|
||||||
{ type: 'json', subdir: '.', file: 'coverage-final.json' },
|
|
||||||
{ type: 'html' }
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
// Continuous Integration mode
|
singleRun: true
|
||||||
// if true, Karma captures browsers, runs the tests and exits
|
})
|
||||||
singleRun: false,
|
|
||||||
|
|
||||||
// Passing command line arguments to tests
|
|
||||||
client: {
|
|
||||||
files: argv.files
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (process.env.APPVEYOR) {
|
|
||||||
config.browsers = ['IE'];
|
|
||||||
config.singleRun = true;
|
|
||||||
config.browserNoActivityTimeout = 90000; // Note: default value (10000) is not enough
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.env.TRAVIS || process.env.CIRCLECI) {
|
|
||||||
config.browsers = ['Chrome_travis_ci'];
|
|
||||||
config.singleRun = true;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
@ -1,91 +1,89 @@
|
|||||||
{
|
{
|
||||||
"name": "ng2-alfresco-documentlist",
|
"name": "ng2-alfresco-documentlist",
|
||||||
"description": "Alfresco Angular2 Document List Component",
|
"description": "Alfresco Angular2 Document List Component",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"author": "Alfresco Software, Ltd.",
|
"author": "Alfresco Software, Ltd.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npm run tslint-test && npm run tslint-src && npm run tslint-root && typings install && rm -rf dist && tsc && license-check",
|
"postinstall": "npm run typings",
|
||||||
"tslint-test": "tslint -c tslint.json test/**/*.ts",
|
"typings": "typings install",
|
||||||
"tslint-src": "tslint -c tslint.json src/**/*.ts",
|
"start": "npm run test && http-server -c-1 -o -p 8875 .",
|
||||||
"tslint-root": "tslint -c tslint.json *.ts",
|
"build": "npm run tslint-test && npm run tslint-src && npm run tslint-root && typings install && rm -rf dist && tsc && license-check",
|
||||||
"licensecheck": "license-check",
|
"tslint-test": "tslint -c tslint.json test/**/*.ts",
|
||||||
"tsc": "tsc",
|
"tslint-src": "tslint -c tslint.json src/**/*.ts",
|
||||||
"tsc:w": "tsc -w",
|
"tslint-root": "tslint -c tslint.json *.ts",
|
||||||
"typings": "typings",
|
"licensecheck": "license-check",
|
||||||
"test": "karma start karma.conf.js"
|
"tsc": "tsc",
|
||||||
},
|
"pretest": "npm run build",
|
||||||
"repository": {
|
"test": "karma start karma.conf.js",
|
||||||
"type": "git",
|
"posttest": "node_modules/.bin/remap-istanbul -i coverage/coverage-final.json -o coverage -t html",
|
||||||
"url": "https://github.com/Alfresco/dev-platform-webcomponents.git"
|
"coverage": "http-server -c-1 -o -p 9875 ./coverage"
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/Alfresco/dev-platform-webcomponents/issues"
|
|
||||||
},
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Denys Vuika",
|
|
||||||
"email": "denis.vuyka@gmail.com"
|
|
||||||
},
|
},
|
||||||
{
|
"repository": {
|
||||||
"name": "Mario Romano",
|
"type": "git",
|
||||||
"email": "mario.romano83@gmail.com"
|
"url": "https://github.com/Alfresco/dev-platform-webcomponents.git"
|
||||||
}
|
},
|
||||||
],
|
"bugs": {
|
||||||
"keywords": [
|
"url": "https://github.com/Alfresco/dev-platform-webcomponents/issues"
|
||||||
"ng2",
|
},
|
||||||
"angular",
|
"license": "Apache-2.0",
|
||||||
"angular2",
|
"contributors": [
|
||||||
"alfresco"
|
{
|
||||||
],
|
"name": "Denys Vuika",
|
||||||
"dependencies": {
|
"email": "denis.vuyka@gmail.com"
|
||||||
"angular2": "2.0.0-beta.15",
|
},
|
||||||
"systemjs": "0.19.26",
|
{
|
||||||
"es6-shim": "^0.35.0",
|
"name": "Mario Romano",
|
||||||
"reflect-metadata": "0.1.2",
|
"email": "mario.romano83@gmail.com"
|
||||||
"rxjs": "5.0.0-beta.2",
|
}
|
||||||
"zone.js": "^0.6.12",
|
|
||||||
"es6-module-loader": "^0.17.8"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"angular2": "2.0.0-beta.15"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"concurrently": "^2.0.0",
|
|
||||||
"coveralls": "^2.11.9",
|
|
||||||
"jasmine-core": "2.4.1",
|
|
||||||
"jasmine-spec-reporter": "^2.4.0",
|
|
||||||
"karma": "~0.13.22",
|
|
||||||
"karma-chrome-launcher": "~1.0.1",
|
|
||||||
"karma-coverage": "^1.0.0",
|
|
||||||
"karma-ie-launcher": "^1.0.0",
|
|
||||||
"karma-jasmine": "~1.0.2",
|
|
||||||
"karma-mocha-reporter": "^2.0.3",
|
|
||||||
"karma-phantomjs-launcher": "^1.0.0",
|
|
||||||
"license-check": "^1.0.4",
|
|
||||||
"live-server": "^0.9.2",
|
|
||||||
"phantomjs-prebuilt": "^2.1.7",
|
|
||||||
"remap-istanbul": "^0.6.3",
|
|
||||||
"traceur": "^0.0.91",
|
|
||||||
"tslint": "^3.8.1",
|
|
||||||
"typescript": "^1.8.10",
|
|
||||||
"typings": "^0.7.12",
|
|
||||||
"xo": "^0.14.0",
|
|
||||||
"yargs": "^4.7.0"
|
|
||||||
},
|
|
||||||
"license-check-config": {
|
|
||||||
"src": [
|
|
||||||
"**/*.js",
|
|
||||||
"**/*.ts",
|
|
||||||
"!/**/coverage/**/*",
|
|
||||||
"!/**/demo/**/*",
|
|
||||||
"!/**/node_modules/**/*",
|
|
||||||
"!/**/typings/**/*",
|
|
||||||
"!*.js"
|
|
||||||
],
|
],
|
||||||
"path": "assets/license_header.txt",
|
"keywords": [
|
||||||
"blocking": false,
|
"ng2",
|
||||||
"logInfo": false,
|
"angular",
|
||||||
"logError": true
|
"angular2",
|
||||||
}
|
"alfresco"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"angular2": "2.0.0-beta.15",
|
||||||
|
"systemjs": "0.19.26",
|
||||||
|
"es6-shim": "^0.35.0",
|
||||||
|
"reflect-metadata": "0.1.2",
|
||||||
|
"rxjs": "5.0.0-beta.2",
|
||||||
|
"zone.js": "^0.6.12",
|
||||||
|
"es6-module-loader": "^0.17.8"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"angular2": "2.0.0-beta.15"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"coveralls": "^2.11.9",
|
||||||
|
"jasmine-core": "2.4.1",
|
||||||
|
"karma": "~0.13.22",
|
||||||
|
"karma-chrome-launcher": "~1.0.1",
|
||||||
|
"karma-coverage": "^1.0.0",
|
||||||
|
"karma-jasmine": "~1.0.2",
|
||||||
|
"license-check": "^1.0.4",
|
||||||
|
"remap-istanbul": "^0.6.3",
|
||||||
|
"traceur": "^0.0.91",
|
||||||
|
"tslint": "^3.8.1",
|
||||||
|
"typescript": "^1.8.10",
|
||||||
|
"typings": "^0.7.12",
|
||||||
|
"xo": "^0.14.0",
|
||||||
|
"yargs": "^4.7.0",
|
||||||
|
"http-server": "0.8.5"
|
||||||
|
},
|
||||||
|
"license-check-config": {
|
||||||
|
"src": [
|
||||||
|
"**/*.js",
|
||||||
|
"**/*.ts",
|
||||||
|
"!/**/coverage/**/*",
|
||||||
|
"!/**/demo/**/*",
|
||||||
|
"!/**/node_modules/**/*",
|
||||||
|
"!/**/typings/**/*",
|
||||||
|
"!*.js"
|
||||||
|
],
|
||||||
|
"path": "assets/license_header.txt",
|
||||||
|
"blocking": false,
|
||||||
|
"logInfo": false,
|
||||||
|
"logError": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,12 +22,14 @@ import {
|
|||||||
beforeEach
|
beforeEach
|
||||||
} from 'angular2/testing';
|
} from 'angular2/testing';
|
||||||
import {EventEmitter} from 'angular2/core';
|
import {EventEmitter} from 'angular2/core';
|
||||||
import {DocumentList} from '../../src/components/document-list';
|
|
||||||
|
import {DocumentList} from './document-list';
|
||||||
import {AlfrescoServiceMock} from '../assets/alfresco.service.mock';
|
import {AlfrescoServiceMock} from '../assets/alfresco.service.mock';
|
||||||
import {ContentActionList} from '../../src/components/content-action-list';
|
|
||||||
import {ContentAction} from '../../src/components/content-action';
|
import {ContentActionList} from './content-action-list';
|
||||||
import {DocumentActionsService} from '../../src/services/document-actions.service';
|
import {ContentAction} from './content-action';
|
||||||
import {FolderActionsService} from '../../src/services/folder-actions.service';
|
import {DocumentActionsService} from '../services/document-actions.service';
|
||||||
|
import {FolderActionsService} from '../services/folder-actions.service';
|
||||||
|
|
||||||
describe('ContentAction', () => {
|
describe('ContentAction', () => {
|
||||||
|
|
||||||
@ -175,5 +177,4 @@ describe('ContentAction', () => {
|
|||||||
let model = documentList.actions[0];
|
let model = documentList.actions[0];
|
||||||
model.handler('<obj>');
|
model.handler('<obj>');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -21,10 +21,11 @@ import {
|
|||||||
expect,
|
expect,
|
||||||
beforeEach
|
beforeEach
|
||||||
} from 'angular2/testing';
|
} from 'angular2/testing';
|
||||||
import {DocumentList} from '../../src/components/document-list';
|
|
||||||
|
import {DocumentList} from './document-list';
|
||||||
import {AlfrescoServiceMock} from '../assets/alfresco.service.mock';
|
import {AlfrescoServiceMock} from '../assets/alfresco.service.mock';
|
||||||
import {ContentColumnList} from '../../src/components/content-column-list';
|
import {ContentColumnList} from './content-column-list';
|
||||||
import {ContentColumnModel} from '../../src/models/content-column.model';
|
import {ContentColumnModel} from '../models/content-column.model';
|
||||||
|
|
||||||
describe('ContentColumnList', () => {
|
describe('ContentColumnList', () => {
|
||||||
|
|
||||||
|
@ -21,10 +21,11 @@ import {
|
|||||||
expect,
|
expect,
|
||||||
beforeEach
|
beforeEach
|
||||||
} from 'angular2/testing';
|
} from 'angular2/testing';
|
||||||
import {DocumentList} from '../../src/components/document-list';
|
|
||||||
import {ContentColumn} from '../../src/components/content-column';
|
import {DocumentList} from './document-list';
|
||||||
|
import {ContentColumn} from './content-column';
|
||||||
import {AlfrescoServiceMock} from '../assets/alfresco.service.mock';
|
import {AlfrescoServiceMock} from '../assets/alfresco.service.mock';
|
||||||
import {ContentColumnList} from '../../src/components/content-column-list';
|
import {ContentColumnList} from './content-column-list';
|
||||||
|
|
||||||
describe('ContentColumn', () => {
|
describe('ContentColumn', () => {
|
||||||
|
|
||||||
|
@ -21,11 +21,12 @@ import {
|
|||||||
expect,
|
expect,
|
||||||
beforeEach
|
beforeEach
|
||||||
} from 'angular2/testing';
|
} from 'angular2/testing';
|
||||||
import { DocumentList } from '../../src/components/document-list';
|
|
||||||
import { ContentColumnModel } from '../../src/models/content-column.model';
|
import { DocumentList } from './document-list';
|
||||||
|
import { ContentColumnModel } from '../models/content-column.model';
|
||||||
import { AlfrescoServiceMock } from '../assets/alfresco.service.mock';
|
import { AlfrescoServiceMock } from '../assets/alfresco.service.mock';
|
||||||
import { MinimalNodeEntity } from '../../src/models/document-library.model';
|
import { MinimalNodeEntity, MinimalNodeEntryEntity } from '../models/document-library.model';
|
||||||
import { ContentActionModel } from '../../src/models/content-action.model';
|
import { ContentActionModel } from '../models/content-action.model';
|
||||||
|
|
||||||
describe('DocumentList', () => {
|
describe('DocumentList', () => {
|
||||||
|
|
||||||
@ -256,6 +257,7 @@ describe('DocumentList', () => {
|
|||||||
let path = '/';
|
let path = '/';
|
||||||
|
|
||||||
let node = new MinimalNodeEntity();
|
let node = new MinimalNodeEntity();
|
||||||
|
node.entry = new MinimalNodeEntryEntity();
|
||||||
node.entry.isFolder = true;
|
node.entry.isFolder = true;
|
||||||
node.entry.name = '<display name>';
|
node.entry.name = '<display name>';
|
||||||
|
|
||||||
@ -285,6 +287,7 @@ describe('DocumentList', () => {
|
|||||||
spyOn(documentList, 'displayFolderContent').and.stub();
|
spyOn(documentList, 'displayFolderContent').and.stub();
|
||||||
|
|
||||||
let node = new MinimalNodeEntity();
|
let node = new MinimalNodeEntity();
|
||||||
|
node.entry = new MinimalNodeEntryEntity();
|
||||||
node.entry.isFolder = false;
|
node.entry.isFolder = false;
|
||||||
|
|
||||||
documentList.onItemClick(node);
|
documentList.onItemClick(node);
|
||||||
@ -296,6 +299,7 @@ describe('DocumentList', () => {
|
|||||||
spyOn(documentList, 'displayFolderContent').and.stub();
|
spyOn(documentList, 'displayFolderContent').and.stub();
|
||||||
|
|
||||||
let node = new MinimalNodeEntity();
|
let node = new MinimalNodeEntity();
|
||||||
|
node.entry = new MinimalNodeEntryEntity();
|
||||||
node.entry.isFolder = true;
|
node.entry.isFolder = true;
|
||||||
node.entry.name = '<display name>';
|
node.entry.name = '<display name>';
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ import {
|
|||||||
AfterContentInit,
|
AfterContentInit,
|
||||||
AfterViewChecked
|
AfterViewChecked
|
||||||
} from 'angular2/core';
|
} from 'angular2/core';
|
||||||
|
|
||||||
import { AlfrescoService } from './../services/alfresco.service';
|
import { AlfrescoService } from './../services/alfresco.service';
|
||||||
import { MinimalNodeEntity, NodePaging } from './../models/document-library.model';
|
import { MinimalNodeEntity, NodePaging } from './../models/document-library.model';
|
||||||
import { ContentActionModel } from './../models/content-action.model';
|
import { ContentActionModel } from './../models/content-action.model';
|
||||||
@ -60,7 +61,7 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
|
|||||||
name: 'Document Library',
|
name: 'Document Library',
|
||||||
path: 'Sites/swsdp/documentLibrary'
|
path: 'Sites/swsdp/documentLibrary'
|
||||||
};
|
};
|
||||||
currentFolderPath: string = 'swsdp/documentLibrary';
|
currentFolderPath: string = 'Sites/swsdp/documentLibrary';
|
||||||
folder: NodePaging;
|
folder: NodePaging;
|
||||||
errorMessage;
|
errorMessage;
|
||||||
|
|
||||||
@ -152,7 +153,7 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (this.navigate && item) {
|
if (this.navigate && item) {
|
||||||
if (item.entry.isFolder) {
|
if (item.entry && item.entry.isFolder) {
|
||||||
let path = this.getNodePath(item);
|
let path = this.getNodePath(item);
|
||||||
|
|
||||||
this.folderClick.emit({
|
this.folderClick.emit({
|
||||||
|
@ -21,8 +21,8 @@ import {
|
|||||||
expect,
|
expect,
|
||||||
beforeEach
|
beforeEach
|
||||||
} from 'angular2/testing';
|
} from 'angular2/testing';
|
||||||
import {ContentActionHandler} from '../../src/models/content-action.model';
|
import {ContentActionHandler} from '../models/content-action.model';
|
||||||
import {DocumentActionsService} from '../../src/services/document-actions.service';
|
import {DocumentActionsService} from './document-actions.service';
|
||||||
import {AlfrescoServiceMock} from '../assets/alfresco.service.mock';
|
import {AlfrescoServiceMock} from '../assets/alfresco.service.mock';
|
||||||
|
|
||||||
describe('DocumentActionsService', () => {
|
describe('DocumentActionsService', () => {
|
||||||
|
@ -21,8 +21,8 @@ import {
|
|||||||
expect,
|
expect,
|
||||||
beforeEach
|
beforeEach
|
||||||
} from 'angular2/testing';
|
} from 'angular2/testing';
|
||||||
import {FolderActionsService} from '../../src/services/folder-actions.service';
|
import {FolderActionsService} from './folder-actions.service';
|
||||||
import {ContentActionHandler} from '../../src/models/content-action.model';
|
import {ContentActionHandler} from '../models/content-action.model';
|
||||||
|
|
||||||
describe('FolderActionsService', () => {
|
describe('FolderActionsService', () => {
|
||||||
|
|
||||||
|
@ -1,79 +0,0 @@
|
|||||||
if (!Object.hasOwnProperty('name')) {
|
|
||||||
Object.defineProperty(Function.prototype, 'name', {
|
|
||||||
get: function() {
|
|
||||||
var matches = this.toString().match(/^\s*function\s*(\S*)\s*\(/);
|
|
||||||
var name = matches && matches.length > 1 ? matches[1] : "";
|
|
||||||
Object.defineProperty(this, 'name', {value: name});
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Turn on full stack traces in errors to help debugging
|
|
||||||
Error.stackTraceLimit = Infinity;
|
|
||||||
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
|
|
||||||
|
|
||||||
// Cancel Karma's synchronous start,
|
|
||||||
// we will call `__karma__.start()` later, once all the specs are loaded.
|
|
||||||
__karma__.loaded = function() {};
|
|
||||||
|
|
||||||
System.config({
|
|
||||||
baseURL: '/base/',
|
|
||||||
defaultJSExtensions: true,
|
|
||||||
paths: {
|
|
||||||
'angular2/*': 'node_modules/angular2/*.js',
|
|
||||||
'rxjs/*': 'node_modules/rxjs/*.js',
|
|
||||||
'ng2-alfresco-core/*': 'node_modules/ng2-alfresco-core/services.js',
|
|
||||||
'ng2-alfresco-core/services/*': 'node_modules/ng2-alfresco-core/services/*'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Promise.all([
|
|
||||||
System.import('angular2/src/platform/browser/browser_adapter'),
|
|
||||||
System.import('angular2/platform/testing/browser'),
|
|
||||||
System.import('angular2/testing')
|
|
||||||
]).then(function (modules) {
|
|
||||||
var browser_adapter = modules[0];
|
|
||||||
var providers = modules[1];
|
|
||||||
var testing = modules[2];
|
|
||||||
testing.setBaseTestProviders(providers.TEST_BROWSER_PLATFORM_PROVIDERS,
|
|
||||||
providers.TEST_BROWSER_APPLICATION_PROVIDERS);
|
|
||||||
|
|
||||||
browser_adapter.BrowserDomAdapter.makeCurrent();
|
|
||||||
}).then(function() {
|
|
||||||
return Promise.all(
|
|
||||||
Object.keys(window.__karma__.files) // All files served by Karma.
|
|
||||||
.filter(onlySpecFiles)
|
|
||||||
.map(file2moduleName)
|
|
||||||
.map(function(path) {
|
|
||||||
return System.import(path).then(function(module) {
|
|
||||||
if (module.hasOwnProperty('main')) {
|
|
||||||
module.main();
|
|
||||||
} else {
|
|
||||||
throw new Error('Module ' + path + ' does not implement main() method.');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
})
|
|
||||||
.then(function() {
|
|
||||||
__karma__.start();
|
|
||||||
}, function(error) {
|
|
||||||
// console.error(error.stack || error);
|
|
||||||
__karma__.start();
|
|
||||||
});
|
|
||||||
|
|
||||||
function onlySpecFiles(path) {
|
|
||||||
// check for individual files, if not given, always matches to all
|
|
||||||
var patternMatched = __karma__.config.files ?
|
|
||||||
path.match(new RegExp(__karma__.config.files)) : true;
|
|
||||||
|
|
||||||
return patternMatched && /[\.|_]spec\.js$/.test(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Normalize paths to module names.
|
|
||||||
function file2moduleName(filePath) {
|
|
||||||
return filePath.replace(/\\/g, '/')
|
|
||||||
.replace(/^\/base\//, '')
|
|
||||||
.replace(/\.js$/, '');
|
|
||||||
}
|
|
@ -1,27 +1,20 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"module": "commonjs",
|
"module": "system",
|
||||||
"declaration": true,
|
"moduleResolution": "node",
|
||||||
"removeComments": true,
|
|
||||||
"noLib": false,
|
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"allowUnreachableCode": false,
|
"removeComments": true,
|
||||||
"allowUnusedLabels": false,
|
"declaration": true,
|
||||||
"noImplicitAny": false,
|
|
||||||
"noImplicitReturns": false,
|
|
||||||
"noImplicitUseStrict": false,
|
|
||||||
"noFallthroughCasesInSwitch": true,
|
|
||||||
"outDir": "dist"
|
"outDir": "dist"
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
"backup",
|
||||||
|
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"dist",
|
"typings/main",
|
||||||
"typings/browser.d.ts",
|
"typings/main.d.ts"
|
||||||
"typings/browser",
|
]
|
||||||
"demo"
|
|
||||||
],
|
|
||||||
"compileOnSave": false
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user