chore(ShadowDomStrategy): fix MapWrapper usage, DemoUrlResolver

This commit is contained in:
Yegor Jbanov 2015-06-19 18:48:14 -07:00
parent 1c4d233fe7
commit f158fbd131
4 changed files with 14 additions and 12 deletions

View File

@ -13,7 +13,7 @@ import {
} from 'angular2/test_lib';
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 {
EmulatedUnscopedShadowDomStrategy,
@ -102,11 +102,11 @@ class FakeXHR extends XHR {
constructor() {
super();
this._responses = MapWrapper.create();
this._responses = <Map<string, string>>{};
}
get(url: string): Promise<string> {
var response = MapWrapper.get(this._responses, url);
var response = this._responses[url];
if (isBlank(response)) {
return PromiseWrapper.reject('xhr error', null);
}
@ -114,5 +114,5 @@ class FakeXHR extends XHR {
return PromiseWrapper.resolve(response);
}
reply(url: string, response: string) { MapWrapper.set(this._responses, url, response); }
reply(url: string, response: string) { this._responses[url] = response; }
}

View File

@ -23,7 +23,7 @@ import {XHR} from 'angular2/src/render/xhr';
import {isBlank} from 'angular2/src/facade/lang';
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';
@ -76,11 +76,11 @@ class FakeXHR extends XHR {
constructor() {
super();
this._responses = MapWrapper.create();
this._responses = <Map<string, string>>{};
}
get(url: string): Promise<string> {
var response = MapWrapper.get(this._responses, url);
var response = this._responses[url];
if (isBlank(response)) {
return PromiseWrapper.reject('xhr error', null);
}
@ -88,5 +88,5 @@ class FakeXHR extends XHR {
return PromiseWrapper.resolve(response);
}
reply(url: string, response: string) { MapWrapper.set(this._responses, url, response); }
reply(url: string, response: string) { this._responses[url] = response; }
}

View File

@ -43,9 +43,11 @@ export function main() {
.toFactory((styleInliner, styleUrlResolver) => new EmulatedScopedShadowDomStrategy(
styleInliner, styleUrlResolver, styleHost),
[StyleInliner, StyleUrlResolver]),
"unscoped": bind(ShadowDomStrategy).toFactory(
(styleInliner, styleUrlResolver) => new EmulatedUnscopedShadowDomStrategy(
styleInliner, styleUrlResolver, null), [StyleInliner, StyleUrlResolver])
"unscoped":
bind(ShadowDomStrategy)
.toFactory((styleInliner, styleUrlResolver) => new EmulatedUnscopedShadowDomStrategy(
styleInliner, styleUrlResolver, null),
[StyleInliner, StyleUrlResolver])
};
if (DOM.supportsNativeShadowDOM()) {
StringMapWrapper.set(

View File

@ -44,7 +44,7 @@ export class DemoUrlResolver extends UrlResolver {
}
if (url[0] == '/') {
throw new BaseException(`Could not resolve the url ${url} from ${baseUrl}`);
return url;
}
var m = RegExpWrapper.firstMatch(_schemeRe, url);