mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
component(): sidenav component.
This commit is contained in:
+23
-10
@@ -11,13 +11,14 @@ __karma__.loaded = function() {};
|
||||
*/
|
||||
function getPathsMap(dir) {
|
||||
return Object.keys(window.__karma__.files)
|
||||
.filter(isComponentsFile)
|
||||
.filter(not(isSpecFile))
|
||||
.filter(function(x) { return new RegExp('^/base/dist/' + dir + '/.*\\.js$').test(x); })
|
||||
.reduce(function(pathsMapping, appPath) {
|
||||
var pathToReplace = new RegExp('^/base/dist/' + dir + '/');
|
||||
var moduleName = appPath.replace(pathToReplace, './').replace(/\.js$/, '');
|
||||
pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath];
|
||||
return pathsMapping;
|
||||
}, {});
|
||||
return pathsMapping;
|
||||
}, {});
|
||||
}
|
||||
|
||||
System.config({
|
||||
@@ -26,7 +27,17 @@ System.config({
|
||||
defaultExtension: false,
|
||||
format: 'register',
|
||||
map: getPathsMap('components')
|
||||
}
|
||||
},
|
||||
'base/dist/core': {
|
||||
defaultExtension: false,
|
||||
format: 'register',
|
||||
map: getPathsMap('core')
|
||||
},
|
||||
'base/dist/directives': {
|
||||
defaultExtension: false,
|
||||
format: 'register',
|
||||
map: getPathsMap('directives')
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
@@ -36,7 +47,7 @@ System.import('angular2/platform/browser').then(function(browser_adapter) {
|
||||
}).then(function() {
|
||||
return Promise.all(
|
||||
Object.keys(window.__karma__.files)
|
||||
.filter(onlySpecFiles)
|
||||
.filter(isSpecFile)
|
||||
.map(function(moduleName) {
|
||||
return System.import(moduleName);
|
||||
}));
|
||||
@@ -46,10 +57,12 @@ System.import('angular2/platform/browser').then(function(browser_adapter) {
|
||||
__karma__.error(error.stack || error);
|
||||
});
|
||||
|
||||
function isComponentsFile(filePath) {
|
||||
return /^\/base\/dist\/components\/(?!spec)([a-z0-9-_\/]+)\.js$/.test(filePath);
|
||||
}
|
||||
|
||||
function onlySpecFiles(path) {
|
||||
function isSpecFile(path) {
|
||||
return /\.spec\.js$/.test(path);
|
||||
}
|
||||
|
||||
function not(fn) {
|
||||
return function() {
|
||||
return !fn.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -46,6 +46,8 @@ export function config(config) {
|
||||
// required for component assests fetched by Angular's compiler
|
||||
'/demo-app/': '/base/dist/demo-app/',
|
||||
'/components/': '/base/dist/components/',
|
||||
'/core/': '/base/dist/core/',
|
||||
'/directives/': '/base/dist/directives/',
|
||||
},
|
||||
|
||||
customLaunchers: customLaunchers,
|
||||
|
||||
Reference in New Issue
Block a user