parent
ed4826b08c
commit
27dbd2ded4
|
@ -55,10 +55,10 @@ export class TemplateNormalizer {
|
||||||
var allStyles = templateMeta.styles.concat(visitor.styles);
|
var allStyles = templateMeta.styles.concat(visitor.styles);
|
||||||
|
|
||||||
var allStyleAbsUrls =
|
var allStyleAbsUrls =
|
||||||
visitor.styleUrls.map(url => this._urlResolver.resolve(templateAbsUrl, url))
|
ListWrapper.filter(visitor.styleUrls, isStyleUrlResolvable)
|
||||||
.concat(templateMeta.styleUrls.map(
|
.map(url => this._urlResolver.resolve(templateAbsUrl, url))
|
||||||
url => this._urlResolver.resolve(directiveType.moduleUrl, url)));
|
.concat(ListWrapper.filter(templateMeta.styleUrls, isStyleUrlResolvable)
|
||||||
allStyleAbsUrls = ListWrapper.filter(allStyleAbsUrls, isStyleUrlResolvable);
|
.map(url => this._urlResolver.resolve(directiveType.moduleUrl, url)));
|
||||||
|
|
||||||
var allResolvedStyles = allStyles.map(style => {
|
var allResolvedStyles = allStyles.map(style => {
|
||||||
var styleWithImports = extractStyleUrls(this._urlResolver, templateAbsUrl, style);
|
var styleWithImports = extractStyleUrls(this._urlResolver, templateAbsUrl, style);
|
||||||
|
|
|
@ -27,11 +27,14 @@ import {TEST_PROVIDERS} from './test_bindings';
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('TemplateNormalizer', () => {
|
describe('TemplateNormalizer', () => {
|
||||||
var dirType: CompileTypeMetadata;
|
var dirType: CompileTypeMetadata;
|
||||||
|
var dirTypeWithHttpUrl: CompileTypeMetadata;
|
||||||
|
|
||||||
beforeEachBindings(() => TEST_PROVIDERS);
|
beforeEachBindings(() => TEST_PROVIDERS);
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
dirType = new CompileTypeMetadata({moduleUrl: 'package:some/module/a.js', name: 'SomeComp'});
|
dirType = new CompileTypeMetadata({moduleUrl: 'package:some/module/a.js', name: 'SomeComp'});
|
||||||
|
dirTypeWithHttpUrl =
|
||||||
|
new CompileTypeMetadata({moduleUrl: 'http://some/module/a.js', name: 'SomeComp'});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('loadTemplate', () => {
|
describe('loadTemplate', () => {
|
||||||
|
@ -284,6 +287,16 @@ export function main() {
|
||||||
expect(template.styleUrls).toEqual(['package:some/module/test.css']);
|
expect(template.styleUrls).toEqual(['package:some/module/test.css']);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should resolve relative style urls in styleUrls with http directive url',
|
||||||
|
inject([TemplateNormalizer], (normalizer: TemplateNormalizer) => {
|
||||||
|
var template = normalizer.normalizeLoadedTemplate(
|
||||||
|
dirTypeWithHttpUrl, new CompileTemplateMetadata(
|
||||||
|
{encapsulation: null, styles: [], styleUrls: ['test.css']}),
|
||||||
|
'', 'http://some/module/id');
|
||||||
|
expect(template.styles).toEqual([]);
|
||||||
|
expect(template.styleUrls).toEqual(['http://some/module/test.css']);
|
||||||
|
}));
|
||||||
|
|
||||||
it('should normalize ViewEncapsulation.Emulated to ViewEncapsulation.None if there are no stlyes nor stylesheets',
|
it('should normalize ViewEncapsulation.Emulated to ViewEncapsulation.None if there are no stlyes nor stylesheets',
|
||||||
inject([TemplateNormalizer], (normalizer: TemplateNormalizer) => {
|
inject([TemplateNormalizer], (normalizer: TemplateNormalizer) => {
|
||||||
var template = normalizer.normalizeLoadedTemplate(
|
var template = normalizer.normalizeLoadedTemplate(
|
||||||
|
|
Loading…
Reference in New Issue