chore(ShadowDomStrategy): fix MapWrapper usage, DemoUrlResolver
This commit is contained in:
parent
1c4d233fe7
commit
f158fbd131
|
@ -13,7 +13,7 @@ import {
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
import {Map, MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
import {Map, ListWrapper} from 'angular2/src/facade/collection';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
EmulatedUnscopedShadowDomStrategy,
|
EmulatedUnscopedShadowDomStrategy,
|
||||||
|
@ -102,11 +102,11 @@ class FakeXHR extends XHR {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this._responses = MapWrapper.create();
|
this._responses = <Map<string, string>>{};
|
||||||
}
|
}
|
||||||
|
|
||||||
get(url: string): Promise<string> {
|
get(url: string): Promise<string> {
|
||||||
var response = MapWrapper.get(this._responses, url);
|
var response = this._responses[url];
|
||||||
if (isBlank(response)) {
|
if (isBlank(response)) {
|
||||||
return PromiseWrapper.reject('xhr error', null);
|
return PromiseWrapper.reject('xhr error', null);
|
||||||
}
|
}
|
||||||
|
@ -114,5 +114,5 @@ class FakeXHR extends XHR {
|
||||||
return PromiseWrapper.resolve(response);
|
return PromiseWrapper.resolve(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
reply(url: string, response: string) { MapWrapper.set(this._responses, url, response); }
|
reply(url: string, response: string) { this._responses[url] = response; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import {XHR} from 'angular2/src/render/xhr';
|
||||||
|
|
||||||
import {isBlank} from 'angular2/src/facade/lang';
|
import {isBlank} from 'angular2/src/facade/lang';
|
||||||
import {PromiseWrapper, Promise} from 'angular2/src/facade/async';
|
import {PromiseWrapper, Promise} from 'angular2/src/facade/async';
|
||||||
import {Map, MapWrapper} from 'angular2/src/facade/collection';
|
import {Map} from 'angular2/src/facade/collection';
|
||||||
|
|
||||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
|
|
||||||
|
@ -76,11 +76,11 @@ class FakeXHR extends XHR {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this._responses = MapWrapper.create();
|
this._responses = <Map<string, string>>{};
|
||||||
}
|
}
|
||||||
|
|
||||||
get(url: string): Promise<string> {
|
get(url: string): Promise<string> {
|
||||||
var response = MapWrapper.get(this._responses, url);
|
var response = this._responses[url];
|
||||||
if (isBlank(response)) {
|
if (isBlank(response)) {
|
||||||
return PromiseWrapper.reject('xhr error', null);
|
return PromiseWrapper.reject('xhr error', null);
|
||||||
}
|
}
|
||||||
|
@ -88,5 +88,5 @@ class FakeXHR extends XHR {
|
||||||
return PromiseWrapper.resolve(response);
|
return PromiseWrapper.resolve(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
reply(url: string, response: string) { MapWrapper.set(this._responses, url, response); }
|
reply(url: string, response: string) { this._responses[url] = response; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,9 +43,11 @@ export function main() {
|
||||||
.toFactory((styleInliner, styleUrlResolver) => new EmulatedScopedShadowDomStrategy(
|
.toFactory((styleInliner, styleUrlResolver) => new EmulatedScopedShadowDomStrategy(
|
||||||
styleInliner, styleUrlResolver, styleHost),
|
styleInliner, styleUrlResolver, styleHost),
|
||||||
[StyleInliner, StyleUrlResolver]),
|
[StyleInliner, StyleUrlResolver]),
|
||||||
"unscoped": bind(ShadowDomStrategy).toFactory(
|
"unscoped":
|
||||||
(styleInliner, styleUrlResolver) => new EmulatedUnscopedShadowDomStrategy(
|
bind(ShadowDomStrategy)
|
||||||
styleInliner, styleUrlResolver, null), [StyleInliner, StyleUrlResolver])
|
.toFactory((styleInliner, styleUrlResolver) => new EmulatedUnscopedShadowDomStrategy(
|
||||||
|
styleInliner, styleUrlResolver, null),
|
||||||
|
[StyleInliner, StyleUrlResolver])
|
||||||
};
|
};
|
||||||
if (DOM.supportsNativeShadowDOM()) {
|
if (DOM.supportsNativeShadowDOM()) {
|
||||||
StringMapWrapper.set(
|
StringMapWrapper.set(
|
||||||
|
|
|
@ -44,7 +44,7 @@ export class DemoUrlResolver extends UrlResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (url[0] == '/') {
|
if (url[0] == '/') {
|
||||||
throw new BaseException(`Could not resolve the url ${url} from ${baseUrl}`);
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
var m = RegExpWrapper.firstMatch(_schemeRe, url);
|
var m = RegExpWrapper.firstMatch(_schemeRe, url);
|
||||||
|
|
Loading…
Reference in New Issue