feat(core): provide support for relative assets for components

Assets defined for `templateUrl` and `styleUrls` can now be loaded
in relative to where the component file is placed so long as the
`moduleId` is set within the component annotation.

Closes #5634

Closes #5634
This commit is contained in:
Matias Niemelä
2015-12-05 02:21:38 -08:00
parent bf484b19b3
commit db096a5e22
23 changed files with 327 additions and 23 deletions
+54
View File
@@ -65,5 +65,59 @@ export function main() {
});
});
describe('stripLeft', () => {
it('should strip the first character of the string if it matches the provided input', () => {
var input = "~angular2 is amazing";
var expectedOutput = "angular2 is amazing";
expect(StringWrapper.stripLeft(input, "~")).toEqual(expectedOutput);
});
it('should keep stripping characters from the start until the first unmatched character',
() => {
var input = "#####hello";
var expectedOutput = "hello";
expect(StringWrapper.stripLeft(input, "#")).toEqual(expectedOutput);
});
it('should not alter the provided input if the first charater does not match the provided input',
() => {
var input = "+angular2 is amazing";
expect(StringWrapper.stripLeft(input, "*")).toEqual(input);
});
it('should not do any alterations when an empty string or null value is passed in', () => {
expect(StringWrapper.stripLeft("", "S")).toEqual("");
expect(StringWrapper.stripLeft(null, "S")).toEqual(null);
});
});
describe('stripRight', () => {
it('should strip the first character of the string if it matches the provided input', () => {
var input = "angular2 is amazing!";
var expectedOutput = "angular2 is amazing";
expect(StringWrapper.stripRight(input, "!")).toEqual(expectedOutput);
});
it('should not alter the provided input if the first charater does not match the provided input',
() => {
var input = "angular2 is amazing+";
expect(StringWrapper.stripRight(input, "*")).toEqual(input);
});
it('should keep stripping characters from the end until the first unmatched character',
() => {
var input = "hi&!&&&&&";
var expectedOutput = "hi&!";
expect(StringWrapper.stripRight(input, "&")).toEqual(expectedOutput);
});
it('should not do any alterations when an empty string or null value is passed in', () => {
expect(StringWrapper.stripRight("", "S")).toEqual("");
expect(StringWrapper.stripRight(null, "S")).toEqual(null);
});
});
});
}