-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into Issue-1889-fix-completion-command-invalid
- Loading branch information
Showing
21 changed files
with
133 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,6 @@ | |
"protractor": "4.0.3", | ||
"ts-node": "1.2.1", | ||
"tslint": "3.13.0", | ||
"typescript": "^2.0.0" | ||
"typescript": "2.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "@angular-cli/base-href-webpack", | ||
"version": "1.0.0", | ||
"description": "Base HREF Webpack plugin", | ||
"main": "./src/index.js", | ||
"keywords": [ | ||
"angular", | ||
"cli", | ||
"webpack", | ||
"plugin", | ||
"tool" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/angular/angular-cli.git" | ||
}, | ||
"author": "angular", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/angular/angular-cli/issues" | ||
}, | ||
"homepage": "https://github.com/angular/angular-cli", | ||
"dependencies": { | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
packages/base-href-webpack/src/base-href-webpack-plugin.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import {oneLineTrim} from 'common-tags'; | ||
import {BaseHrefWebpackPlugin} from './base-href-webpack-plugin'; | ||
|
||
|
||
function mockCompiler(indexHtml, callback) { | ||
return { | ||
plugin: function (event, compilerCallback) { | ||
const compilation = { | ||
plugin: function (hook, compilationCallback) { | ||
const htmlPluginData = { | ||
html: indexHtml | ||
}; | ||
compilationCallback(htmlPluginData, callback); | ||
} | ||
}; | ||
compilerCallback(compilation); | ||
} | ||
}; | ||
} | ||
|
||
describe('base href webpack plugin', () => { | ||
const html = oneLineTrim` | ||
<html> | ||
<head></head> | ||
<body></body> | ||
</html> | ||
`; | ||
|
||
it('should do nothing when baseHref is null', () => { | ||
const plugin = new BaseHrefWebpackPlugin({ baseHref: null }); | ||
|
||
const compiler = mockCompiler(html, (x, htmlPluginData) => { | ||
expect(htmlPluginData.html).toEqual('<body><head></head></body>'); | ||
}); | ||
plugin.apply(compiler); | ||
}); | ||
|
||
it('should insert base tag when not exist', function () { | ||
const plugin = new BaseHrefWebpackPlugin({ baseHref: '/' }); | ||
const compiler = mockCompiler(html, (x, htmlPluginData) => { | ||
expect(htmlPluginData.html).toEqual(oneLineTrim` | ||
<html> | ||
<head><base href="/"></head> | ||
<body></body> | ||
</html> | ||
`); | ||
}); | ||
|
||
plugin.apply(compiler); | ||
}); | ||
|
||
it('should replace href attribute when base tag already exists', function () { | ||
const plugin = new BaseHrefWebpackPlugin({ baseHref: '/myUrl/' }); | ||
|
||
const compiler = mockCompiler(oneLineTrim` | ||
<head><base href="/" target="_blank"></head> | ||
<body></body> | ||
`, (x, htmlPluginData) => { | ||
expect(htmlPluginData.html).toEqual(oneLineTrim` | ||
<head><base href="/myUrl/" target="_blank"></head> | ||
<body></body> | ||
`); | ||
}); | ||
plugin.apply(compiler); | ||
}); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
export * from './base-href-webpack-plugin'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"compilerOptions": { | ||
"declaration": true, | ||
"experimentalDecorators": true, | ||
"mapRoot": "", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"noEmitOnError": true, | ||
"noImplicitAny": true, | ||
"outDir": "../../dist/base-href-webpack", | ||
"rootDir": ".", | ||
"sourceMap": true, | ||
"sourceRoot": "/", | ||
"target": "es5", | ||
"lib": ["es6"], | ||
"typeRoots": [ | ||
"../../node_modules/@types" | ||
], | ||
"types": [ | ||
"jasmine", | ||
"node" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters