angular2-rails 2.0.0.pre.beta.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +25 -0
- data/lib/angular2-rails.rb +9 -0
- data/lib/angular2-rails/engine.rb +6 -0
- data/lib/angular2-rails/sprockets.rb +3 -0
- data/lib/angular2-rails/version.rb +5 -0
- data/lib/tasks/angular2/rails_tasks.rake +4 -0
- data/vendor/assets/javascripts/Rx.js +11615 -0
- data/vendor/assets/javascripts/Rx.min.js +417 -0
- data/vendor/assets/javascripts/Rx.min.js.map +1 -0
- data/vendor/assets/javascripts/Rx.umd.js +10274 -0
- data/vendor/assets/javascripts/Rx.umd.min.js +748 -0
- data/vendor/assets/javascripts/Rx.umd.min.js.map +8 -0
- data/vendor/assets/javascripts/angular2-all-testing.umd.dev.js +41097 -0
- data/vendor/assets/javascripts/angular2-all.umd.dev.js +38827 -0
- data/vendor/assets/javascripts/angular2-all.umd.js +38826 -0
- data/vendor/assets/javascripts/angular2-all.umd.min.js +20 -0
- data/vendor/assets/javascripts/angular2-polyfills.js +2491 -0
- data/vendor/assets/javascripts/angular2-polyfills.min.js +1 -0
- data/vendor/assets/javascripts/angular2.dev.js +26056 -0
- data/vendor/assets/javascripts/angular2.js +26056 -0
- data/vendor/assets/javascripts/angular2.min.js +19 -0
- data/vendor/assets/javascripts/http.dev.js +1106 -0
- data/vendor/assets/javascripts/http.js +1106 -0
- data/vendor/assets/javascripts/http.min.js +1 -0
- data/vendor/assets/javascripts/overview.md +92 -0
- data/vendor/assets/javascripts/router.dev.js +3436 -0
- data/vendor/assets/javascripts/router.js +3436 -0
- data/vendor/assets/javascripts/router.min.js +3 -0
- data/vendor/assets/javascripts/testing.dev.js +2205 -0
- data/vendor/assets/javascripts/testing.dev.js.map +1 -0
- data/vendor/assets/javascripts/upgrade.dev.js +833 -0
- data/vendor/assets/javascripts/upgrade.js +833 -0
- data/vendor/assets/javascripts/upgrade.min.js +1 -0
- data/vendor/assets/javascripts/web_worker/ui.dev.js +24221 -0
- data/vendor/assets/javascripts/web_worker/worker.dev.js +40089 -0
- metadata +101 -0
@@ -0,0 +1,3 @@
|
|
1
|
+
"format register";System.register("angular2/src/router/directives/router_link_transform",["angular2/compiler","angular2/src/core/change_detection/parser/ast","angular2/src/facade/exceptions","angular2/core","angular2/src/core/change_detection/parser/parser"],!0,function(t,e,r){function n(t,e){var r=new _(t,e.trim()).tokenize();return new v(r).generate()}var a=System.global,o=a.define;a.define=void 0;var i=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},s=this&&this.__decorate||function(t,e,r,n){var a,o=arguments.length,i=3>o?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(3>o?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i},u=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},c=t("angular2/compiler"),l=t("angular2/src/core/change_detection/parser/ast"),p=t("angular2/src/facade/exceptions"),f=t("angular2/core"),h=t("angular2/src/core/change_detection/parser/parser"),g=function(){function t(t){this.value=t}return t}(),m=function(){function t(){}return t}(),d=function(){function t(){}return t}(),y=function(){function t(t){this.ast=t}return t}(),_=function(){function t(t,e){this.parser=t,this.exp=e,this.index=0}return t.prototype.tokenize=function(){for(var t=[];this.index<this.exp.length;)t.push(this._parseToken());return t},t.prototype._parseToken=function(){var t=this.exp[this.index];return"["==t?(this.index++,new m):"]"==t?(this.index++,new d):"("==t?this._parseParams():"/"==t&&0!==this.index?(this.index++,this._parseFixedPart()):this._parseFixedPart()},t.prototype._parseParams=function(){for(var t=this.index;this.index<this.exp.length;++this.index){var e=this.exp[this.index];if(")"==e){var r=this.exp.substring(t+1,this.index);return this.index++,new y(this.parser.parseBinding("{"+r+"}",null).ast)}}throw new p.BaseException("Cannot find ')'")},t.prototype._parseFixedPart=function(){for(var t=this.index,e=!1;this.index<this.exp.length;++this.index){var r=this.exp[this.index];if("("==r||"["==r||"]"==r||"/"==r&&e)break;"."!=r&&"/"!=r&&(e=!0)}var n=this.exp.substring(t,this.index);if(t===this.index||!e||n.startsWith("//"))throw new p.BaseException("Invalid router link");return new g(n)},t}(),v=function(){function t(t){this.tokens=t,this.index=0}return t.prototype.generate=function(){return this._genAuxiliary()},t.prototype._genAuxiliary=function(){for(var t=[];this.index<this.tokens.length;this.index++){var e=this.tokens[this.index];if(e instanceof g)t.push(new l.LiteralPrimitive(e.value));else if(e instanceof y)t.push(e.ast);else{if(e instanceof d)break;e instanceof m&&(this.index++,t.push(this._genAuxiliary()))}}return new l.LiteralArray(t)},t}(),R=function(t){function e(e){t.call(this),this.parser=e}return i(e,t),e.prototype.visitQuote=function(e){return"route"==e.prefix?n(this.parser,e.uninterpretedExpression):t.prototype.visitQuote.call(this,e)},e}(l.AstTransformer);e.parseRouterLinkExpression=n;var P=function(){function t(t){this.astTransformer=new R(t)}return t.prototype.visitNgContent=function(t,e){return t},t.prototype.visitEmbeddedTemplate=function(t,e){return t},t.prototype.visitElement=function(t,e){var r=this,n=t.children.map(function(t){return t.visit(r,e)}),a=t.inputs.map(function(t){return t.visit(r,e)}),o=t.directives.map(function(t){return t.visit(r,e)});return new c.ElementAst(t.name,t.attrs,a,t.outputs,t.exportAsVars,o,n,t.ngContentIndex,t.sourceSpan)},t.prototype.visitVariable=function(t,e){return t},t.prototype.visitEvent=function(t,e){return t},t.prototype.visitElementProperty=function(t,e){return t},t.prototype.visitAttr=function(t,e){return t},t.prototype.visitBoundText=function(t,e){return t},t.prototype.visitText=function(t,e){return t},t.prototype.visitDirective=function(t,e){var r=this,n=t.inputs.map(function(t){return t.visit(r,e)});return new c.DirectiveAst(t.directive,n,t.hostProperties,t.hostEvents,t.exportAsVars,t.sourceSpan)},t.prototype.visitDirectiveProperty=function(t,e){var r=t.value.visit(this.astTransformer);return new c.BoundDirectivePropertyAst(t.directiveName,t.templateName,r,t.sourceSpan)},t=s([f.Injectable(),u("design:paramtypes",[h.Parser])],t)}();return e.RouterLinkTransform=P,a.define=o,r.exports}),System.register("angular2/router/router_link_dsl",["angular2/compiler","angular2/core","angular2/src/router/directives/router_link_transform","angular2/src/facade/lang","angular2/src/router/directives/router_link_transform"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=t("angular2/compiler"),i=t("angular2/core"),s=t("angular2/src/router/directives/router_link_transform"),u=t("angular2/src/facade/lang"),c=t("angular2/src/router/directives/router_link_transform");return e.RouterLinkTransform=c.RouterLinkTransform,e.ROUTER_LINK_DSL_PROVIDER=u.CONST_EXPR(new i.Provider(o.TEMPLATE_TRANSFORMS,{useClass:s.RouterLinkTransform,multi:!0})),n.define=a,r.exports}),System.register("angular2/src/router/route_config/route_config_impl",["angular2/src/facade/lang"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=this&&this.__decorate||function(t,e,r,n){var a,o=arguments.length,i=3>o?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(3>o?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i},s=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},u=t("angular2/src/facade/lang"),c=function(){function t(t){this.configs=t}return t=i([u.CONST(),s("design:paramtypes",[Array])],t)}();e.RouteConfig=c;var l=function(){function t(t){var e=t.name,r=t.useAsDefault,n=t.path,a=t.regex,o=t.serializer,i=t.data;this.name=e,this.useAsDefault=r,this.path=n,this.regex=a,this.serializer=o,this.data=i}return t=i([u.CONST(),s("design:paramtypes",[Object])],t)}();e.AbstractRoute=l;var p=function(t){function e(e){var r=e.name,n=e.useAsDefault,a=e.path,o=e.regex,i=e.serializer,s=e.data,u=e.component;t.call(this,{name:r,useAsDefault:n,path:a,regex:o,serializer:i,data:s}),this.aux=null,this.component=u}return o(e,t),e=i([u.CONST(),s("design:paramtypes",[Object])],e)}(l);e.Route=p;var f=function(t){function e(e){var r=e.name,n=e.useAsDefault,a=e.path,o=e.regex,i=e.serializer,s=e.data,u=e.component;t.call(this,{name:r,useAsDefault:n,path:a,regex:o,serializer:i,data:s}),this.component=u}return o(e,t),e=i([u.CONST(),s("design:paramtypes",[Object])],e)}(l);e.AuxRoute=f;var h=function(t){function e(e){var r=e.name,n=e.useAsDefault,a=e.path,o=e.regex,i=e.serializer,s=e.data,u=e.loader;t.call(this,{name:r,useAsDefault:n,path:a,regex:o,serializer:i,data:s}),this.aux=null,this.loader=u}return o(e,t),e=i([u.CONST(),s("design:paramtypes",[Object])],e)}(l);e.AsyncRoute=h;var g=function(t){function e(e){var r=e.name,n=e.useAsDefault,a=e.path,o=e.regex,i=e.serializer,s=e.data,u=e.redirectTo;t.call(this,{name:r,useAsDefault:n,path:a,regex:o,serializer:i,data:s}),this.redirectTo=u}return o(e,t),e=i([u.CONST(),s("design:paramtypes",[Object])],e)}(l);return e.Redirect=g,n.define=a,r.exports}),System.register("angular2/src/router/url_parser",["angular2/src/facade/collection","angular2/src/facade/lang","angular2/src/facade/exceptions"],!0,function(t,e,r){function n(t){var e=[];return f.isBlank(t)?[]:(p.StringMapWrapper.forEach(t,function(t,r){e.push(t===!0?r:r+"="+t)}),e)}function a(t,e){return void 0===e&&(e="&"),n(t).join(e)}function o(t){for(var e=new g(t[t.length-1]),r=t.length-2;r>=0;r-=1)e=new g(t[r],e);return e}function i(t){var e=f.RegExpWrapper.firstMatch(d,t);return f.isPresent(e)?e[0]:""}function s(t){var e=f.RegExpWrapper.firstMatch(y,t);return f.isPresent(e)?e[0]:""}var u=System.global,c=u.define;u.define=void 0;var l=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},p=t("angular2/src/facade/collection"),f=t("angular2/src/facade/lang"),h=t("angular2/src/facade/exceptions");e.convertUrlParamsToArray=n,e.serializeParams=a;var g=function(){function t(t,e,r,n){void 0===e&&(e=null),void 0===r&&(r=f.CONST_EXPR([])),void 0===n&&(n=f.CONST_EXPR({})),this.path=t,this.child=e,this.auxiliary=r,this.params=n}return t.prototype.toString=function(){return this.path+this._matrixParamsToString()+this._auxToString()+this._childString()},t.prototype.segmentToString=function(){return this.path+this._matrixParamsToString()},t.prototype._auxToString=function(){return this.auxiliary.length>0?"("+this.auxiliary.map(function(t){return t.toString()}).join("//")+")":""},t.prototype._matrixParamsToString=function(){var t=a(this.params,";");return t.length>0?";"+t:""},t.prototype._childString=function(){return f.isPresent(this.child)?"/"+this.child.toString():""},t}();e.Url=g;var m=function(t){function e(e,r,n,a){void 0===r&&(r=null),void 0===n&&(n=f.CONST_EXPR([])),void 0===a&&(a=null),t.call(this,e,r,n,a)}return l(e,t),e.prototype.toString=function(){return this.path+this._auxToString()+this._childString()+this._queryParamsToString()},e.prototype.segmentToString=function(){return this.path+this._queryParamsToString()},e.prototype._queryParamsToString=function(){return f.isBlank(this.params)?"":"?"+a(this.params)},e}(g);e.RootUrl=m,e.pathSegmentsToUrl=o;var d=f.RegExpWrapper.create("^[^\\/\\(\\)\\?;=&#]+"),y=f.RegExpWrapper.create("^[^\\(\\)\\?;&#]+"),_=function(){function t(){}return t.prototype.peekStartsWith=function(t){return this._remaining.startsWith(t)},t.prototype.capture=function(t){if(!this._remaining.startsWith(t))throw new h.BaseException('Expected "'+t+'".');this._remaining=this._remaining.substring(t.length)},t.prototype.parse=function(t){return this._remaining=t,""==t||"/"==t?new g(""):this.parseRoot()},t.prototype.parseRoot=function(){this.peekStartsWith("/")&&this.capture("/");var t=i(this._remaining);this.capture(t);var e=[];this.peekStartsWith("(")&&(e=this.parseAuxiliaryRoutes()),this.peekStartsWith(";")&&this.parseMatrixParams();var r=null;this.peekStartsWith("/")&&!this.peekStartsWith("//")&&(this.capture("/"),r=this.parseSegment());var n=null;return this.peekStartsWith("?")&&(n=this.parseQueryParams()),new m(t,r,e,n)},t.prototype.parseSegment=function(){if(0==this._remaining.length)return null;this.peekStartsWith("/")&&this.capture("/");var t=i(this._remaining);this.capture(t);var e=null;this.peekStartsWith(";")&&(e=this.parseMatrixParams());var r=[];this.peekStartsWith("(")&&(r=this.parseAuxiliaryRoutes());var n=null;return this.peekStartsWith("/")&&!this.peekStartsWith("//")&&(this.capture("/"),n=this.parseSegment()),new g(t,n,r,e)},t.prototype.parseQueryParams=function(){var t={};for(this.capture("?"),this.parseQueryParam(t);this._remaining.length>0&&this.peekStartsWith("&");)this.capture("&"),this.parseQueryParam(t);return t},t.prototype.parseMatrixParams=function(){for(var t={};this._remaining.length>0&&this.peekStartsWith(";");)this.capture(";"),this.parseParam(t);return t},t.prototype.parseParam=function(t){var e=i(this._remaining);if(!f.isBlank(e)){this.capture(e);var r=!0;if(this.peekStartsWith("=")){this.capture("=");var n=i(this._remaining);f.isPresent(n)&&(r=n,this.capture(r))}t[e]=r}},t.prototype.parseQueryParam=function(t){var e=i(this._remaining);if(!f.isBlank(e)){this.capture(e);var r=!0;if(this.peekStartsWith("=")){this.capture("=");var n=s(this._remaining);f.isPresent(n)&&(r=n,this.capture(r))}t[e]=r}},t.prototype.parseAuxiliaryRoutes=function(){var t=[];for(this.capture("(");!this.peekStartsWith(")")&&this._remaining.length>0;)t.push(this.parseSegment()),this.peekStartsWith("//")&&this.capture("//");return this.capture(")"),t},t}();return e.UrlParser=_,e.parser=new _,u.define=c,r.exports}),System.register("angular2/src/router/instruction",["angular2/src/facade/collection","angular2/src/facade/lang","angular2/src/facade/async"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("angular2/src/facade/collection"),s=t("angular2/src/facade/lang"),u=t("angular2/src/facade/async"),c=function(){function t(t){this.params=t}return t.prototype.get=function(t){return s.normalizeBlank(i.StringMapWrapper.get(this.params,t))},t}();e.RouteParams=c;var l=function(){function t(t){void 0===t&&(t=s.CONST_EXPR({})),this.data=t}return t.prototype.get=function(t){return s.normalizeBlank(i.StringMapWrapper.get(this.data,t))},t}();e.RouteData=l,e.BLANK_ROUTE_DATA=new l;var p=function(){function t(t,e,r){this.component=t,this.child=e,this.auxInstruction=r}return Object.defineProperty(t.prototype,"urlPath",{get:function(){return s.isPresent(this.component)?this.component.urlPath:""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"urlParams",{get:function(){return s.isPresent(this.component)?this.component.urlParams:[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"specificity",{get:function(){var t="";return s.isPresent(this.component)&&(t+=this.component.specificity),s.isPresent(this.child)&&(t+=this.child.specificity),t},enumerable:!0,configurable:!0}),t.prototype.toRootUrl=function(){return this.toUrlPath()+this.toUrlQuery()},t.prototype._toNonRootUrl=function(){return this._stringifyPathMatrixAuxPrefixed()+(s.isPresent(this.child)?this.child._toNonRootUrl():"")},t.prototype.toUrlQuery=function(){return this.urlParams.length>0?"?"+this.urlParams.join("&"):""},t.prototype.replaceChild=function(t){return new f(this.component,t,this.auxInstruction)},t.prototype.toUrlPath=function(){return this.urlPath+this._stringifyAux()+(s.isPresent(this.child)?this.child._toNonRootUrl():"")},t.prototype.toLinkUrl=function(){return this.urlPath+this._stringifyAux()+(s.isPresent(this.child)?this.child._toLinkUrl():"")+this.toUrlQuery()},t.prototype._toLinkUrl=function(){return this._stringifyPathMatrixAuxPrefixed()+(s.isPresent(this.child)?this.child._toLinkUrl():"")},t.prototype._stringifyPathMatrixAuxPrefixed=function(){var t=this._stringifyPathMatrixAux();return t.length>0&&(t="/"+t),t},t.prototype._stringifyMatrixParams=function(){return this.urlParams.length>0?";"+this.urlParams.join(";"):""},t.prototype._stringifyPathMatrixAux=function(){return s.isBlank(this.component)?"":this.urlPath+this._stringifyMatrixParams()+this._stringifyAux()},t.prototype._stringifyAux=function(){var t=[];return i.StringMapWrapper.forEach(this.auxInstruction,function(e,r){t.push(e._stringifyPathMatrixAux())}),t.length>0?"("+t.join("//")+")":""},t}();e.Instruction=p;var f=function(t){function e(e,r,n){t.call(this,e,r,n)}return o(e,t),e.prototype.resolveComponent=function(){return u.PromiseWrapper.resolve(this.component)},e}(p);e.ResolvedInstruction=f;var h=function(t){function e(e,r){t.call(this,e,r,{})}return o(e,t),e.prototype.toLinkUrl=function(){return""},e.prototype._toLinkUrl=function(){return""},e}(f);e.DefaultInstruction=h;var g=function(t){function e(e,r,n){void 0===r&&(r=""),void 0===n&&(n=s.CONST_EXPR([])),t.call(this,null,null,{}),this._resolver=e,this._urlPath=r,this._urlParams=n}return o(e,t),Object.defineProperty(e.prototype,"urlPath",{get:function(){return s.isPresent(this.component)?this.component.urlPath:s.isPresent(this._urlPath)?this._urlPath:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"urlParams",{get:function(){return s.isPresent(this.component)?this.component.urlParams:s.isPresent(this._urlParams)?this._urlParams:[]},enumerable:!0,configurable:!0}),e.prototype.resolveComponent=function(){var t=this;return s.isPresent(this.component)?u.PromiseWrapper.resolve(this.component):this._resolver().then(function(e){return t.child=s.isPresent(e)?e.child:null,t.component=s.isPresent(e)?e.component:null})},e}(p);e.UnresolvedInstruction=g;var m=function(t){function e(e,r,n,a){t.call(this,e,r,n),this._specificity=a}return o(e,t),Object.defineProperty(e.prototype,"specificity",{get:function(){return this._specificity},enumerable:!0,configurable:!0}),e}(f);e.RedirectInstruction=m;var d=function(){function t(t,r,n,a,o,i,u,c){void 0===u&&(u=null),this.urlPath=t,this.urlParams=r,this.componentType=a,this.terminal=o,this.specificity=i,this.params=u,this.routeName=c,this.reuse=!1,this.routeData=s.isPresent(n)?n:e.BLANK_ROUTE_DATA}return t}();return e.ComponentInstruction=d,n.define=a,r.exports}),System.register("angular2/src/router/rules/route_handlers/async_route_handler",["angular2/src/facade/lang","angular2/src/router/instruction"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=t("angular2/src/facade/lang"),i=t("angular2/src/router/instruction"),s=function(){function t(t,e){void 0===e&&(e=null),this._loader=t,this._resolvedComponent=null,this.data=o.isPresent(e)?new i.RouteData(e):i.BLANK_ROUTE_DATA}return t.prototype.resolveComponentType=function(){var t=this;return o.isPresent(this._resolvedComponent)?this._resolvedComponent:this._resolvedComponent=this._loader().then(function(e){return t.componentType=e,e})},t}();return e.AsyncRouteHandler=s,n.define=a,r.exports}),System.register("angular2/src/router/rules/route_handlers/sync_route_handler",["angular2/src/facade/async","angular2/src/facade/lang","angular2/src/router/instruction"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=t("angular2/src/facade/async"),i=t("angular2/src/facade/lang"),s=t("angular2/src/router/instruction"),u=function(){function t(t,e){this.componentType=t,this._resolvedComponent=null,this._resolvedComponent=o.PromiseWrapper.resolve(t),this.data=i.isPresent(e)?new s.RouteData(e):s.BLANK_ROUTE_DATA}return t.prototype.resolveComponentType=function(){return this._resolvedComponent},t}();return e.SyncRouteHandler=u,n.define=a,r.exports}),System.register("angular2/src/router/utils",["angular2/src/facade/lang","angular2/src/facade/collection"],!0,function(t,e,r){function n(t){return i.isBlank(t)?null:t.toString()}var a=System.global,o=a.define;a.define=void 0;var i=t("angular2/src/facade/lang"),s=t("angular2/src/facade/collection"),u=function(){function t(t){var e=this;this.map={},this.keys={},i.isPresent(t)&&s.StringMapWrapper.forEach(t,function(t,r){e.map[r]=i.isPresent(t)?t.toString():null,e.keys[r]=!0})}return t.prototype.get=function(t){return s.StringMapWrapper["delete"](this.keys,t),this.map[t]},t.prototype.getUnused=function(){var t=this,e={},r=s.StringMapWrapper.keys(this.keys);return r.forEach(function(r){return e[r]=s.StringMapWrapper.get(t.map,r)}),e},t}();return e.TouchMap=u,e.normalizeString=n,a.define=o,r.exports}),System.register("angular2/src/router/rules/route_paths/route_path",[],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=function(){function t(t,e,r,n,a){this.urlPath=t,this.urlParams=e,this.allParams=r,this.auxiliary=n,this.rest=a}return t}();e.MatchedUrl=o;var i=function(){function t(t,e){this.urlPath=t,this.urlParams=e}return t}();return e.GeneratedUrl=i,n.define=a,r.exports}),System.register("angular2/src/router/rules/route_paths/regex_route_path",["angular2/src/facade/lang","angular2/src/router/rules/route_paths/route_path"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=t("angular2/src/facade/lang"),i=t("angular2/src/router/rules/route_paths/route_path"),s=function(){function t(t,e){this._reString=t,this._serializer=e,this.terminal=!0,this.specificity="2",this.hash=this._reString,this._regex=o.RegExpWrapper.create(this._reString)}return t.prototype.matchUrl=function(t){var e=t.toString(),r={},n=o.RegExpWrapper.matcher(this._regex,e),a=o.RegExpMatcherWrapper.next(n);if(o.isBlank(a))return null;for(var s=0;s<a.length;s+=1)r[s.toString()]=a[s];return new i.MatchedUrl(e,[],r,[],null)},t.prototype.generateUrl=function(t){return this._serializer(t)},t.prototype.toString=function(){return this._reString},t}();return e.RegexRoutePath=s,n.define=a,r.exports}),System.register("angular2/src/router/route_config/route_config_decorator",["angular2/src/router/route_config/route_config_impl","angular2/src/core/util/decorators","angular2/src/router/route_config/route_config_impl"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=t("angular2/src/router/route_config/route_config_impl"),i=t("angular2/src/core/util/decorators"),s=t("angular2/src/router/route_config/route_config_impl");return e.Route=s.Route,e.Redirect=s.Redirect,e.AuxRoute=s.AuxRoute,e.AsyncRoute=s.AsyncRoute,e.RouteConfig=i.makeDecorator(o.RouteConfig),n.define=a,r.exports}),System.register("angular2/src/router/location/location_strategy",["angular2/src/facade/lang","angular2/core"],!0,function(t,e,r){function n(t){return t.length>0&&"?"!=t.substring(0,1)?"?"+t:t}function a(t,e){if(0==t.length)return e;if(0==e.length)return t;var r=0;return t.endsWith("/")&&r++,e.startsWith("/")&&r++,2==r?t+e.substring(1):1==r?t+e:t+"/"+e}var o=System.global,i=o.define;o.define=void 0;var s=t("angular2/src/facade/lang"),u=t("angular2/core"),c=function(){function t(){}return t}();return e.LocationStrategy=c,e.APP_BASE_HREF=s.CONST_EXPR(new u.OpaqueToken("appBaseHref")),e.normalizeQueryParams=n,e.joinWithSlash=a,o.define=i,r.exports}),System.register("angular2/src/router/lifecycle/lifecycle_annotations_impl",["angular2/src/facade/lang"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=this&&this.__decorate||function(t,e,r,n){var a,o=arguments.length,i=3>o?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(3>o?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i},i=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},s=t("angular2/src/facade/lang"),u=function(){function t(t){this.name=t}return t=o([s.CONST(),i("design:paramtypes",[String])],t)}();e.RouteLifecycleHook=u;var c=function(){function t(t){this.fn=t}return t=o([s.CONST(),i("design:paramtypes",[Function])],t)}();return e.CanActivate=c,e.routerCanReuse=s.CONST_EXPR(new u("routerCanReuse")),e.routerCanDeactivate=s.CONST_EXPR(new u("routerCanDeactivate")),e.routerOnActivate=s.CONST_EXPR(new u("routerOnActivate")),e.routerOnReuse=s.CONST_EXPR(new u("routerOnReuse")),e.routerOnDeactivate=s.CONST_EXPR(new u("routerOnDeactivate")),n.define=a,r.exports}),System.register("angular2/src/router/lifecycle/lifecycle_annotations",["angular2/src/core/util/decorators","angular2/src/router/lifecycle/lifecycle_annotations_impl","angular2/src/router/lifecycle/lifecycle_annotations_impl"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=t("angular2/src/core/util/decorators"),i=t("angular2/src/router/lifecycle/lifecycle_annotations_impl"),s=t("angular2/src/router/lifecycle/lifecycle_annotations_impl");return e.routerCanReuse=s.routerCanReuse,e.routerCanDeactivate=s.routerCanDeactivate,e.routerOnActivate=s.routerOnActivate,e.routerOnReuse=s.routerOnReuse,e.routerOnDeactivate=s.routerOnDeactivate,e.CanActivate=o.makeDecorator(i.CanActivate),n.define=a,r.exports}),System.register("angular2/src/router/directives/router_link",["angular2/core","angular2/src/facade/lang","angular2/src/router/router","angular2/src/router/location/location"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=this&&this.__decorate||function(t,e,r,n){var a,o=arguments.length,i=3>o?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(3>o?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i},i=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},s=t("angular2/core"),u=t("angular2/src/facade/lang"),c=t("angular2/src/router/router"),l=t("angular2/src/router/location/location"),p=function(){function t(t,e){var r=this;this._router=t,this._location=e,this._router.subscribe(function(t){return r._updateLink()})}return t.prototype._updateLink=function(){this._navigationInstruction=this._router.generate(this._routeParams);var t=this._navigationInstruction.toLinkUrl();this.visibleHref=this._location.prepareExternalUrl(t)},Object.defineProperty(t.prototype,"isRouteActive",{get:function(){return this._router.isRouteActive(this._navigationInstruction)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"routeParams",{set:function(t){this._routeParams=t,this._updateLink()},enumerable:!0,configurable:!0}),t.prototype.onClick=function(){return u.isString(this.target)&&"_self"!=this.target?!0:(this._router.navigateByInstruction(this._navigationInstruction),!1)},t=o([s.Directive({selector:"[routerLink]",inputs:["routeParams: routerLink","target: target"],host:{"(click)":"onClick()","[attr.href]":"visibleHref","[class.router-link-active]":"isRouteActive"}}),i("design:paramtypes",[c.Router,l.Location])],t)}();return e.RouterLink=p,n.define=a,r.exports}),System.register("angular2/src/router/location/platform_location",[],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=function(){function t(){}return Object.defineProperty(t.prototype,"pathname",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"search",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hash",{get:function(){return null},enumerable:!0,configurable:!0}),t}();return e.PlatformLocation=o,n.define=a,r.exports}),System.register("angular2/src/router/location/hash_location_strategy",["angular2/core","angular2/src/router/location/location_strategy","angular2/src/facade/lang","angular2/src/router/location/platform_location"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=this&&this.__decorate||function(t,e,r,n){var a,o=arguments.length,i=3>o?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(3>o?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i},s=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},u=this&&this.__param||function(t,e){return function(r,n){e(r,n,t)}},c=t("angular2/core"),l=t("angular2/src/router/location/location_strategy"),p=t("angular2/src/facade/lang"),f=t("angular2/src/router/location/platform_location"),h=function(t){function e(e,r){t.call(this),this._platformLocation=e,this._baseHref="",p.isPresent(r)&&(this._baseHref=r)}return o(e,t),e.prototype.onPopState=function(t){this._platformLocation.onPopState(t),this._platformLocation.onHashChange(t)},e.prototype.getBaseHref=function(){return this._baseHref},e.prototype.path=function(){var t=this._platformLocation.hash;return p.isPresent(t)||(t="#"),t.length>0?t.substring(1):t},e.prototype.prepareExternalUrl=function(t){var e=l.joinWithSlash(this._baseHref,t);return e.length>0?"#"+e:e},e.prototype.pushState=function(t,e,r,n){var a=this.prepareExternalUrl(r+l.normalizeQueryParams(n));0==a.length&&(a=this._platformLocation.pathname),this._platformLocation.pushState(t,e,a)},e.prototype.replaceState=function(t,e,r,n){var a=this.prepareExternalUrl(r+l.normalizeQueryParams(n));0==a.length&&(a=this._platformLocation.pathname),this._platformLocation.replaceState(t,e,a)},e.prototype.forward=function(){this._platformLocation.forward()},e.prototype.back=function(){this._platformLocation.back()},e=i([c.Injectable(),u(1,c.Optional()),u(1,c.Inject(l.APP_BASE_HREF)),s("design:paramtypes",[f.PlatformLocation,String])],e)}(l.LocationStrategy);return e.HashLocationStrategy=h,n.define=a,r.exports}),System.register("angular2/src/router/location/path_location_strategy",["angular2/core","angular2/src/facade/lang","angular2/src/facade/exceptions","angular2/src/router/location/location_strategy","angular2/src/router/location/platform_location"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=this&&this.__decorate||function(t,e,r,n){var a,o=arguments.length,i=3>o?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(3>o?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i},s=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},u=this&&this.__param||function(t,e){return function(r,n){e(r,n,t)}},c=t("angular2/core"),l=t("angular2/src/facade/lang"),p=t("angular2/src/facade/exceptions"),f=t("angular2/src/router/location/location_strategy"),h=t("angular2/src/router/location/platform_location"),g=function(t){function e(e,r){if(t.call(this),this._platformLocation=e,l.isBlank(r)&&(r=this._platformLocation.getBaseHrefFromDOM()),l.isBlank(r))throw new p.BaseException("No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.");this._baseHref=r}return o(e,t),e.prototype.onPopState=function(t){this._platformLocation.onPopState(t),this._platformLocation.onHashChange(t)},e.prototype.getBaseHref=function(){return this._baseHref},e.prototype.prepareExternalUrl=function(t){return f.joinWithSlash(this._baseHref,t)},e.prototype.path=function(){return this._platformLocation.pathname+f.normalizeQueryParams(this._platformLocation.search)},e.prototype.pushState=function(t,e,r,n){var a=this.prepareExternalUrl(r+f.normalizeQueryParams(n));this._platformLocation.pushState(t,e,a)},e.prototype.replaceState=function(t,e,r,n){var a=this.prepareExternalUrl(r+f.normalizeQueryParams(n));this._platformLocation.replaceState(t,e,a)},e.prototype.forward=function(){this._platformLocation.forward()},e.prototype.back=function(){this._platformLocation.back()},e=i([c.Injectable(),u(1,c.Optional()),u(1,c.Inject(f.APP_BASE_HREF)),s("design:paramtypes",[h.PlatformLocation,String])],e)}(f.LocationStrategy);return e.PathLocationStrategy=g,n.define=a,r.exports}),System.register("angular2/src/router/router_providers_common",["angular2/src/router/location/location_strategy","angular2/src/router/location/path_location_strategy","angular2/src/router/router","angular2/src/router/route_registry","angular2/src/router/location/location","angular2/src/facade/lang","angular2/core","angular2/src/facade/exceptions"],!0,function(t,e,r){function n(t,e,r,n){var a=new c.RootRouter(t,e,r);return n.registerDisposeListener(function(){return a.dispose()}),a}function a(t){if(0==t.componentTypes.length)throw new g.BaseException("Bootstrap at least one component before injecting Router.");return t.componentTypes[0]}var o=System.global,i=o.define;o.define=void 0;var s=t("angular2/src/router/location/location_strategy"),u=t("angular2/src/router/location/path_location_strategy"),c=t("angular2/src/router/router"),l=t("angular2/src/router/route_registry"),p=t("angular2/src/router/location/location"),f=t("angular2/src/facade/lang"),h=t("angular2/core"),g=t("angular2/src/facade/exceptions");
|
2
|
+
return e.ROUTER_PROVIDERS_COMMON=f.CONST_EXPR([l.RouteRegistry,f.CONST_EXPR(new h.Provider(s.LocationStrategy,{useClass:u.PathLocationStrategy})),p.Location,f.CONST_EXPR(new h.Provider(c.Router,{useFactory:n,deps:f.CONST_EXPR([l.RouteRegistry,p.Location,l.ROUTER_PRIMARY_COMPONENT,h.ApplicationRef])})),f.CONST_EXPR(new h.Provider(l.ROUTER_PRIMARY_COMPONENT,{useFactory:a,deps:f.CONST_EXPR([h.ApplicationRef])}))]),o.define=i,r.exports}),System.register("angular2/src/router/rules/rules",["angular2/src/facade/lang","angular2/src/facade/exceptions","angular2/src/facade/promise","angular2/src/facade/collection","angular2/src/router/url_parser","angular2/src/router/instruction"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("angular2/src/facade/lang"),s=t("angular2/src/facade/exceptions"),u=t("angular2/src/facade/promise"),c=t("angular2/src/facade/collection"),l=t("angular2/src/router/url_parser"),p=t("angular2/src/router/instruction"),f=function(){function t(){}return t}();e.RouteMatch=f;var h=function(t){function e(e,r,n){t.call(this),this.instruction=e,this.remaining=r,this.remainingAux=n}return o(e,t),e}(f);e.PathMatch=h;var g=function(t){function e(e,r){t.call(this),this.redirectTo=e,this.specificity=r}return o(e,t),e}(f);e.RedirectMatch=g;var m=function(){function t(t,e){this._pathRecognizer=t,this.redirectTo=e,this.hash=this._pathRecognizer.hash}return Object.defineProperty(t.prototype,"path",{get:function(){return this._pathRecognizer.toString()},set:function(t){throw new s.BaseException("you cannot set the path of a RedirectRule directly")},enumerable:!0,configurable:!0}),t.prototype.recognize=function(t){var e=null;return i.isPresent(this._pathRecognizer.matchUrl(t))&&(e=new g(this.redirectTo,this._pathRecognizer.specificity)),u.PromiseWrapper.resolve(e)},t.prototype.generate=function(t){throw new s.BaseException("Tried to generate a redirect.")},t}();e.RedirectRule=m;var d=function(){function t(t,e,r){this._routePath=t,this.handler=e,this._routeName=r,this._cache=new c.Map,this.specificity=this._routePath.specificity,this.hash=this._routePath.hash,this.terminal=this._routePath.terminal}return Object.defineProperty(t.prototype,"path",{get:function(){return this._routePath.toString()},set:function(t){throw new s.BaseException("you cannot set the path of a RouteRule directly")},enumerable:!0,configurable:!0}),t.prototype.recognize=function(t){var e=this,r=this._routePath.matchUrl(t);return i.isBlank(r)?null:this.handler.resolveComponentType().then(function(t){var n=e._getInstruction(r.urlPath,r.urlParams,r.allParams);return new h(n,r.rest,r.auxiliary)})},t.prototype.generate=function(t){var e=this._routePath.generateUrl(t),r=e.urlPath,n=e.urlParams;return this._getInstruction(r,l.convertUrlParamsToArray(n),t)},t.prototype.generateComponentPathValues=function(t){return this._routePath.generateUrl(t)},t.prototype._getInstruction=function(t,e,r){if(i.isBlank(this.handler.componentType))throw new s.BaseException("Tried to get instruction before the type was loaded.");var n=t+"?"+e.join("&");if(this._cache.has(n))return this._cache.get(n);var a=new p.ComponentInstruction(t,e,this.handler.data,this.handler.componentType,this.terminal,this.specificity,r,this._routeName);return this._cache.set(n,a),a},t}();return e.RouteRule=d,n.define=a,r.exports}),System.register("angular2/src/router/rules/route_paths/param_route_path",["angular2/src/facade/lang","angular2/src/facade/exceptions","angular2/src/facade/collection","angular2/src/router/utils","angular2/src/router/url_parser","angular2/src/router/rules/route_paths/route_path"],!0,function(t,e,r){function n(t){return s.isBlank(t)?null:(t=s.StringWrapper.replaceAll(t,_,"%25"),t=s.StringWrapper.replaceAll(t,v,"%2F"),t=s.StringWrapper.replaceAll(t,R,"%28"),t=s.StringWrapper.replaceAll(t,P,"%29"),t=s.StringWrapper.replaceAll(t,x,"%3B"))}function a(t){return s.isBlank(t)?null:(t=s.StringWrapper.replaceAll(t,S,";"),t=s.StringWrapper.replaceAll(t,b,")"),t=s.StringWrapper.replaceAll(t,O,"("),t=s.StringWrapper.replaceAll(t,w,"/"),t=s.StringWrapper.replaceAll(t,E,"%"))}var o=System.global,i=o.define;o.define=void 0;var s=t("angular2/src/facade/lang"),u=t("angular2/src/facade/exceptions"),c=t("angular2/src/facade/collection"),l=t("angular2/src/router/utils"),p=t("angular2/src/router/url_parser"),f=t("angular2/src/router/rules/route_paths/route_path"),h=function(){function t(){this.name="",this.specificity="",this.hash="..."}return t.prototype.generate=function(t){return""},t.prototype.match=function(t){return!0},t}(),g=function(){function t(t){this.path=t,this.name="",this.specificity="2",this.hash=t}return t.prototype.match=function(t){return t==this.path},t.prototype.generate=function(t){return this.path},t}(),m=function(){function t(t){this.name=t,this.specificity="1",this.hash=":"}return t.prototype.match=function(t){return t.length>0},t.prototype.generate=function(t){if(!c.StringMapWrapper.contains(t.map,this.name))throw new u.BaseException("Route generator for '"+this.name+"' was not included in parameters passed.");return n(l.normalizeString(t.get(this.name)))},t.paramMatcher=/^:([^\/]+)$/g,t}(),d=function(){function t(t){this.name=t,this.specificity="0",this.hash="*"}return t.prototype.match=function(t){return!0},t.prototype.generate=function(t){return l.normalizeString(t.get(this.name))},t.wildcardMatcher=/^\*([^\/]+)$/g,t}(),y=function(){function t(t){this.routePath=t,this.terminal=!0,this._assertValidPath(t),this._parsePathString(t),this.specificity=this._calculateSpecificity(),this.hash=this._calculateHash();var e=this._segments[this._segments.length-1];this.terminal=!(e instanceof h)}return t.prototype.matchUrl=function(t){for(var e,r=t,n={},o=[],i=0;i<this._segments.length;i+=1){var u=this._segments[i];if(e=r,u instanceof h)break;if(s.isPresent(e)){if(u instanceof d){n[u.name]=e.toString(),o.push(e.toString()),r=null;break}if(o.push(e.path),u instanceof m)n[u.name]=a(e.path);else if(!u.match(e.path))return null;r=e.child}else if(!u.match(""))return null}if(this.terminal&&s.isPresent(r))return null;var l=o.join("/"),g=[],y=[],_=n;if(s.isPresent(e)){var v=t instanceof p.RootUrl?t:e;s.isPresent(v.params)?(_=c.StringMapWrapper.merge(v.params,n),y=p.convertUrlParamsToArray(v.params)):_=n,g=e.auxiliary}return new f.MatchedUrl(l,y,_,g,r)},t.prototype.generateUrl=function(t){for(var e=new l.TouchMap(t),r=[],n=0;n<this._segments.length;n++){var a=this._segments[n];a instanceof h||r.push(a.generate(e))}var o=r.join("/"),i=e.getUnused(),s=i;return new f.GeneratedUrl(o,s)},t.prototype.toString=function(){return this.routePath},t.prototype._parsePathString=function(t){t.startsWith("/")&&(t=t.substring(1));var e=t.split("/");this._segments=[];for(var r=e.length-1,n=0;r>=n;n++){var a,o=e[n];if(s.isPresent(a=s.RegExpWrapper.firstMatch(m.paramMatcher,o)))this._segments.push(new m(a[1]));else if(s.isPresent(a=s.RegExpWrapper.firstMatch(d.wildcardMatcher,o)))this._segments.push(new d(a[1]));else if("..."==o){if(r>n)throw new u.BaseException('Unexpected "..." before the end of the path for "'+t+'".');this._segments.push(new h)}else this._segments.push(new g(o))}},t.prototype._calculateSpecificity=function(){var t,e,r=this._segments.length;if(0==r)e+="2";else for(e="",t=0;r>t;t++)e+=this._segments[t].specificity;return e},t.prototype._calculateHash=function(){var t,e=this._segments.length,r=[];for(t=0;e>t;t++)r.push(this._segments[t].hash);return r.join("/")},t.prototype._assertValidPath=function(e){if(s.StringWrapper.contains(e,"#"))throw new u.BaseException('Path "'+e+'" should not include "#". Use "HashLocationStrategy" instead.');var r=s.RegExpWrapper.firstMatch(t.RESERVED_CHARS,e);if(s.isPresent(r))throw new u.BaseException('Path "'+e+'" contains "'+r[0]+'" which is not allowed in a route config.')},t.RESERVED_CHARS=s.RegExpWrapper.create("//|\\(|\\)|;|\\?|="),t}();e.ParamRoutePath=y;var _=/%/g,v=/\//g,R=/\(/g,P=/\)/g,x=/;/g,S=/%3B/gi,b=/%29/gi,O=/%28/gi,w=/%2F/gi,E=/%25/gi;return o.define=i,r.exports}),System.register("angular2/src/router/route_config/route_config_normalizer",["angular2/src/router/route_config/route_config_decorator","angular2/src/facade/lang","angular2/src/facade/exceptions"],!0,function(t,e,r){function n(t,e){if(t instanceof u.AsyncRoute){var r=a(t.loader,e);return new u.AsyncRoute({path:t.path,loader:r,name:t.name,data:t.data,useAsDefault:t.useAsDefault})}if(t instanceof u.Route||t instanceof u.Redirect||t instanceof u.AuxRoute)return t;if(+!!t.component+ +!!t.redirectTo+ +!!t.loader!=1)throw new l.BaseException('Route config should contain exactly one "component", "loader", or "redirectTo" property.');if(t.as&&t.name)throw new l.BaseException('Route config should contain exactly one "as" or "name" property.');if(t.as&&(t.name=t.as),t.loader){var r=a(t.loader,e);return new u.AsyncRoute({path:t.path,loader:r,name:t.name,data:t.data,useAsDefault:t.useAsDefault})}if(t.aux)return new u.AuxRoute({path:t.aux,component:t.component,name:t.name});if(t.component){if("object"==typeof t.component){var n=t.component;if("constructor"==n.type)return new u.Route({path:t.path,component:n.constructor,name:t.name,data:t.data,useAsDefault:t.useAsDefault});if("loader"==n.type)return new u.AsyncRoute({path:t.path,loader:n.loader,name:t.name,data:t.data,useAsDefault:t.useAsDefault});throw new l.BaseException('Invalid component type "'+n.type+'". Valid types are "constructor" and "loader".')}return new u.Route(t)}return t.redirectTo?new u.Redirect({path:t.path,redirectTo:t.redirectTo}):t}function a(t,e){return function(){return t().then(function(t){return e.configFromComponent(t),t})}}function o(t,e){if(!c.isType(t))throw new l.BaseException('Component for route "'+e+'" is not defined, or is not a class.')}var i=System.global,s=i.define;i.define=void 0;var u=t("angular2/src/router/route_config/route_config_decorator"),c=t("angular2/src/facade/lang"),l=t("angular2/src/facade/exceptions");return e.normalizeRouteConfig=n,e.assertComponentExists=o,i.define=s,r.exports}),System.register("angular2/src/router/location/location",["angular2/src/router/location/location_strategy","angular2/src/facade/async","angular2/core"],!0,function(t,e,r){function n(t,e){return t.length>0&&e.startsWith(t)?e.substring(t.length):e}function a(t){return/\/index.html$/g.test(t)?t.substring(0,t.length-11):t}function o(t){return/\/$/g.test(t)&&(t=t.substring(0,t.length-1)),t}var i=System.global,s=i.define;i.define=void 0;var u=this&&this.__decorate||function(t,e,r,n){var a,o=arguments.length,i=3>o?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(3>o?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i},c=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},l=t("angular2/src/router/location/location_strategy"),p=t("angular2/src/facade/async"),f=t("angular2/core"),h=function(){function t(t){var e=this;this.platformStrategy=t,this._subject=new p.EventEmitter;var r=this.platformStrategy.getBaseHref();this._baseHref=o(a(r)),this.platformStrategy.onPopState(function(t){p.ObservableWrapper.callEmit(e._subject,{url:e.path(),pop:!0,type:t.type})})}return t.prototype.path=function(){return this.normalize(this.platformStrategy.path())},t.prototype.normalize=function(t){return o(n(this._baseHref,a(t)))},t.prototype.prepareExternalUrl=function(t){return t.length>0&&!t.startsWith("/")&&(t="/"+t),this.platformStrategy.prepareExternalUrl(t)},t.prototype.go=function(t,e){void 0===e&&(e=""),this.platformStrategy.pushState(null,"",t,e)},t.prototype.replaceState=function(t,e){void 0===e&&(e=""),this.platformStrategy.replaceState(null,"",t,e)},t.prototype.forward=function(){this.platformStrategy.forward()},t.prototype.back=function(){this.platformStrategy.back()},t.prototype.subscribe=function(t,e,r){return void 0===e&&(e=null),void 0===r&&(r=null),p.ObservableWrapper.subscribe(this._subject,t,e,r)},t=u([f.Injectable(),c("design:paramtypes",[l.LocationStrategy])],t)}();return e.Location=h,i.define=s,r.exports}),System.register("angular2/src/router/lifecycle/route_lifecycle_reflector",["angular2/src/facade/lang","angular2/src/router/lifecycle/lifecycle_annotations_impl","angular2/src/core/reflection/reflection"],!0,function(t,e,r){function n(t,e){return e instanceof s.Type?t.name in e.prototype:!1}function a(t){for(var e=c.reflector.annotations(t),r=0;r<e.length;r+=1){var n=e[r];if(n instanceof u.CanActivate)return n.fn}return null}var o=System.global,i=o.define;o.define=void 0;var s=t("angular2/src/facade/lang"),u=t("angular2/src/router/lifecycle/lifecycle_annotations_impl"),c=t("angular2/src/core/reflection/reflection");return e.hasLifecycleHook=n,e.getCanActivateHook=a,o.define=i,r.exports}),System.register("angular2/src/router/directives/router_outlet",["angular2/src/facade/async","angular2/src/facade/collection","angular2/src/facade/lang","angular2/core","angular2/src/router/router","angular2/src/router/instruction","angular2/src/router/lifecycle/lifecycle_annotations","angular2/src/router/lifecycle/route_lifecycle_reflector"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=this&&this.__decorate||function(t,e,r,n){var a,o=arguments.length,i=3>o?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(3>o?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i},i=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},s=this&&this.__param||function(t,e){return function(r,n){e(r,n,t)}},u=t("angular2/src/facade/async"),c=t("angular2/src/facade/collection"),l=t("angular2/src/facade/lang"),p=t("angular2/core"),f=t("angular2/src/router/router"),h=t("angular2/src/router/instruction"),g=t("angular2/src/router/lifecycle/lifecycle_annotations"),m=t("angular2/src/router/lifecycle/route_lifecycle_reflector"),d=u.PromiseWrapper.resolve(!0),y=function(){function t(t,e,r,n){this._elementRef=t,this._loader=e,this._parentRouter=r,this.name=null,this._componentRef=null,this._currentInstruction=null,l.isPresent(n)?(this.name=n,this._parentRouter.registerAuxOutlet(this)):this._parentRouter.registerPrimaryOutlet(this)}return t.prototype.activate=function(t){var e=this,r=this._currentInstruction;this._currentInstruction=t;var n=t.componentType,a=this._parentRouter.childRouter(n),o=p.Injector.resolve([p.provide(h.RouteData,{useValue:t.routeData}),p.provide(h.RouteParams,{useValue:new h.RouteParams(t.params)}),p.provide(f.Router,{useValue:a})]);return this._componentRef=this._loader.loadNextToLocation(n,this._elementRef,o),this._componentRef.then(function(a){return m.hasLifecycleHook(g.routerOnActivate,n)?e._componentRef.then(function(e){return e.instance.routerOnActivate(t,r)}):a})},t.prototype.reuse=function(t){var e=this._currentInstruction;return this._currentInstruction=t,l.isBlank(this._componentRef)?this.activate(t):u.PromiseWrapper.resolve(m.hasLifecycleHook(g.routerOnReuse,this._currentInstruction.componentType)?this._componentRef.then(function(r){return r.instance.routerOnReuse(t,e)}):!0)},t.prototype.deactivate=function(t){var e=this,r=d;return l.isPresent(this._componentRef)&&l.isPresent(this._currentInstruction)&&m.hasLifecycleHook(g.routerOnDeactivate,this._currentInstruction.componentType)&&(r=this._componentRef.then(function(r){return r.instance.routerOnDeactivate(t,e._currentInstruction)})),r.then(function(t){if(l.isPresent(e._componentRef)){var r=e._componentRef.then(function(t){return t.dispose()});return e._componentRef=null,r}})},t.prototype.routerCanDeactivate=function(t){var e=this;return l.isBlank(this._currentInstruction)?d:m.hasLifecycleHook(g.routerCanDeactivate,this._currentInstruction.componentType)?this._componentRef.then(function(r){return r.instance.routerCanDeactivate(t,e._currentInstruction)}):d},t.prototype.routerCanReuse=function(t){var e,r=this;return e=l.isBlank(this._currentInstruction)||this._currentInstruction.componentType!=t.componentType?!1:m.hasLifecycleHook(g.routerCanReuse,this._currentInstruction.componentType)?this._componentRef.then(function(e){return e.instance.routerCanReuse(t,r._currentInstruction)}):t==this._currentInstruction||l.isPresent(t.params)&&l.isPresent(this._currentInstruction.params)&&c.StringMapWrapper.equals(t.params,this._currentInstruction.params),u.PromiseWrapper.resolve(e)},t.prototype.ngOnDestroy=function(){this._parentRouter.unregisterPrimaryOutlet(this)},t=o([p.Directive({selector:"router-outlet"}),s(3,p.Attribute("name")),i("design:paramtypes",[p.ElementRef,p.DynamicComponentLoader,f.Router,String])],t)}();return e.RouterOutlet=y,n.define=a,r.exports}),System.register("angular2/src/router/location/browser_platform_location",["angular2/core","angular2/src/router/location/platform_location","angular2/src/platform/dom/dom_adapter"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=this&&this.__decorate||function(t,e,r,n){var a,o=arguments.length,i=3>o?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(3>o?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i},s=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},u=t("angular2/core"),c=t("angular2/src/router/location/platform_location"),l=t("angular2/src/platform/dom/dom_adapter"),p=function(t){function e(){t.call(this),this._init()}return o(e,t),e.prototype._init=function(){this._location=l.DOM.getLocation(),this._history=l.DOM.getHistory()},Object.defineProperty(e.prototype,"location",{get:function(){return this._location},enumerable:!0,configurable:!0}),e.prototype.getBaseHrefFromDOM=function(){return l.DOM.getBaseHref()},e.prototype.onPopState=function(t){l.DOM.getGlobalEventTarget("window").addEventListener("popstate",t,!1)},e.prototype.onHashChange=function(t){l.DOM.getGlobalEventTarget("window").addEventListener("hashchange",t,!1)},Object.defineProperty(e.prototype,"pathname",{get:function(){return this._location.pathname},set:function(t){this._location.pathname=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"search",{get:function(){return this._location.search},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hash",{get:function(){return this._location.hash},enumerable:!0,configurable:!0}),e.prototype.pushState=function(t,e,r){this._history.pushState(t,e,r)},e.prototype.replaceState=function(t,e,r){this._history.replaceState(t,e,r)},e.prototype.forward=function(){this._history.forward()},e.prototype.back=function(){this._history.back()},e=i([u.Injectable(),s("design:paramtypes",[])],e)}(c.PlatformLocation);return e.BrowserPlatformLocation=p,n.define=a,r.exports}),System.register("angular2/src/router/rules/rule_set",["angular2/src/facade/lang","angular2/src/facade/exceptions","angular2/src/facade/collection","angular2/src/facade/async","angular2/src/router/rules/rules","angular2/src/router/route_config/route_config_impl","angular2/src/router/rules/route_handlers/async_route_handler","angular2/src/router/rules/route_handlers/sync_route_handler","angular2/src/router/rules/route_paths/param_route_path","angular2/src/router/rules/route_paths/regex_route_path"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=t("angular2/src/facade/lang"),i=t("angular2/src/facade/exceptions"),s=t("angular2/src/facade/collection"),u=t("angular2/src/facade/async"),c=t("angular2/src/router/rules/rules"),l=t("angular2/src/router/route_config/route_config_impl"),p=t("angular2/src/router/rules/route_handlers/async_route_handler"),f=t("angular2/src/router/rules/route_handlers/sync_route_handler"),h=t("angular2/src/router/rules/route_paths/param_route_path"),g=t("angular2/src/router/rules/route_paths/regex_route_path"),m=function(){function t(){this.rulesByName=new s.Map,this.auxRulesByName=new s.Map,this.auxRulesByPath=new s.Map,this.rules=[],this.defaultRule=null}return t.prototype.config=function(t){var e;if(o.isPresent(t.name)&&t.name[0].toUpperCase()!=t.name[0]){var r=t.name[0].toUpperCase()+t.name.substring(1);throw new i.BaseException('Route "'+t.path+'" with name "'+t.name+'" does not begin with an uppercase letter. Route names should be CamelCase like "'+r+'".')}if(t instanceof l.AuxRoute){e=new f.SyncRouteHandler(t.component,t.data);var n=this._getRoutePath(t),a=new c.RouteRule(n,e,t.name);return this.auxRulesByPath.set(n.toString(),a),o.isPresent(t.name)&&this.auxRulesByName.set(t.name,a),a.terminal}var s=!1;if(t instanceof l.Redirect){var u=this._getRoutePath(t),h=new c.RedirectRule(u,t.redirectTo);return this._assertNoHashCollision(h.hash,t.path),this.rules.push(h),!0}t instanceof l.Route?(e=new f.SyncRouteHandler(t.component,t.data),s=o.isPresent(t.useAsDefault)&&t.useAsDefault):t instanceof l.AsyncRoute&&(e=new p.AsyncRouteHandler(t.loader,t.data),s=o.isPresent(t.useAsDefault)&&t.useAsDefault);var g=this._getRoutePath(t),m=new c.RouteRule(g,e,t.name);if(this._assertNoHashCollision(m.hash,t.path),s){if(o.isPresent(this.defaultRule))throw new i.BaseException("Only one route can be default");this.defaultRule=m}return this.rules.push(m),o.isPresent(t.name)&&this.rulesByName.set(t.name,m),m.terminal},t.prototype.recognize=function(t){var e=[];return this.rules.forEach(function(r){var n=r.recognize(t);o.isPresent(n)&&e.push(n)}),0==e.length&&o.isPresent(t)&&t.auxiliary.length>0?[u.PromiseWrapper.resolve(new c.PathMatch(null,null,t.auxiliary))]:e},t.prototype.recognizeAuxiliary=function(t){var e=this.auxRulesByPath.get(t.path);return o.isPresent(e)?[e.recognize(t)]:[u.PromiseWrapper.resolve(null)]},t.prototype.hasRoute=function(t){return this.rulesByName.has(t)},t.prototype.componentLoaded=function(t){return this.hasRoute(t)&&o.isPresent(this.rulesByName.get(t).handler.componentType)},t.prototype.loadComponent=function(t){return this.rulesByName.get(t).handler.resolveComponentType()},t.prototype.generate=function(t,e){var r=this.rulesByName.get(t);return o.isBlank(r)?null:r.generate(e)},t.prototype.generateAuxiliary=function(t,e){var r=this.auxRulesByName.get(t);return o.isBlank(r)?null:r.generate(e)},t.prototype._assertNoHashCollision=function(t,e){this.rules.forEach(function(r){if(t==r.hash)throw new i.BaseException("Configuration '"+e+"' conflicts with existing route '"+r.path+"'")})},t.prototype._getRoutePath=function(t){if(o.isPresent(t.regex)){if(o.isFunction(t.serializer))return new g.RegexRoutePath(t.regex,t.serializer);throw new i.BaseException("Route provides a regex property, '"+t.regex+"', but no serializer property")}if(o.isPresent(t.path)){var e=t instanceof l.AuxRoute&&t.path.startsWith("/")?t.path.substring(1):t.path;return new h.ParamRoutePath(e)}throw new i.BaseException("Route must provide either a path or regex property")},t}();return e.RuleSet=m,n.define=a,r.exports}),System.register("angular2/src/router/router_providers",["angular2/src/router/router_providers_common","angular2/core","angular2/src/facade/lang","angular2/src/router/location/browser_platform_location","angular2/src/router/location/platform_location"],!0,function(t,e,r){var n=System.global,a=n.define;n.define=void 0;var o=t("angular2/src/router/router_providers_common"),i=t("angular2/core"),s=t("angular2/src/facade/lang"),u=t("angular2/src/router/location/browser_platform_location"),c=t("angular2/src/router/location/platform_location");return e.ROUTER_PROVIDERS=s.CONST_EXPR([o.ROUTER_PROVIDERS_COMMON,s.CONST_EXPR(new i.Provider(c.PlatformLocation,{useClass:u.BrowserPlatformLocation}))]),e.ROUTER_BINDINGS=e.ROUTER_PROVIDERS,n.define=a,r.exports}),System.register("angular2/src/router/route_registry",["angular2/src/facade/collection","angular2/src/facade/async","angular2/src/facade/lang","angular2/src/facade/exceptions","angular2/src/core/reflection/reflection","angular2/core","angular2/src/router/route_config/route_config_impl","angular2/src/router/rules/rules","angular2/src/router/rules/rule_set","angular2/src/router/instruction","angular2/src/router/route_config/route_config_normalizer","angular2/src/router/url_parser"],!0,function(t,e,r){function n(t){var e=[];return t.forEach(function(t){if(g.isString(t)){var r=t;e=e.concat(r.split("/"))}else e.push(t)}),e}function a(t){if(t=t.filter(function(t){return g.isPresent(t)}),0==t.length)return null;if(1==t.length)return t[0];var e=t[0],r=t.slice(1);return r.reduce(function(t,e){return-1==o(e.specificity,t.specificity)?e:t},e)}function o(t,e){for(var r=g.Math.min(t.length,e.length),n=0;r>n;n+=1){var a=g.StringWrapper.charCodeAt(t,n),o=g.StringWrapper.charCodeAt(e,n),i=o-a;if(0!=i)return i}return t.length-e.length}function i(t,e){if(g.isType(t)){var r=d.reflector.annotations(t);if(g.isPresent(r))for(var n=0;n<r.length;n++){var a=r[n];if(a instanceof _.RouteConfig)throw new m.BaseException('Child routes are not allowed for "'+e+'". Use "..." on the parent\'s route path.')}}}var s=System.global,u=s.define;s.define=void 0;var c=this&&this.__decorate||function(t,e,r,n){var a,o=arguments.length,i=3>o?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(3>o?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i},l=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},p=this&&this.__param||function(t,e){return function(r,n){e(r,n,t)}},f=t("angular2/src/facade/collection"),h=t("angular2/src/facade/async"),g=t("angular2/src/facade/lang"),m=t("angular2/src/facade/exceptions"),d=t("angular2/src/core/reflection/reflection"),y=t("angular2/core"),_=t("angular2/src/router/route_config/route_config_impl"),v=t("angular2/src/router/rules/rules"),R=t("angular2/src/router/rules/rule_set"),P=t("angular2/src/router/instruction"),x=t("angular2/src/router/route_config/route_config_normalizer"),S=t("angular2/src/router/url_parser"),b=h.PromiseWrapper.resolve(null);e.ROUTER_PRIMARY_COMPONENT=g.CONST_EXPR(new y.OpaqueToken("RouterPrimaryComponent"));var O=function(){function t(t){this._rootComponent=t,this._rules=new f.Map}return t.prototype.config=function(t,e){e=x.normalizeRouteConfig(e,this),e instanceof _.Route?x.assertComponentExists(e.component,e.path):e instanceof _.AuxRoute&&x.assertComponentExists(e.component,e.path);var r=this._rules.get(t);g.isBlank(r)&&(r=new R.RuleSet,this._rules.set(t,r));var n=r.config(e);e instanceof _.Route&&(n?i(e.component,e.path):this.configFromComponent(e.component))},t.prototype.configFromComponent=function(t){var e=this;if(g.isType(t)&&!this._rules.has(t)){var r=d.reflector.annotations(t);if(g.isPresent(r))for(var n=0;n<r.length;n++){var a=r[n];if(a instanceof _.RouteConfig){var o=a.configs;o.forEach(function(r){return e.config(t,r)})}}}},t.prototype.recognize=function(t,e){var r=S.parser.parse(t);return this._recognize(r,[])},t.prototype._recognize=function(t,e,r){var n=this;void 0===r&&(r=!1);var o=f.ListWrapper.last(e),i=g.isPresent(o)?o.component.componentType:this._rootComponent,s=this._rules.get(i);if(g.isBlank(s))return b;var u=r?s.recognizeAuxiliary(t):s.recognize(t),c=u.map(function(t){return t.then(function(t){if(t instanceof v.PathMatch){var r=e.length>0?[f.ListWrapper.last(e)]:[],a=n._auxRoutesToUnresolved(t.remainingAux,r),o=new P.ResolvedInstruction(t.instruction,null,a);if(g.isBlank(t.instruction)||t.instruction.terminal)return o;var i=e.concat([o]);return n._recognize(t.remaining,i).then(function(t){return g.isBlank(t)?null:t instanceof P.RedirectInstruction?t:(o.child=t,o)})}if(t instanceof v.RedirectMatch){var o=n.generate(t.redirectTo,e.concat([null]));return new P.RedirectInstruction(o.component,o.child,o.auxInstruction,t.specificity)}})});return!g.isBlank(t)&&""!=t.path||0!=u.length?h.PromiseWrapper.all(c).then(a):h.PromiseWrapper.resolve(this.generateDefault(i))},t.prototype._auxRoutesToUnresolved=function(t,e){var r=this,n={};return t.forEach(function(t){n[t.path]=new P.UnresolvedInstruction(function(){return r._recognize(t,e,!0)})}),n},t.prototype.generate=function(t,e,r){void 0===r&&(r=!1);var a,o=n(t);if(""==f.ListWrapper.first(o))o.shift(),a=f.ListWrapper.first(e),e=[];else if(a=e.length>0?e.pop():null,"."==f.ListWrapper.first(o))o.shift();else if(".."==f.ListWrapper.first(o))for(;".."==f.ListWrapper.first(o);){if(e.length<=0)throw new m.BaseException('Link "'+f.ListWrapper.toJSON(t)+'" has too many "../" segments.');a=e.pop(),o=f.ListWrapper.slice(o,1)}else{var i=f.ListWrapper.first(o),s=this._rootComponent,u=null;if(e.length>1){var c=e[e.length-1],l=e[e.length-2];s=c.component.componentType,u=l.component.componentType}else 1==e.length&&(s=e[0].component.componentType,u=this._rootComponent);var p=this.hasRoute(i,s),h=g.isPresent(u)&&this.hasRoute(i,u);if(h&&p){var d='Link "'+f.ListWrapper.toJSON(t)+'" is ambiguous, use "./" or "../" to disambiguate.';throw new m.BaseException(d)}h&&(a=e.pop())}if(""==o[o.length-1]&&o.pop(),o.length>0&&""==o[0]&&o.shift(),o.length<1){var d='Link "'+f.ListWrapper.toJSON(t)+'" must include a route name.';throw new m.BaseException(d)}for(var y=this._generate(o,e,a,r,t),_=e.length-1;_>=0;_--){var v=e[_];if(g.isBlank(v))break;y=v.replaceChild(y)}return y},t.prototype._generate=function(t,e,r,n,a){var o=this;void 0===n&&(n=!1);var i=this._rootComponent,s=null,u={},c=f.ListWrapper.last(e);if(g.isPresent(c)&&g.isPresent(c.component)&&(i=c.component.componentType),0==t.length){var l=this.generateDefault(i);if(g.isBlank(l))throw new m.BaseException('Link "'+f.ListWrapper.toJSON(a)+'" does not resolve to a terminal instruction.');return l}g.isPresent(r)&&!n&&(u=f.StringMapWrapper.merge(r.auxInstruction,u),s=r.component);var p=this._rules.get(i);if(g.isBlank(p))throw new m.BaseException('Component "'+g.getTypeNameForDebugging(i)+'" has no route config.');var h=0,d={};if(h<t.length&&g.isString(t[h])){var y=t[h];if(""==y||"."==y||".."==y)throw new m.BaseException('"'+y+'/" is only allowed at the beginning of a link DSL.');if(h+=1,h<t.length){var _=t[h];g.isStringMap(_)&&!g.isArray(_)&&(d=_,h+=1)}var v=(n?p.auxRulesByName:p.rulesByName).get(y);if(g.isBlank(v))throw new m.BaseException('Component "'+g.getTypeNameForDebugging(i)+'" has no route named "'+y+'".');if(g.isBlank(v.handler.componentType)){var R=v.generateComponentPathValues(d);return new P.UnresolvedInstruction(function(){return v.handler.resolveComponentType().then(function(i){return o._generate(t,e,r,n,a)})},R.urlPath,S.convertUrlParamsToArray(R.urlParams))}s=n?p.generateAuxiliary(y,d):p.generate(y,d)}for(;h<t.length&&g.isArray(t[h]);){var x=[c],b=this._generate(t[h],x,null,!0,a);u[b.component.urlPath]=b,h+=1}var O=new P.ResolvedInstruction(s,null,u);if(g.isPresent(s)&&g.isPresent(s.componentType)){var w=null;if(s.terminal)h>=t.length;else{var E=e.concat([O]),T=t.slice(h);w=this._generate(T,E,null,!1,a)}O.child=w}return O},t.prototype.hasRoute=function(t,e){var r=this._rules.get(e);return g.isBlank(r)?!1:r.hasRoute(t)},t.prototype.generateDefault=function(t){var e=this;if(g.isBlank(t))return null;var r=this._rules.get(t);if(g.isBlank(r)||g.isBlank(r.defaultRule))return null;var n=null;if(g.isPresent(r.defaultRule.handler.componentType)){
|
3
|
+
var a=r.defaultRule.generate({});return r.defaultRule.terminal||(n=this.generateDefault(r.defaultRule.handler.componentType)),new P.DefaultInstruction(a,n)}return new P.UnresolvedInstruction(function(){return r.defaultRule.handler.resolveComponentType().then(function(r){return e.generateDefault(t)})})},t=c([y.Injectable(),p(0,y.Inject(e.ROUTER_PRIMARY_COMPONENT)),l("design:paramtypes",[g.Type])],t)}();return e.RouteRegistry=O,s.define=u,r.exports}),System.register("angular2/src/router/router",["angular2/src/facade/async","angular2/src/facade/collection","angular2/src/facade/lang","angular2/src/facade/exceptions","angular2/core","angular2/src/router/route_registry","angular2/src/router/location/location","angular2/src/router/lifecycle/route_lifecycle_reflector"],!0,function(t,e,r){function n(t,e){var r=_;return f.isBlank(t.component)?r:(f.isPresent(t.child)&&(r=n(t.child,f.isPresent(e)?e.child:null)),r.then(function(r){if(0==r)return!1;if(t.component.reuse)return!0;var n=y.getCanActivateHook(t.component.componentType);return f.isPresent(n)?n(t.component,f.isPresent(e)?e.component:null):!0}))}var a=System.global,o=a.define;a.define=void 0;var i=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},s=this&&this.__decorate||function(t,e,r,n){var a,o=arguments.length,i=3>o?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(3>o?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i},u=this&&this.__metadata||function(t,e){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(t,e):void 0},c=this&&this.__param||function(t,e){return function(r,n){e(r,n,t)}},l=t("angular2/src/facade/async"),p=t("angular2/src/facade/collection"),f=t("angular2/src/facade/lang"),h=t("angular2/src/facade/exceptions"),g=t("angular2/core"),m=t("angular2/src/router/route_registry"),d=t("angular2/src/router/location/location"),y=t("angular2/src/router/lifecycle/route_lifecycle_reflector"),_=l.PromiseWrapper.resolve(!0),v=l.PromiseWrapper.resolve(!1),R=function(){function t(t,e,r,n){this.registry=t,this.parent=e,this.hostComponent=r,this.root=n,this.navigating=!1,this.currentInstruction=null,this._currentNavigation=_,this._outlet=null,this._auxRouters=new p.Map,this._subject=new l.EventEmitter}return t.prototype.childRouter=function(t){return this._childRouter=new x(this,t)},t.prototype.auxRouter=function(t){return new x(this,t)},t.prototype.registerPrimaryOutlet=function(t){if(f.isPresent(t.name))throw new h.BaseException("registerPrimaryOutlet expects to be called with an unnamed outlet.");if(f.isPresent(this._outlet))throw new h.BaseException("Primary outlet is already registered.");return this._outlet=t,f.isPresent(this.currentInstruction)?this.commit(this.currentInstruction,!1):_},t.prototype.unregisterPrimaryOutlet=function(t){if(f.isPresent(t.name))throw new h.BaseException("registerPrimaryOutlet expects to be called with an unnamed outlet.");this._outlet=null},t.prototype.registerAuxOutlet=function(t){var e=t.name;if(f.isBlank(e))throw new h.BaseException("registerAuxOutlet expects to be called with an outlet with a name.");var r=this.auxRouter(this.hostComponent);this._auxRouters.set(e,r),r._outlet=t;var n;return f.isPresent(this.currentInstruction)&&f.isPresent(n=this.currentInstruction.auxInstruction[e])?r.commit(n):_},t.prototype.isRouteActive=function(t){var e=this,r=this;if(f.isBlank(this.currentInstruction))return!1;for(;f.isPresent(r.parent)&&f.isPresent(t.child);)r=r.parent,t=t.child;if(f.isBlank(t.component)||f.isBlank(this.currentInstruction.component)||this.currentInstruction.component.routeName!=t.component.routeName)return!1;var n=!0;return f.isPresent(this.currentInstruction.component.params)&&p.StringMapWrapper.forEach(t.component.params,function(t,r){e.currentInstruction.component.params[r]!==t&&(n=!1)}),n},t.prototype.config=function(t){var e=this;return t.forEach(function(t){e.registry.config(e.hostComponent,t)}),this.renavigate()},t.prototype.navigate=function(t){var e=this.generate(t);return this.navigateByInstruction(e,!1)},t.prototype.navigateByUrl=function(t,e){var r=this;return void 0===e&&(e=!1),this._currentNavigation=this._currentNavigation.then(function(n){return r.lastNavigationAttempt=t,r._startNavigating(),r._afterPromiseFinishNavigating(r.recognize(t).then(function(t){return f.isBlank(t)?!1:r._navigate(t,e)}))})},t.prototype.navigateByInstruction=function(t,e){var r=this;return void 0===e&&(e=!1),f.isBlank(t)?v:this._currentNavigation=this._currentNavigation.then(function(n){return r._startNavigating(),r._afterPromiseFinishNavigating(r._navigate(t,e))})},t.prototype._settleInstruction=function(t){var e=this;return t.resolveComponent().then(function(r){var n=[];return f.isPresent(t.component)&&(t.component.reuse=!1),f.isPresent(t.child)&&n.push(e._settleInstruction(t.child)),p.StringMapWrapper.forEach(t.auxInstruction,function(t,r){n.push(e._settleInstruction(t))}),l.PromiseWrapper.all(n)})},t.prototype._navigate=function(t,e){var r=this;return this._settleInstruction(t).then(function(e){return r._routerCanReuse(t)}).then(function(e){return r._canActivate(t)}).then(function(n){return n?r._routerCanDeactivate(t).then(function(n){return n?r.commit(t,e).then(function(e){return r._emitNavigationFinish(t.toRootUrl()),!0}):void 0}):!1})},t.prototype._emitNavigationFinish=function(t){l.ObservableWrapper.callEmit(this._subject,t)},t.prototype._emitNavigationFail=function(t){l.ObservableWrapper.callError(this._subject,t)},t.prototype._afterPromiseFinishNavigating=function(t){var e=this;return l.PromiseWrapper.catchError(t.then(function(t){return e._finishNavigating()}),function(t){throw e._finishNavigating(),t})},t.prototype._routerCanReuse=function(t){var e=this;return f.isBlank(this._outlet)?v:f.isBlank(t.component)?_:this._outlet.routerCanReuse(t.component).then(function(r){return t.component.reuse=r,r&&f.isPresent(e._childRouter)&&f.isPresent(t.child)?e._childRouter._routerCanReuse(t.child):void 0})},t.prototype._canActivate=function(t){return n(t,this.currentInstruction)},t.prototype._routerCanDeactivate=function(t){var e=this;if(f.isBlank(this._outlet))return _;var r,n=null,a=!1,o=null;return f.isPresent(t)&&(n=t.child,o=t.component,a=f.isBlank(t.component)||t.component.reuse),r=a?_:this._outlet.routerCanDeactivate(o),r.then(function(t){return 0==t?!1:f.isPresent(e._childRouter)?e._childRouter._routerCanDeactivate(n):!0})},t.prototype.commit=function(t,e){var r=this;void 0===e&&(e=!1),this.currentInstruction=t;var n=_;if(f.isPresent(this._outlet)&&f.isPresent(t.component)){var a=t.component;n=a.reuse?this._outlet.reuse(a):this.deactivate(t).then(function(t){return r._outlet.activate(a)}),f.isPresent(t.child)&&(n=n.then(function(e){return f.isPresent(r._childRouter)?r._childRouter.commit(t.child):void 0}))}var o=[];return this._auxRouters.forEach(function(e,r){f.isPresent(t.auxInstruction[r])&&o.push(e.commit(t.auxInstruction[r]))}),n.then(function(t){return l.PromiseWrapper.all(o)})},t.prototype._startNavigating=function(){this.navigating=!0},t.prototype._finishNavigating=function(){this.navigating=!1},t.prototype.subscribe=function(t,e){return l.ObservableWrapper.subscribe(this._subject,t,e)},t.prototype.deactivate=function(t){var e=this,r=null,n=null;f.isPresent(t)&&(r=t.child,n=t.component);var a=_;return f.isPresent(this._childRouter)&&(a=this._childRouter.deactivate(r)),f.isPresent(this._outlet)&&(a=a.then(function(t){return e._outlet.deactivate(n)})),a},t.prototype.recognize=function(t){var e=this._getAncestorInstructions();return this.registry.recognize(t,e)},t.prototype._getAncestorInstructions=function(){for(var t=[this.currentInstruction],e=this;f.isPresent(e=e.parent);)t.unshift(e.currentInstruction);return t},t.prototype.renavigate=function(){return f.isBlank(this.lastNavigationAttempt)?this._currentNavigation:this.navigateByUrl(this.lastNavigationAttempt)},t.prototype.generate=function(t){var e=this._getAncestorInstructions();return this.registry.generate(t,e)},t=s([g.Injectable(),u("design:paramtypes",[m.RouteRegistry,t,Object,t])],t)}();e.Router=R;var P=function(t){function e(e,r,n){var a=this;t.call(this,e,null,n),this.root=this,this._location=r,this._locationSub=this._location.subscribe(function(t){a.recognize(t.url).then(function(e){f.isPresent(e)?a.navigateByInstruction(e,f.isPresent(t.pop)).then(function(r){if(!f.isPresent(t.pop)||"hashchange"==t.type){var n=e.toUrlPath(),o=e.toUrlQuery();n.length>0&&"/"!=n[0]&&(n="/"+n),"hashchange"==t.type?e.toRootUrl()!=a._location.path()&&a._location.replaceState(n,o):a._location.go(n,o)}}):a._emitNavigationFail(t.url)})}),this.registry.configFromComponent(n),this.navigateByUrl(r.path())}return i(e,t),e.prototype.commit=function(e,r){var n=this;void 0===r&&(r=!1);var a=e.toUrlPath(),o=e.toUrlQuery();a.length>0&&"/"!=a[0]&&(a="/"+a);var i=t.prototype.commit.call(this,e);return r||(i=i.then(function(t){n._location.go(a,o)})),i},e.prototype.dispose=function(){f.isPresent(this._locationSub)&&(l.ObservableWrapper.dispose(this._locationSub),this._locationSub=null)},e=s([g.Injectable(),c(2,g.Inject(m.ROUTER_PRIMARY_COMPONENT)),u("design:paramtypes",[m.RouteRegistry,d.Location,f.Type])],e)}(R);e.RootRouter=P;var x=function(t){function e(e,r){t.call(this,e.registry,e,r,e.root),this.parent=e}return i(e,t),e.prototype.navigateByUrl=function(t,e){return void 0===e&&(e=!1),this.parent.navigateByUrl(t,e)},e.prototype.navigateByInstruction=function(t,e){return void 0===e&&(e=!1),this.parent.navigateByInstruction(t,e)},e}(R);return a.define=o,r.exports}),System.register("angular2/router",["angular2/src/router/router","angular2/src/router/directives/router_outlet","angular2/src/router/directives/router_link","angular2/src/router/instruction","angular2/src/router/location/platform_location","angular2/src/router/route_registry","angular2/src/router/location/location_strategy","angular2/src/router/location/hash_location_strategy","angular2/src/router/location/path_location_strategy","angular2/src/router/location/location","angular2/src/router/route_config/route_config_decorator","angular2/src/router/lifecycle/lifecycle_annotations","angular2/src/router/instruction","angular2/core","angular2/src/router/router_providers_common","angular2/src/router/router_providers","angular2/src/router/directives/router_outlet","angular2/src/router/directives/router_link","angular2/src/facade/lang"],!0,function(t,e,r){function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}var a=System.global,o=a.define;a.define=void 0;var i=t("angular2/src/router/router");e.Router=i.Router;var s=t("angular2/src/router/directives/router_outlet");e.RouterOutlet=s.RouterOutlet;var u=t("angular2/src/router/directives/router_link");e.RouterLink=u.RouterLink;var c=t("angular2/src/router/instruction");e.RouteParams=c.RouteParams,e.RouteData=c.RouteData;var l=t("angular2/src/router/location/platform_location");e.PlatformLocation=l.PlatformLocation;var p=t("angular2/src/router/route_registry");e.RouteRegistry=p.RouteRegistry,e.ROUTER_PRIMARY_COMPONENT=p.ROUTER_PRIMARY_COMPONENT;var f=t("angular2/src/router/location/location_strategy");e.LocationStrategy=f.LocationStrategy,e.APP_BASE_HREF=f.APP_BASE_HREF;var h=t("angular2/src/router/location/hash_location_strategy");e.HashLocationStrategy=h.HashLocationStrategy;var g=t("angular2/src/router/location/path_location_strategy");e.PathLocationStrategy=g.PathLocationStrategy;var m=t("angular2/src/router/location/location");e.Location=m.Location,n(t("angular2/src/router/route_config/route_config_decorator"));var d=t("angular2/src/router/lifecycle/lifecycle_annotations");e.CanActivate=d.CanActivate;var y=t("angular2/src/router/instruction");e.Instruction=y.Instruction,e.ComponentInstruction=y.ComponentInstruction;var _=t("angular2/core");e.OpaqueToken=_.OpaqueToken;var v=t("angular2/src/router/router_providers_common");e.ROUTER_PROVIDERS_COMMON=v.ROUTER_PROVIDERS_COMMON;var R=t("angular2/src/router/router_providers");e.ROUTER_PROVIDERS=R.ROUTER_PROVIDERS,e.ROUTER_BINDINGS=R.ROUTER_BINDINGS;var P=t("angular2/src/router/directives/router_outlet"),x=t("angular2/src/router/directives/router_link"),S=t("angular2/src/facade/lang");return e.ROUTER_DIRECTIVES=S.CONST_EXPR([P.RouterOutlet,x.RouterLink]),a.define=o,r.exports});
|
@@ -0,0 +1,2205 @@
|
|
1
|
+
"format register";
|
2
|
+
System.register("angular2/src/mock/animation_builder_mock", ["angular2/src/core/di", "angular2/src/animate/animation_builder", "angular2/src/animate/css_animation_builder", "angular2/src/animate/animation", "angular2/src/animate/browser_details"], true, function(require, exports, module) {
|
3
|
+
var global = System.global,
|
4
|
+
__define = global.define;
|
5
|
+
global.define = undefined;
|
6
|
+
"use strict";
|
7
|
+
var __extends = (this && this.__extends) || function(d, b) {
|
8
|
+
for (var p in b)
|
9
|
+
if (b.hasOwnProperty(p))
|
10
|
+
d[p] = b[p];
|
11
|
+
function __() {
|
12
|
+
this.constructor = d;
|
13
|
+
}
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
17
|
+
var c = arguments.length,
|
18
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
19
|
+
d;
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
21
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
22
|
+
else
|
23
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
24
|
+
if (d = decorators[i])
|
25
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
26
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
27
|
+
};
|
28
|
+
var __metadata = (this && this.__metadata) || function(k, v) {
|
29
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
30
|
+
return Reflect.metadata(k, v);
|
31
|
+
};
|
32
|
+
var di_1 = require("angular2/src/core/di");
|
33
|
+
var animation_builder_1 = require("angular2/src/animate/animation_builder");
|
34
|
+
var css_animation_builder_1 = require("angular2/src/animate/css_animation_builder");
|
35
|
+
var animation_1 = require("angular2/src/animate/animation");
|
36
|
+
var browser_details_1 = require("angular2/src/animate/browser_details");
|
37
|
+
var MockAnimationBuilder = (function(_super) {
|
38
|
+
__extends(MockAnimationBuilder, _super);
|
39
|
+
function MockAnimationBuilder() {
|
40
|
+
_super.call(this, null);
|
41
|
+
}
|
42
|
+
MockAnimationBuilder.prototype.css = function() {
|
43
|
+
return new MockCssAnimationBuilder();
|
44
|
+
};
|
45
|
+
MockAnimationBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockAnimationBuilder);
|
46
|
+
return MockAnimationBuilder;
|
47
|
+
}(animation_builder_1.AnimationBuilder));
|
48
|
+
exports.MockAnimationBuilder = MockAnimationBuilder;
|
49
|
+
var MockCssAnimationBuilder = (function(_super) {
|
50
|
+
__extends(MockCssAnimationBuilder, _super);
|
51
|
+
function MockCssAnimationBuilder() {
|
52
|
+
_super.call(this, null);
|
53
|
+
}
|
54
|
+
MockCssAnimationBuilder.prototype.start = function(element) {
|
55
|
+
return new MockAnimation(element, this.data);
|
56
|
+
};
|
57
|
+
return MockCssAnimationBuilder;
|
58
|
+
}(css_animation_builder_1.CssAnimationBuilder));
|
59
|
+
var MockBrowserAbstraction = (function(_super) {
|
60
|
+
__extends(MockBrowserAbstraction, _super);
|
61
|
+
function MockBrowserAbstraction() {
|
62
|
+
_super.apply(this, arguments);
|
63
|
+
}
|
64
|
+
MockBrowserAbstraction.prototype.doesElapsedTimeIncludesDelay = function() {
|
65
|
+
this.elapsedTimeIncludesDelay = false;
|
66
|
+
};
|
67
|
+
return MockBrowserAbstraction;
|
68
|
+
}(browser_details_1.BrowserDetails));
|
69
|
+
var MockAnimation = (function(_super) {
|
70
|
+
__extends(MockAnimation, _super);
|
71
|
+
function MockAnimation(element, data) {
|
72
|
+
_super.call(this, element, data, new MockBrowserAbstraction());
|
73
|
+
}
|
74
|
+
MockAnimation.prototype.wait = function(callback) {
|
75
|
+
this._callback = callback;
|
76
|
+
};
|
77
|
+
MockAnimation.prototype.flush = function() {
|
78
|
+
this._callback(0);
|
79
|
+
this._callback = null;
|
80
|
+
};
|
81
|
+
return MockAnimation;
|
82
|
+
}(animation_1.Animation));
|
83
|
+
global.define = __define;
|
84
|
+
return module.exports;
|
85
|
+
});
|
86
|
+
|
87
|
+
System.register("angular2/src/mock/directive_resolver_mock", ["angular2/src/core/di", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/core/metadata", "angular2/src/core/linker/directive_resolver"], true, function(require, exports, module) {
|
88
|
+
var global = System.global,
|
89
|
+
__define = global.define;
|
90
|
+
global.define = undefined;
|
91
|
+
"use strict";
|
92
|
+
var __extends = (this && this.__extends) || function(d, b) {
|
93
|
+
for (var p in b)
|
94
|
+
if (b.hasOwnProperty(p))
|
95
|
+
d[p] = b[p];
|
96
|
+
function __() {
|
97
|
+
this.constructor = d;
|
98
|
+
}
|
99
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
100
|
+
};
|
101
|
+
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
102
|
+
var c = arguments.length,
|
103
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
104
|
+
d;
|
105
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
106
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
107
|
+
else
|
108
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
109
|
+
if (d = decorators[i])
|
110
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
111
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
112
|
+
};
|
113
|
+
var __metadata = (this && this.__metadata) || function(k, v) {
|
114
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
115
|
+
return Reflect.metadata(k, v);
|
116
|
+
};
|
117
|
+
var di_1 = require("angular2/src/core/di");
|
118
|
+
var collection_1 = require("angular2/src/facade/collection");
|
119
|
+
var lang_1 = require("angular2/src/facade/lang");
|
120
|
+
var metadata_1 = require("angular2/src/core/metadata");
|
121
|
+
var directive_resolver_1 = require("angular2/src/core/linker/directive_resolver");
|
122
|
+
var MockDirectiveResolver = (function(_super) {
|
123
|
+
__extends(MockDirectiveResolver, _super);
|
124
|
+
function MockDirectiveResolver() {
|
125
|
+
_super.apply(this, arguments);
|
126
|
+
this._providerOverrides = new collection_1.Map();
|
127
|
+
this.viewProviderOverrides = new collection_1.Map();
|
128
|
+
}
|
129
|
+
MockDirectiveResolver.prototype.resolve = function(type) {
|
130
|
+
var dm = _super.prototype.resolve.call(this, type);
|
131
|
+
var providerOverrides = this._providerOverrides.get(type);
|
132
|
+
var viewProviderOverrides = this.viewProviderOverrides.get(type);
|
133
|
+
var providers = dm.providers;
|
134
|
+
if (lang_1.isPresent(providerOverrides)) {
|
135
|
+
providers = dm.providers.concat(providerOverrides);
|
136
|
+
}
|
137
|
+
if (dm instanceof metadata_1.ComponentMetadata) {
|
138
|
+
var viewProviders = dm.viewProviders;
|
139
|
+
if (lang_1.isPresent(viewProviderOverrides)) {
|
140
|
+
viewProviders = dm.viewProviders.concat(viewProviderOverrides);
|
141
|
+
}
|
142
|
+
return new metadata_1.ComponentMetadata({
|
143
|
+
selector: dm.selector,
|
144
|
+
inputs: dm.inputs,
|
145
|
+
outputs: dm.outputs,
|
146
|
+
host: dm.host,
|
147
|
+
exportAs: dm.exportAs,
|
148
|
+
moduleId: dm.moduleId,
|
149
|
+
queries: dm.queries,
|
150
|
+
changeDetection: dm.changeDetection,
|
151
|
+
providers: providers,
|
152
|
+
viewProviders: viewProviders
|
153
|
+
});
|
154
|
+
}
|
155
|
+
return new metadata_1.DirectiveMetadata({
|
156
|
+
selector: dm.selector,
|
157
|
+
inputs: dm.inputs,
|
158
|
+
outputs: dm.outputs,
|
159
|
+
host: dm.host,
|
160
|
+
providers: providers,
|
161
|
+
exportAs: dm.exportAs,
|
162
|
+
queries: dm.queries
|
163
|
+
});
|
164
|
+
};
|
165
|
+
MockDirectiveResolver.prototype.setBindingsOverride = function(type, bindings) {
|
166
|
+
this._providerOverrides.set(type, bindings);
|
167
|
+
};
|
168
|
+
MockDirectiveResolver.prototype.setViewBindingsOverride = function(type, viewBindings) {
|
169
|
+
this.viewProviderOverrides.set(type, viewBindings);
|
170
|
+
};
|
171
|
+
MockDirectiveResolver.prototype.setProvidersOverride = function(type, providers) {
|
172
|
+
this._providerOverrides.set(type, providers);
|
173
|
+
};
|
174
|
+
MockDirectiveResolver.prototype.setViewProvidersOverride = function(type, viewProviders) {
|
175
|
+
this.viewProviderOverrides.set(type, viewProviders);
|
176
|
+
};
|
177
|
+
MockDirectiveResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockDirectiveResolver);
|
178
|
+
return MockDirectiveResolver;
|
179
|
+
}(directive_resolver_1.DirectiveResolver));
|
180
|
+
exports.MockDirectiveResolver = MockDirectiveResolver;
|
181
|
+
global.define = __define;
|
182
|
+
return module.exports;
|
183
|
+
});
|
184
|
+
|
185
|
+
System.register("angular2/src/mock/view_resolver_mock", ["angular2/src/core/di", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/facade/exceptions", "angular2/src/core/metadata", "angular2/src/core/linker/view_resolver"], true, function(require, exports, module) {
|
186
|
+
var global = System.global,
|
187
|
+
__define = global.define;
|
188
|
+
global.define = undefined;
|
189
|
+
"use strict";
|
190
|
+
var __extends = (this && this.__extends) || function(d, b) {
|
191
|
+
for (var p in b)
|
192
|
+
if (b.hasOwnProperty(p))
|
193
|
+
d[p] = b[p];
|
194
|
+
function __() {
|
195
|
+
this.constructor = d;
|
196
|
+
}
|
197
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
198
|
+
};
|
199
|
+
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
200
|
+
var c = arguments.length,
|
201
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
202
|
+
d;
|
203
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
204
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
205
|
+
else
|
206
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
207
|
+
if (d = decorators[i])
|
208
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
209
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
210
|
+
};
|
211
|
+
var __metadata = (this && this.__metadata) || function(k, v) {
|
212
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
213
|
+
return Reflect.metadata(k, v);
|
214
|
+
};
|
215
|
+
var di_1 = require("angular2/src/core/di");
|
216
|
+
var collection_1 = require("angular2/src/facade/collection");
|
217
|
+
var lang_1 = require("angular2/src/facade/lang");
|
218
|
+
var exceptions_1 = require("angular2/src/facade/exceptions");
|
219
|
+
var metadata_1 = require("angular2/src/core/metadata");
|
220
|
+
var view_resolver_1 = require("angular2/src/core/linker/view_resolver");
|
221
|
+
var MockViewResolver = (function(_super) {
|
222
|
+
__extends(MockViewResolver, _super);
|
223
|
+
function MockViewResolver() {
|
224
|
+
_super.call(this);
|
225
|
+
this._views = new collection_1.Map();
|
226
|
+
this._inlineTemplates = new collection_1.Map();
|
227
|
+
this._viewCache = new collection_1.Map();
|
228
|
+
this._directiveOverrides = new collection_1.Map();
|
229
|
+
}
|
230
|
+
MockViewResolver.prototype.setView = function(component, view) {
|
231
|
+
this._checkOverrideable(component);
|
232
|
+
this._views.set(component, view);
|
233
|
+
};
|
234
|
+
MockViewResolver.prototype.setInlineTemplate = function(component, template) {
|
235
|
+
this._checkOverrideable(component);
|
236
|
+
this._inlineTemplates.set(component, template);
|
237
|
+
};
|
238
|
+
MockViewResolver.prototype.overrideViewDirective = function(component, from, to) {
|
239
|
+
this._checkOverrideable(component);
|
240
|
+
var overrides = this._directiveOverrides.get(component);
|
241
|
+
if (lang_1.isBlank(overrides)) {
|
242
|
+
overrides = new collection_1.Map();
|
243
|
+
this._directiveOverrides.set(component, overrides);
|
244
|
+
}
|
245
|
+
overrides.set(from, to);
|
246
|
+
};
|
247
|
+
MockViewResolver.prototype.resolve = function(component) {
|
248
|
+
var view = this._viewCache.get(component);
|
249
|
+
if (lang_1.isPresent(view))
|
250
|
+
return view;
|
251
|
+
view = this._views.get(component);
|
252
|
+
if (lang_1.isBlank(view)) {
|
253
|
+
view = _super.prototype.resolve.call(this, component);
|
254
|
+
}
|
255
|
+
var directives = view.directives;
|
256
|
+
var overrides = this._directiveOverrides.get(component);
|
257
|
+
if (lang_1.isPresent(overrides) && lang_1.isPresent(directives)) {
|
258
|
+
directives = collection_1.ListWrapper.clone(view.directives);
|
259
|
+
overrides.forEach(function(to, from) {
|
260
|
+
var srcIndex = directives.indexOf(from);
|
261
|
+
if (srcIndex == -1) {
|
262
|
+
throw new exceptions_1.BaseException("Overriden directive " + lang_1.stringify(from) + " not found in the template of " + lang_1.stringify(component));
|
263
|
+
}
|
264
|
+
directives[srcIndex] = to;
|
265
|
+
});
|
266
|
+
view = new metadata_1.ViewMetadata({
|
267
|
+
template: view.template,
|
268
|
+
templateUrl: view.templateUrl,
|
269
|
+
directives: directives
|
270
|
+
});
|
271
|
+
}
|
272
|
+
var inlineTemplate = this._inlineTemplates.get(component);
|
273
|
+
if (lang_1.isPresent(inlineTemplate)) {
|
274
|
+
view = new metadata_1.ViewMetadata({
|
275
|
+
template: inlineTemplate,
|
276
|
+
templateUrl: null,
|
277
|
+
directives: view.directives
|
278
|
+
});
|
279
|
+
}
|
280
|
+
this._viewCache.set(component, view);
|
281
|
+
return view;
|
282
|
+
};
|
283
|
+
MockViewResolver.prototype._checkOverrideable = function(component) {
|
284
|
+
var cached = this._viewCache.get(component);
|
285
|
+
if (lang_1.isPresent(cached)) {
|
286
|
+
throw new exceptions_1.BaseException("The component " + lang_1.stringify(component) + " has already been compiled, its configuration can not be changed");
|
287
|
+
}
|
288
|
+
};
|
289
|
+
MockViewResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockViewResolver);
|
290
|
+
return MockViewResolver;
|
291
|
+
}(view_resolver_1.ViewResolver));
|
292
|
+
exports.MockViewResolver = MockViewResolver;
|
293
|
+
global.define = __define;
|
294
|
+
return module.exports;
|
295
|
+
});
|
296
|
+
|
297
|
+
System.register("angular2/src/router/location/location_strategy", ["angular2/src/facade/lang", "angular2/core"], true, function(require, exports, module) {
|
298
|
+
var global = System.global,
|
299
|
+
__define = global.define;
|
300
|
+
global.define = undefined;
|
301
|
+
"use strict";
|
302
|
+
var lang_1 = require("angular2/src/facade/lang");
|
303
|
+
var core_1 = require("angular2/core");
|
304
|
+
var LocationStrategy = (function() {
|
305
|
+
function LocationStrategy() {}
|
306
|
+
return LocationStrategy;
|
307
|
+
}());
|
308
|
+
exports.LocationStrategy = LocationStrategy;
|
309
|
+
exports.APP_BASE_HREF = lang_1.CONST_EXPR(new core_1.OpaqueToken('appBaseHref'));
|
310
|
+
function normalizeQueryParams(params) {
|
311
|
+
return (params.length > 0 && params.substring(0, 1) != '?') ? ('?' + params) : params;
|
312
|
+
}
|
313
|
+
exports.normalizeQueryParams = normalizeQueryParams;
|
314
|
+
function joinWithSlash(start, end) {
|
315
|
+
if (start.length == 0) {
|
316
|
+
return end;
|
317
|
+
}
|
318
|
+
if (end.length == 0) {
|
319
|
+
return start;
|
320
|
+
}
|
321
|
+
var slashes = 0;
|
322
|
+
if (start.endsWith('/')) {
|
323
|
+
slashes++;
|
324
|
+
}
|
325
|
+
if (end.startsWith('/')) {
|
326
|
+
slashes++;
|
327
|
+
}
|
328
|
+
if (slashes == 2) {
|
329
|
+
return start + end.substring(1);
|
330
|
+
}
|
331
|
+
if (slashes == 1) {
|
332
|
+
return start + end;
|
333
|
+
}
|
334
|
+
return start + '/' + end;
|
335
|
+
}
|
336
|
+
exports.joinWithSlash = joinWithSlash;
|
337
|
+
global.define = __define;
|
338
|
+
return module.exports;
|
339
|
+
});
|
340
|
+
|
341
|
+
System.register("angular2/src/mock/ng_zone_mock", ["angular2/src/core/di", "angular2/src/core/zone/ng_zone", "angular2/src/facade/async"], true, function(require, exports, module) {
|
342
|
+
var global = System.global,
|
343
|
+
__define = global.define;
|
344
|
+
global.define = undefined;
|
345
|
+
"use strict";
|
346
|
+
var __extends = (this && this.__extends) || function(d, b) {
|
347
|
+
for (var p in b)
|
348
|
+
if (b.hasOwnProperty(p))
|
349
|
+
d[p] = b[p];
|
350
|
+
function __() {
|
351
|
+
this.constructor = d;
|
352
|
+
}
|
353
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
354
|
+
};
|
355
|
+
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
356
|
+
var c = arguments.length,
|
357
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
358
|
+
d;
|
359
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
360
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
361
|
+
else
|
362
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
363
|
+
if (d = decorators[i])
|
364
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
365
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
366
|
+
};
|
367
|
+
var __metadata = (this && this.__metadata) || function(k, v) {
|
368
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
369
|
+
return Reflect.metadata(k, v);
|
370
|
+
};
|
371
|
+
var di_1 = require("angular2/src/core/di");
|
372
|
+
var ng_zone_1 = require("angular2/src/core/zone/ng_zone");
|
373
|
+
var async_1 = require("angular2/src/facade/async");
|
374
|
+
var MockNgZone = (function(_super) {
|
375
|
+
__extends(MockNgZone, _super);
|
376
|
+
function MockNgZone() {
|
377
|
+
_super.call(this, {enableLongStackTrace: false});
|
378
|
+
this._mockOnStable = new async_1.EventEmitter(false);
|
379
|
+
}
|
380
|
+
Object.defineProperty(MockNgZone.prototype, "onStable", {
|
381
|
+
get: function() {
|
382
|
+
return this._mockOnStable;
|
383
|
+
},
|
384
|
+
enumerable: true,
|
385
|
+
configurable: true
|
386
|
+
});
|
387
|
+
MockNgZone.prototype.run = function(fn) {
|
388
|
+
return fn();
|
389
|
+
};
|
390
|
+
MockNgZone.prototype.runOutsideAngular = function(fn) {
|
391
|
+
return fn();
|
392
|
+
};
|
393
|
+
MockNgZone.prototype.simulateZoneExit = function() {
|
394
|
+
async_1.ObservableWrapper.callNext(this.onStable, null);
|
395
|
+
};
|
396
|
+
MockNgZone = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockNgZone);
|
397
|
+
return MockNgZone;
|
398
|
+
}(ng_zone_1.NgZone));
|
399
|
+
exports.MockNgZone = MockNgZone;
|
400
|
+
global.define = __define;
|
401
|
+
return module.exports;
|
402
|
+
});
|
403
|
+
|
404
|
+
System.register("angular2/src/testing/utils", ["angular2/core", "angular2/src/facade/collection", "angular2/src/platform/dom/dom_adapter", "angular2/src/facade/lang"], true, function(require, exports, module) {
|
405
|
+
var global = System.global,
|
406
|
+
__define = global.define;
|
407
|
+
global.define = undefined;
|
408
|
+
"use strict";
|
409
|
+
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
410
|
+
var c = arguments.length,
|
411
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
412
|
+
d;
|
413
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
414
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
415
|
+
else
|
416
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
417
|
+
if (d = decorators[i])
|
418
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
419
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
420
|
+
};
|
421
|
+
var __metadata = (this && this.__metadata) || function(k, v) {
|
422
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
423
|
+
return Reflect.metadata(k, v);
|
424
|
+
};
|
425
|
+
var core_1 = require("angular2/core");
|
426
|
+
var collection_1 = require("angular2/src/facade/collection");
|
427
|
+
var dom_adapter_1 = require("angular2/src/platform/dom/dom_adapter");
|
428
|
+
var lang_1 = require("angular2/src/facade/lang");
|
429
|
+
var Log = (function() {
|
430
|
+
function Log() {
|
431
|
+
this.logItems = [];
|
432
|
+
}
|
433
|
+
Log.prototype.add = function(value) {
|
434
|
+
this.logItems.push(value);
|
435
|
+
};
|
436
|
+
Log.prototype.fn = function(value) {
|
437
|
+
var _this = this;
|
438
|
+
return function(a1, a2, a3, a4, a5) {
|
439
|
+
if (a1 === void 0) {
|
440
|
+
a1 = null;
|
441
|
+
}
|
442
|
+
if (a2 === void 0) {
|
443
|
+
a2 = null;
|
444
|
+
}
|
445
|
+
if (a3 === void 0) {
|
446
|
+
a3 = null;
|
447
|
+
}
|
448
|
+
if (a4 === void 0) {
|
449
|
+
a4 = null;
|
450
|
+
}
|
451
|
+
if (a5 === void 0) {
|
452
|
+
a5 = null;
|
453
|
+
}
|
454
|
+
_this.logItems.push(value);
|
455
|
+
};
|
456
|
+
};
|
457
|
+
Log.prototype.clear = function() {
|
458
|
+
this.logItems = [];
|
459
|
+
};
|
460
|
+
Log.prototype.result = function() {
|
461
|
+
return this.logItems.join("; ");
|
462
|
+
};
|
463
|
+
Log = __decorate([core_1.Injectable(), __metadata('design:paramtypes', [])], Log);
|
464
|
+
return Log;
|
465
|
+
}());
|
466
|
+
exports.Log = Log;
|
467
|
+
exports.browserDetection = null;
|
468
|
+
var BrowserDetection = (function() {
|
469
|
+
function BrowserDetection(ua) {
|
470
|
+
if (lang_1.isPresent(ua)) {
|
471
|
+
this._ua = ua;
|
472
|
+
} else {
|
473
|
+
this._ua = lang_1.isPresent(dom_adapter_1.DOM) ? dom_adapter_1.DOM.getUserAgent() : '';
|
474
|
+
}
|
475
|
+
}
|
476
|
+
BrowserDetection.setup = function() {
|
477
|
+
exports.browserDetection = new BrowserDetection(null);
|
478
|
+
};
|
479
|
+
Object.defineProperty(BrowserDetection.prototype, "isFirefox", {
|
480
|
+
get: function() {
|
481
|
+
return this._ua.indexOf('Firefox') > -1;
|
482
|
+
},
|
483
|
+
enumerable: true,
|
484
|
+
configurable: true
|
485
|
+
});
|
486
|
+
Object.defineProperty(BrowserDetection.prototype, "isAndroid", {
|
487
|
+
get: function() {
|
488
|
+
return this._ua.indexOf('Mozilla/5.0') > -1 && this._ua.indexOf('Android') > -1 && this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Chrome') == -1;
|
489
|
+
},
|
490
|
+
enumerable: true,
|
491
|
+
configurable: true
|
492
|
+
});
|
493
|
+
Object.defineProperty(BrowserDetection.prototype, "isEdge", {
|
494
|
+
get: function() {
|
495
|
+
return this._ua.indexOf('Edge') > -1;
|
496
|
+
},
|
497
|
+
enumerable: true,
|
498
|
+
configurable: true
|
499
|
+
});
|
500
|
+
Object.defineProperty(BrowserDetection.prototype, "isIE", {
|
501
|
+
get: function() {
|
502
|
+
return this._ua.indexOf('Trident') > -1;
|
503
|
+
},
|
504
|
+
enumerable: true,
|
505
|
+
configurable: true
|
506
|
+
});
|
507
|
+
Object.defineProperty(BrowserDetection.prototype, "isWebkit", {
|
508
|
+
get: function() {
|
509
|
+
return this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Edge') == -1;
|
510
|
+
},
|
511
|
+
enumerable: true,
|
512
|
+
configurable: true
|
513
|
+
});
|
514
|
+
Object.defineProperty(BrowserDetection.prototype, "isIOS7", {
|
515
|
+
get: function() {
|
516
|
+
return this._ua.indexOf('iPhone OS 7') > -1 || this._ua.indexOf('iPad OS 7') > -1;
|
517
|
+
},
|
518
|
+
enumerable: true,
|
519
|
+
configurable: true
|
520
|
+
});
|
521
|
+
Object.defineProperty(BrowserDetection.prototype, "isSlow", {
|
522
|
+
get: function() {
|
523
|
+
return this.isAndroid || this.isIE || this.isIOS7;
|
524
|
+
},
|
525
|
+
enumerable: true,
|
526
|
+
configurable: true
|
527
|
+
});
|
528
|
+
Object.defineProperty(BrowserDetection.prototype, "supportsIntlApi", {
|
529
|
+
get: function() {
|
530
|
+
return this._ua.indexOf('Chrome/4') > -1 && this._ua.indexOf('Edge') == -1;
|
531
|
+
},
|
532
|
+
enumerable: true,
|
533
|
+
configurable: true
|
534
|
+
});
|
535
|
+
return BrowserDetection;
|
536
|
+
}());
|
537
|
+
exports.BrowserDetection = BrowserDetection;
|
538
|
+
function dispatchEvent(element, eventType) {
|
539
|
+
dom_adapter_1.DOM.dispatchEvent(element, dom_adapter_1.DOM.createEvent(eventType));
|
540
|
+
}
|
541
|
+
exports.dispatchEvent = dispatchEvent;
|
542
|
+
function el(html) {
|
543
|
+
return dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.content(dom_adapter_1.DOM.createTemplate(html)));
|
544
|
+
}
|
545
|
+
exports.el = el;
|
546
|
+
var _RE_SPECIAL_CHARS = ['-', '[', ']', '/', '{', '}', '\\', '(', ')', '*', '+', '?', '.', '^', '$', '|'];
|
547
|
+
var _ESCAPE_RE = lang_1.RegExpWrapper.create("[\\" + _RE_SPECIAL_CHARS.join('\\') + "]");
|
548
|
+
function containsRegexp(input) {
|
549
|
+
return lang_1.RegExpWrapper.create(lang_1.StringWrapper.replaceAllMapped(input, _ESCAPE_RE, function(match) {
|
550
|
+
return ("\\" + match[0]);
|
551
|
+
}));
|
552
|
+
}
|
553
|
+
exports.containsRegexp = containsRegexp;
|
554
|
+
function normalizeCSS(css) {
|
555
|
+
css = lang_1.StringWrapper.replaceAll(css, /\s+/g, ' ');
|
556
|
+
css = lang_1.StringWrapper.replaceAll(css, /:\s/g, ':');
|
557
|
+
css = lang_1.StringWrapper.replaceAll(css, /'/g, '"');
|
558
|
+
css = lang_1.StringWrapper.replaceAll(css, / }/g, '}');
|
559
|
+
css = lang_1.StringWrapper.replaceAllMapped(css, /url\((\"|\s)(.+)(\"|\s)\)(\s*)/g, function(match) {
|
560
|
+
return ("url(\"" + match[2] + "\")");
|
561
|
+
});
|
562
|
+
css = lang_1.StringWrapper.replaceAllMapped(css, /\[(.+)=([^"\]]+)\]/g, function(match) {
|
563
|
+
return ("[" + match[1] + "=\"" + match[2] + "\"]");
|
564
|
+
});
|
565
|
+
return css;
|
566
|
+
}
|
567
|
+
exports.normalizeCSS = normalizeCSS;
|
568
|
+
var _singleTagWhitelist = ['br', 'hr', 'input'];
|
569
|
+
function stringifyElement(el) {
|
570
|
+
var result = '';
|
571
|
+
if (dom_adapter_1.DOM.isElementNode(el)) {
|
572
|
+
var tagName = dom_adapter_1.DOM.tagName(el).toLowerCase();
|
573
|
+
result += "<" + tagName;
|
574
|
+
var attributeMap = dom_adapter_1.DOM.attributeMap(el);
|
575
|
+
var keys = [];
|
576
|
+
attributeMap.forEach(function(v, k) {
|
577
|
+
return keys.push(k);
|
578
|
+
});
|
579
|
+
collection_1.ListWrapper.sort(keys);
|
580
|
+
for (var i = 0; i < keys.length; i++) {
|
581
|
+
var key = keys[i];
|
582
|
+
var attValue = attributeMap.get(key);
|
583
|
+
if (!lang_1.isString(attValue)) {
|
584
|
+
result += " " + key;
|
585
|
+
} else {
|
586
|
+
result += " " + key + "=\"" + attValue + "\"";
|
587
|
+
}
|
588
|
+
}
|
589
|
+
result += '>';
|
590
|
+
var childrenRoot = dom_adapter_1.DOM.templateAwareRoot(el);
|
591
|
+
var children = lang_1.isPresent(childrenRoot) ? dom_adapter_1.DOM.childNodes(childrenRoot) : [];
|
592
|
+
for (var j = 0; j < children.length; j++) {
|
593
|
+
result += stringifyElement(children[j]);
|
594
|
+
}
|
595
|
+
if (!collection_1.ListWrapper.contains(_singleTagWhitelist, tagName)) {
|
596
|
+
result += "</" + tagName + ">";
|
597
|
+
}
|
598
|
+
} else if (dom_adapter_1.DOM.isCommentNode(el)) {
|
599
|
+
result += "<!--" + dom_adapter_1.DOM.nodeValue(el) + "-->";
|
600
|
+
} else {
|
601
|
+
result += dom_adapter_1.DOM.getText(el);
|
602
|
+
}
|
603
|
+
return result;
|
604
|
+
}
|
605
|
+
exports.stringifyElement = stringifyElement;
|
606
|
+
global.define = __define;
|
607
|
+
return module.exports;
|
608
|
+
});
|
609
|
+
|
610
|
+
System.register("angular2/src/mock/mock_location_strategy", ["angular2/src/core/di", "angular2/src/facade/async", "angular2/src/router/location/location_strategy"], true, function(require, exports, module) {
|
611
|
+
var global = System.global,
|
612
|
+
__define = global.define;
|
613
|
+
global.define = undefined;
|
614
|
+
"use strict";
|
615
|
+
var __extends = (this && this.__extends) || function(d, b) {
|
616
|
+
for (var p in b)
|
617
|
+
if (b.hasOwnProperty(p))
|
618
|
+
d[p] = b[p];
|
619
|
+
function __() {
|
620
|
+
this.constructor = d;
|
621
|
+
}
|
622
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
623
|
+
};
|
624
|
+
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
625
|
+
var c = arguments.length,
|
626
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
627
|
+
d;
|
628
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
629
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
630
|
+
else
|
631
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
632
|
+
if (d = decorators[i])
|
633
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
634
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
635
|
+
};
|
636
|
+
var __metadata = (this && this.__metadata) || function(k, v) {
|
637
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
638
|
+
return Reflect.metadata(k, v);
|
639
|
+
};
|
640
|
+
var di_1 = require("angular2/src/core/di");
|
641
|
+
var async_1 = require("angular2/src/facade/async");
|
642
|
+
var location_strategy_1 = require("angular2/src/router/location/location_strategy");
|
643
|
+
var MockLocationStrategy = (function(_super) {
|
644
|
+
__extends(MockLocationStrategy, _super);
|
645
|
+
function MockLocationStrategy() {
|
646
|
+
_super.call(this);
|
647
|
+
this.internalBaseHref = '/';
|
648
|
+
this.internalPath = '/';
|
649
|
+
this.internalTitle = '';
|
650
|
+
this.urlChanges = [];
|
651
|
+
this._subject = new async_1.EventEmitter();
|
652
|
+
}
|
653
|
+
MockLocationStrategy.prototype.simulatePopState = function(url) {
|
654
|
+
this.internalPath = url;
|
655
|
+
async_1.ObservableWrapper.callEmit(this._subject, new _MockPopStateEvent(this.path()));
|
656
|
+
};
|
657
|
+
MockLocationStrategy.prototype.path = function() {
|
658
|
+
return this.internalPath;
|
659
|
+
};
|
660
|
+
MockLocationStrategy.prototype.prepareExternalUrl = function(internal) {
|
661
|
+
if (internal.startsWith('/') && this.internalBaseHref.endsWith('/')) {
|
662
|
+
return this.internalBaseHref + internal.substring(1);
|
663
|
+
}
|
664
|
+
return this.internalBaseHref + internal;
|
665
|
+
};
|
666
|
+
MockLocationStrategy.prototype.pushState = function(ctx, title, path, query) {
|
667
|
+
this.internalTitle = title;
|
668
|
+
var url = path + (query.length > 0 ? ('?' + query) : '');
|
669
|
+
this.internalPath = url;
|
670
|
+
var externalUrl = this.prepareExternalUrl(url);
|
671
|
+
this.urlChanges.push(externalUrl);
|
672
|
+
};
|
673
|
+
MockLocationStrategy.prototype.replaceState = function(ctx, title, path, query) {
|
674
|
+
this.internalTitle = title;
|
675
|
+
var url = path + (query.length > 0 ? ('?' + query) : '');
|
676
|
+
this.internalPath = url;
|
677
|
+
var externalUrl = this.prepareExternalUrl(url);
|
678
|
+
this.urlChanges.push('replace: ' + externalUrl);
|
679
|
+
};
|
680
|
+
MockLocationStrategy.prototype.onPopState = function(fn) {
|
681
|
+
async_1.ObservableWrapper.subscribe(this._subject, fn);
|
682
|
+
};
|
683
|
+
MockLocationStrategy.prototype.getBaseHref = function() {
|
684
|
+
return this.internalBaseHref;
|
685
|
+
};
|
686
|
+
MockLocationStrategy.prototype.back = function() {
|
687
|
+
if (this.urlChanges.length > 0) {
|
688
|
+
this.urlChanges.pop();
|
689
|
+
var nextUrl = this.urlChanges.length > 0 ? this.urlChanges[this.urlChanges.length - 1] : '';
|
690
|
+
this.simulatePopState(nextUrl);
|
691
|
+
}
|
692
|
+
};
|
693
|
+
MockLocationStrategy.prototype.forward = function() {
|
694
|
+
throw 'not implemented';
|
695
|
+
};
|
696
|
+
MockLocationStrategy = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockLocationStrategy);
|
697
|
+
return MockLocationStrategy;
|
698
|
+
}(location_strategy_1.LocationStrategy));
|
699
|
+
exports.MockLocationStrategy = MockLocationStrategy;
|
700
|
+
var _MockPopStateEvent = (function() {
|
701
|
+
function _MockPopStateEvent(newUrl) {
|
702
|
+
this.newUrl = newUrl;
|
703
|
+
this.pop = true;
|
704
|
+
this.type = 'popstate';
|
705
|
+
}
|
706
|
+
return _MockPopStateEvent;
|
707
|
+
}());
|
708
|
+
global.define = __define;
|
709
|
+
return module.exports;
|
710
|
+
});
|
711
|
+
|
712
|
+
System.register("angular2/src/testing/test_component_builder", ["angular2/core", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/testing/utils", "angular2/src/platform/dom/dom_tokens", "angular2/src/platform/dom/dom_adapter", "angular2/src/core/debug/debug_node"], true, function(require, exports, module) {
|
713
|
+
var global = System.global,
|
714
|
+
__define = global.define;
|
715
|
+
global.define = undefined;
|
716
|
+
"use strict";
|
717
|
+
var __extends = (this && this.__extends) || function(d, b) {
|
718
|
+
for (var p in b)
|
719
|
+
if (b.hasOwnProperty(p))
|
720
|
+
d[p] = b[p];
|
721
|
+
function __() {
|
722
|
+
this.constructor = d;
|
723
|
+
}
|
724
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
725
|
+
};
|
726
|
+
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
727
|
+
var c = arguments.length,
|
728
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
729
|
+
d;
|
730
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
731
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
732
|
+
else
|
733
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
734
|
+
if (d = decorators[i])
|
735
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
736
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
737
|
+
};
|
738
|
+
var __metadata = (this && this.__metadata) || function(k, v) {
|
739
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
740
|
+
return Reflect.metadata(k, v);
|
741
|
+
};
|
742
|
+
var core_1 = require("angular2/core");
|
743
|
+
var lang_1 = require("angular2/src/facade/lang");
|
744
|
+
var collection_1 = require("angular2/src/facade/collection");
|
745
|
+
var utils_1 = require("angular2/src/testing/utils");
|
746
|
+
var dom_tokens_1 = require("angular2/src/platform/dom/dom_tokens");
|
747
|
+
var dom_adapter_1 = require("angular2/src/platform/dom/dom_adapter");
|
748
|
+
var debug_node_1 = require("angular2/src/core/debug/debug_node");
|
749
|
+
var ComponentFixture = (function() {
|
750
|
+
function ComponentFixture() {}
|
751
|
+
return ComponentFixture;
|
752
|
+
}());
|
753
|
+
exports.ComponentFixture = ComponentFixture;
|
754
|
+
var ComponentFixture_ = (function(_super) {
|
755
|
+
__extends(ComponentFixture_, _super);
|
756
|
+
function ComponentFixture_(componentRef) {
|
757
|
+
_super.call(this);
|
758
|
+
this._componentParentView = componentRef.hostView.internalView;
|
759
|
+
this.elementRef = this._componentParentView.appElements[0].ref;
|
760
|
+
this.debugElement = debug_node_1.getDebugNode(this._componentParentView.rootNodesOrAppElements[0].nativeElement);
|
761
|
+
this.componentInstance = this.debugElement.componentInstance;
|
762
|
+
this.nativeElement = this.debugElement.nativeElement;
|
763
|
+
this._componentRef = componentRef;
|
764
|
+
}
|
765
|
+
ComponentFixture_.prototype.detectChanges = function() {
|
766
|
+
this._componentParentView.changeDetector.detectChanges();
|
767
|
+
this._componentParentView.changeDetector.checkNoChanges();
|
768
|
+
};
|
769
|
+
ComponentFixture_.prototype.destroy = function() {
|
770
|
+
this._componentRef.dispose();
|
771
|
+
};
|
772
|
+
return ComponentFixture_;
|
773
|
+
}(ComponentFixture));
|
774
|
+
exports.ComponentFixture_ = ComponentFixture_;
|
775
|
+
var _nextRootElementId = 0;
|
776
|
+
var TestComponentBuilder = (function() {
|
777
|
+
function TestComponentBuilder(_injector) {
|
778
|
+
this._injector = _injector;
|
779
|
+
this._bindingsOverrides = new Map();
|
780
|
+
this._directiveOverrides = new Map();
|
781
|
+
this._templateOverrides = new Map();
|
782
|
+
this._viewBindingsOverrides = new Map();
|
783
|
+
this._viewOverrides = new Map();
|
784
|
+
}
|
785
|
+
TestComponentBuilder.prototype._clone = function() {
|
786
|
+
var clone = new TestComponentBuilder(this._injector);
|
787
|
+
clone._viewOverrides = collection_1.MapWrapper.clone(this._viewOverrides);
|
788
|
+
clone._directiveOverrides = collection_1.MapWrapper.clone(this._directiveOverrides);
|
789
|
+
clone._templateOverrides = collection_1.MapWrapper.clone(this._templateOverrides);
|
790
|
+
return clone;
|
791
|
+
};
|
792
|
+
TestComponentBuilder.prototype.overrideTemplate = function(componentType, template) {
|
793
|
+
var clone = this._clone();
|
794
|
+
clone._templateOverrides.set(componentType, template);
|
795
|
+
return clone;
|
796
|
+
};
|
797
|
+
TestComponentBuilder.prototype.overrideView = function(componentType, view) {
|
798
|
+
var clone = this._clone();
|
799
|
+
clone._viewOverrides.set(componentType, view);
|
800
|
+
return clone;
|
801
|
+
};
|
802
|
+
TestComponentBuilder.prototype.overrideDirective = function(componentType, from, to) {
|
803
|
+
var clone = this._clone();
|
804
|
+
var overridesForComponent = clone._directiveOverrides.get(componentType);
|
805
|
+
if (!lang_1.isPresent(overridesForComponent)) {
|
806
|
+
clone._directiveOverrides.set(componentType, new Map());
|
807
|
+
overridesForComponent = clone._directiveOverrides.get(componentType);
|
808
|
+
}
|
809
|
+
overridesForComponent.set(from, to);
|
810
|
+
return clone;
|
811
|
+
};
|
812
|
+
TestComponentBuilder.prototype.overrideProviders = function(type, providers) {
|
813
|
+
var clone = this._clone();
|
814
|
+
clone._bindingsOverrides.set(type, providers);
|
815
|
+
return clone;
|
816
|
+
};
|
817
|
+
TestComponentBuilder.prototype.overrideBindings = function(type, providers) {
|
818
|
+
return this.overrideProviders(type, providers);
|
819
|
+
};
|
820
|
+
TestComponentBuilder.prototype.overrideViewProviders = function(type, providers) {
|
821
|
+
var clone = this._clone();
|
822
|
+
clone._viewBindingsOverrides.set(type, providers);
|
823
|
+
return clone;
|
824
|
+
};
|
825
|
+
TestComponentBuilder.prototype.overrideViewBindings = function(type, providers) {
|
826
|
+
return this.overrideViewProviders(type, providers);
|
827
|
+
};
|
828
|
+
TestComponentBuilder.prototype.createAsync = function(rootComponentType) {
|
829
|
+
var mockDirectiveResolver = this._injector.get(core_1.DirectiveResolver);
|
830
|
+
var mockViewResolver = this._injector.get(core_1.ViewResolver);
|
831
|
+
this._viewOverrides.forEach(function(view, type) {
|
832
|
+
return mockViewResolver.setView(type, view);
|
833
|
+
});
|
834
|
+
this._templateOverrides.forEach(function(template, type) {
|
835
|
+
return mockViewResolver.setInlineTemplate(type, template);
|
836
|
+
});
|
837
|
+
this._directiveOverrides.forEach(function(overrides, component) {
|
838
|
+
overrides.forEach(function(to, from) {
|
839
|
+
mockViewResolver.overrideViewDirective(component, from, to);
|
840
|
+
});
|
841
|
+
});
|
842
|
+
this._bindingsOverrides.forEach(function(bindings, type) {
|
843
|
+
return mockDirectiveResolver.setBindingsOverride(type, bindings);
|
844
|
+
});
|
845
|
+
this._viewBindingsOverrides.forEach(function(bindings, type) {
|
846
|
+
return mockDirectiveResolver.setViewBindingsOverride(type, bindings);
|
847
|
+
});
|
848
|
+
var rootElId = "root" + _nextRootElementId++;
|
849
|
+
var rootEl = utils_1.el("<div id=\"" + rootElId + "\"></div>");
|
850
|
+
var doc = this._injector.get(dom_tokens_1.DOCUMENT);
|
851
|
+
var oldRoots = dom_adapter_1.DOM.querySelectorAll(doc, '[id^=root]');
|
852
|
+
for (var i = 0; i < oldRoots.length; i++) {
|
853
|
+
dom_adapter_1.DOM.remove(oldRoots[i]);
|
854
|
+
}
|
855
|
+
dom_adapter_1.DOM.appendChild(doc.body, rootEl);
|
856
|
+
var promise = this._injector.get(core_1.DynamicComponentLoader).loadAsRoot(rootComponentType, "#" + rootElId, this._injector);
|
857
|
+
return promise.then(function(componentRef) {
|
858
|
+
return new ComponentFixture_(componentRef);
|
859
|
+
});
|
860
|
+
};
|
861
|
+
TestComponentBuilder = __decorate([core_1.Injectable(), __metadata('design:paramtypes', [core_1.Injector])], TestComponentBuilder);
|
862
|
+
return TestComponentBuilder;
|
863
|
+
}());
|
864
|
+
exports.TestComponentBuilder = TestComponentBuilder;
|
865
|
+
global.define = __define;
|
866
|
+
return module.exports;
|
867
|
+
});
|
868
|
+
|
869
|
+
System.register("angular2/platform/testing/browser_static", ["angular2/core", "angular2/src/platform/browser_common", "angular2/src/platform/browser/browser_adapter", "angular2/src/animate/animation_builder", "angular2/src/mock/animation_builder_mock", "angular2/src/mock/directive_resolver_mock", "angular2/src/mock/view_resolver_mock", "angular2/src/mock/mock_location_strategy", "angular2/src/router/location/location_strategy", "angular2/src/mock/ng_zone_mock", "angular2/src/platform/browser/xhr_impl", "angular2/compiler", "angular2/src/testing/test_component_builder", "angular2/src/testing/utils", "angular2/platform/common_dom", "angular2/src/facade/lang", "angular2/src/testing/utils"], true, function(require, exports, module) {
|
870
|
+
var global = System.global,
|
871
|
+
__define = global.define;
|
872
|
+
global.define = undefined;
|
873
|
+
"use strict";
|
874
|
+
var core_1 = require("angular2/core");
|
875
|
+
var browser_common_1 = require("angular2/src/platform/browser_common");
|
876
|
+
var browser_adapter_1 = require("angular2/src/platform/browser/browser_adapter");
|
877
|
+
var animation_builder_1 = require("angular2/src/animate/animation_builder");
|
878
|
+
var animation_builder_mock_1 = require("angular2/src/mock/animation_builder_mock");
|
879
|
+
var directive_resolver_mock_1 = require("angular2/src/mock/directive_resolver_mock");
|
880
|
+
var view_resolver_mock_1 = require("angular2/src/mock/view_resolver_mock");
|
881
|
+
var mock_location_strategy_1 = require("angular2/src/mock/mock_location_strategy");
|
882
|
+
var location_strategy_1 = require("angular2/src/router/location/location_strategy");
|
883
|
+
var ng_zone_mock_1 = require("angular2/src/mock/ng_zone_mock");
|
884
|
+
var xhr_impl_1 = require("angular2/src/platform/browser/xhr_impl");
|
885
|
+
var compiler_1 = require("angular2/compiler");
|
886
|
+
var test_component_builder_1 = require("angular2/src/testing/test_component_builder");
|
887
|
+
var utils_1 = require("angular2/src/testing/utils");
|
888
|
+
var common_dom_1 = require("angular2/platform/common_dom");
|
889
|
+
var lang_1 = require("angular2/src/facade/lang");
|
890
|
+
var utils_2 = require("angular2/src/testing/utils");
|
891
|
+
function initBrowserTests() {
|
892
|
+
browser_adapter_1.BrowserDomAdapter.makeCurrent();
|
893
|
+
utils_1.BrowserDetection.setup();
|
894
|
+
}
|
895
|
+
exports.TEST_BROWSER_STATIC_PLATFORM_PROVIDERS = lang_1.CONST_EXPR([core_1.PLATFORM_COMMON_PROVIDERS, new core_1.Provider(core_1.PLATFORM_INITIALIZER, {
|
896
|
+
useValue: initBrowserTests,
|
897
|
+
multi: true
|
898
|
+
})]);
|
899
|
+
exports.ADDITIONAL_TEST_BROWSER_PROVIDERS = lang_1.CONST_EXPR([new core_1.Provider(core_1.APP_ID, {useValue: 'a'}), common_dom_1.ELEMENT_PROBE_PROVIDERS, new core_1.Provider(core_1.DirectiveResolver, {useClass: directive_resolver_mock_1.MockDirectiveResolver}), new core_1.Provider(core_1.ViewResolver, {useClass: view_resolver_mock_1.MockViewResolver}), utils_2.Log, test_component_builder_1.TestComponentBuilder, new core_1.Provider(core_1.NgZone, {useClass: ng_zone_mock_1.MockNgZone}), new core_1.Provider(location_strategy_1.LocationStrategy, {useClass: mock_location_strategy_1.MockLocationStrategy}), new core_1.Provider(animation_builder_1.AnimationBuilder, {useClass: animation_builder_mock_1.MockAnimationBuilder})]);
|
900
|
+
exports.TEST_BROWSER_STATIC_APPLICATION_PROVIDERS = lang_1.CONST_EXPR([browser_common_1.BROWSER_APP_COMMON_PROVIDERS, new core_1.Provider(compiler_1.XHR, {useClass: xhr_impl_1.XHRImpl}), exports.ADDITIONAL_TEST_BROWSER_PROVIDERS]);
|
901
|
+
global.define = __define;
|
902
|
+
return module.exports;
|
903
|
+
});
|
904
|
+
|
905
|
+
System.register("angular2/platform/testing/browser", ["angular2/platform/testing/browser_static", "angular2/platform/browser", "angular2/src/facade/lang", "angular2/platform/browser"], true, function(require, exports, module) {
|
906
|
+
var global = System.global,
|
907
|
+
__define = global.define;
|
908
|
+
global.define = undefined;
|
909
|
+
"use strict";
|
910
|
+
var browser_static_1 = require("angular2/platform/testing/browser_static");
|
911
|
+
var browser_1 = require("angular2/platform/browser");
|
912
|
+
var lang_1 = require("angular2/src/facade/lang");
|
913
|
+
var browser_2 = require("angular2/platform/browser");
|
914
|
+
exports.CACHED_TEMPLATE_PROVIDER = browser_2.CACHED_TEMPLATE_PROVIDER;
|
915
|
+
exports.TEST_BROWSER_PLATFORM_PROVIDERS = lang_1.CONST_EXPR([browser_static_1.TEST_BROWSER_STATIC_PLATFORM_PROVIDERS]);
|
916
|
+
exports.TEST_BROWSER_APPLICATION_PROVIDERS = lang_1.CONST_EXPR([browser_1.BROWSER_APP_PROVIDERS, browser_static_1.ADDITIONAL_TEST_BROWSER_PROVIDERS]);
|
917
|
+
global.define = __define;
|
918
|
+
return module.exports;
|
919
|
+
});
|
920
|
+
|
921
|
+
System.register("angular2/src/mock/location_mock", ["angular2/src/core/di", "angular2/src/facade/async"], true, function(require, exports, module) {
|
922
|
+
var global = System.global,
|
923
|
+
__define = global.define;
|
924
|
+
global.define = undefined;
|
925
|
+
"use strict";
|
926
|
+
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
927
|
+
var c = arguments.length,
|
928
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
929
|
+
d;
|
930
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
931
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
932
|
+
else
|
933
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
934
|
+
if (d = decorators[i])
|
935
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
936
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
937
|
+
};
|
938
|
+
var __metadata = (this && this.__metadata) || function(k, v) {
|
939
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
940
|
+
return Reflect.metadata(k, v);
|
941
|
+
};
|
942
|
+
var di_1 = require("angular2/src/core/di");
|
943
|
+
var async_1 = require("angular2/src/facade/async");
|
944
|
+
var SpyLocation = (function() {
|
945
|
+
function SpyLocation() {
|
946
|
+
this.urlChanges = [];
|
947
|
+
this._path = '';
|
948
|
+
this._query = '';
|
949
|
+
this._subject = new async_1.EventEmitter();
|
950
|
+
this._baseHref = '';
|
951
|
+
this.platformStrategy = null;
|
952
|
+
}
|
953
|
+
SpyLocation.prototype.setInitialPath = function(url) {
|
954
|
+
this._path = url;
|
955
|
+
};
|
956
|
+
SpyLocation.prototype.setBaseHref = function(url) {
|
957
|
+
this._baseHref = url;
|
958
|
+
};
|
959
|
+
SpyLocation.prototype.path = function() {
|
960
|
+
return this._path;
|
961
|
+
};
|
962
|
+
SpyLocation.prototype.simulateUrlPop = function(pathname) {
|
963
|
+
async_1.ObservableWrapper.callEmit(this._subject, {
|
964
|
+
'url': pathname,
|
965
|
+
'pop': true
|
966
|
+
});
|
967
|
+
};
|
968
|
+
SpyLocation.prototype.simulateHashChange = function(pathname) {
|
969
|
+
this.setInitialPath(pathname);
|
970
|
+
this.urlChanges.push('hash: ' + pathname);
|
971
|
+
async_1.ObservableWrapper.callEmit(this._subject, {
|
972
|
+
'url': pathname,
|
973
|
+
'pop': true,
|
974
|
+
'type': 'hashchange'
|
975
|
+
});
|
976
|
+
};
|
977
|
+
SpyLocation.prototype.prepareExternalUrl = function(url) {
|
978
|
+
if (url.length > 0 && !url.startsWith('/')) {
|
979
|
+
url = '/' + url;
|
980
|
+
}
|
981
|
+
return this._baseHref + url;
|
982
|
+
};
|
983
|
+
SpyLocation.prototype.go = function(path, query) {
|
984
|
+
if (query === void 0) {
|
985
|
+
query = '';
|
986
|
+
}
|
987
|
+
path = this.prepareExternalUrl(path);
|
988
|
+
if (this._path == path && this._query == query) {
|
989
|
+
return ;
|
990
|
+
}
|
991
|
+
this._path = path;
|
992
|
+
this._query = query;
|
993
|
+
var url = path + (query.length > 0 ? ('?' + query) : '');
|
994
|
+
this.urlChanges.push(url);
|
995
|
+
};
|
996
|
+
SpyLocation.prototype.replaceState = function(path, query) {
|
997
|
+
if (query === void 0) {
|
998
|
+
query = '';
|
999
|
+
}
|
1000
|
+
path = this.prepareExternalUrl(path);
|
1001
|
+
this._path = path;
|
1002
|
+
this._query = query;
|
1003
|
+
var url = path + (query.length > 0 ? ('?' + query) : '');
|
1004
|
+
this.urlChanges.push('replace: ' + url);
|
1005
|
+
};
|
1006
|
+
SpyLocation.prototype.forward = function() {};
|
1007
|
+
SpyLocation.prototype.back = function() {};
|
1008
|
+
SpyLocation.prototype.subscribe = function(onNext, onThrow, onReturn) {
|
1009
|
+
if (onThrow === void 0) {
|
1010
|
+
onThrow = null;
|
1011
|
+
}
|
1012
|
+
if (onReturn === void 0) {
|
1013
|
+
onReturn = null;
|
1014
|
+
}
|
1015
|
+
return async_1.ObservableWrapper.subscribe(this._subject, onNext, onThrow, onReturn);
|
1016
|
+
};
|
1017
|
+
SpyLocation.prototype.normalize = function(url) {
|
1018
|
+
return null;
|
1019
|
+
};
|
1020
|
+
SpyLocation = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], SpyLocation);
|
1021
|
+
return SpyLocation;
|
1022
|
+
}());
|
1023
|
+
exports.SpyLocation = SpyLocation;
|
1024
|
+
global.define = __define;
|
1025
|
+
return module.exports;
|
1026
|
+
});
|
1027
|
+
|
1028
|
+
System.register("angular2/router/testing", ["angular2/src/mock/mock_location_strategy", "angular2/src/mock/location_mock"], true, function(require, exports, module) {
|
1029
|
+
var global = System.global,
|
1030
|
+
__define = global.define;
|
1031
|
+
global.define = undefined;
|
1032
|
+
"use strict";
|
1033
|
+
function __export(m) {
|
1034
|
+
for (var p in m)
|
1035
|
+
if (!exports.hasOwnProperty(p))
|
1036
|
+
exports[p] = m[p];
|
1037
|
+
}
|
1038
|
+
__export(require("angular2/src/mock/mock_location_strategy"));
|
1039
|
+
__export(require("angular2/src/mock/location_mock"));
|
1040
|
+
global.define = __define;
|
1041
|
+
return module.exports;
|
1042
|
+
});
|
1043
|
+
|
1044
|
+
System.register("angular2/src/http/headers", ["angular2/src/facade/lang", "angular2/src/facade/exceptions", "angular2/src/facade/collection"], true, function(require, exports, module) {
|
1045
|
+
var global = System.global,
|
1046
|
+
__define = global.define;
|
1047
|
+
global.define = undefined;
|
1048
|
+
"use strict";
|
1049
|
+
var lang_1 = require("angular2/src/facade/lang");
|
1050
|
+
var exceptions_1 = require("angular2/src/facade/exceptions");
|
1051
|
+
var collection_1 = require("angular2/src/facade/collection");
|
1052
|
+
var Headers = (function() {
|
1053
|
+
function Headers(headers) {
|
1054
|
+
var _this = this;
|
1055
|
+
if (headers instanceof Headers) {
|
1056
|
+
this._headersMap = headers._headersMap;
|
1057
|
+
return ;
|
1058
|
+
}
|
1059
|
+
this._headersMap = new collection_1.Map();
|
1060
|
+
if (lang_1.isBlank(headers)) {
|
1061
|
+
return ;
|
1062
|
+
}
|
1063
|
+
collection_1.StringMapWrapper.forEach(headers, function(v, k) {
|
1064
|
+
_this._headersMap.set(k, collection_1.isListLikeIterable(v) ? v : [v]);
|
1065
|
+
});
|
1066
|
+
}
|
1067
|
+
Headers.fromResponseHeaderString = function(headersString) {
|
1068
|
+
return headersString.trim().split('\n').map(function(val) {
|
1069
|
+
return val.split(':');
|
1070
|
+
}).map(function(_a) {
|
1071
|
+
var key = _a[0],
|
1072
|
+
parts = _a.slice(1);
|
1073
|
+
return ([key.trim(), parts.join(':').trim()]);
|
1074
|
+
}).reduce(function(headers, _a) {
|
1075
|
+
var key = _a[0],
|
1076
|
+
value = _a[1];
|
1077
|
+
return !headers.set(key, value) && headers;
|
1078
|
+
}, new Headers());
|
1079
|
+
};
|
1080
|
+
Headers.prototype.append = function(name, value) {
|
1081
|
+
var mapName = this._headersMap.get(name);
|
1082
|
+
var list = collection_1.isListLikeIterable(mapName) ? mapName : [];
|
1083
|
+
list.push(value);
|
1084
|
+
this._headersMap.set(name, list);
|
1085
|
+
};
|
1086
|
+
Headers.prototype.delete = function(name) {
|
1087
|
+
this._headersMap.delete(name);
|
1088
|
+
};
|
1089
|
+
Headers.prototype.forEach = function(fn) {
|
1090
|
+
this._headersMap.forEach(fn);
|
1091
|
+
};
|
1092
|
+
Headers.prototype.get = function(header) {
|
1093
|
+
return collection_1.ListWrapper.first(this._headersMap.get(header));
|
1094
|
+
};
|
1095
|
+
Headers.prototype.has = function(header) {
|
1096
|
+
return this._headersMap.has(header);
|
1097
|
+
};
|
1098
|
+
Headers.prototype.keys = function() {
|
1099
|
+
return collection_1.MapWrapper.keys(this._headersMap);
|
1100
|
+
};
|
1101
|
+
Headers.prototype.set = function(header, value) {
|
1102
|
+
var list = [];
|
1103
|
+
if (collection_1.isListLikeIterable(value)) {
|
1104
|
+
var pushValue = value.join(',');
|
1105
|
+
list.push(pushValue);
|
1106
|
+
} else {
|
1107
|
+
list.push(value);
|
1108
|
+
}
|
1109
|
+
this._headersMap.set(header, list);
|
1110
|
+
};
|
1111
|
+
Headers.prototype.values = function() {
|
1112
|
+
return collection_1.MapWrapper.values(this._headersMap);
|
1113
|
+
};
|
1114
|
+
Headers.prototype.toJSON = function() {
|
1115
|
+
var serializableHeaders = {};
|
1116
|
+
this._headersMap.forEach(function(values, name) {
|
1117
|
+
var list = [];
|
1118
|
+
collection_1.iterateListLike(values, function(val) {
|
1119
|
+
return list = collection_1.ListWrapper.concat(list, val.split(','));
|
1120
|
+
});
|
1121
|
+
serializableHeaders[name] = list;
|
1122
|
+
});
|
1123
|
+
return serializableHeaders;
|
1124
|
+
};
|
1125
|
+
Headers.prototype.getAll = function(header) {
|
1126
|
+
var headers = this._headersMap.get(header);
|
1127
|
+
return collection_1.isListLikeIterable(headers) ? headers : [];
|
1128
|
+
};
|
1129
|
+
Headers.prototype.entries = function() {
|
1130
|
+
throw new exceptions_1.BaseException('"entries" method is not implemented on Headers class');
|
1131
|
+
};
|
1132
|
+
return Headers;
|
1133
|
+
}());
|
1134
|
+
exports.Headers = Headers;
|
1135
|
+
global.define = __define;
|
1136
|
+
return module.exports;
|
1137
|
+
});
|
1138
|
+
|
1139
|
+
System.register("angular2/src/http/enums", [], true, function(require, exports, module) {
|
1140
|
+
var global = System.global,
|
1141
|
+
__define = global.define;
|
1142
|
+
global.define = undefined;
|
1143
|
+
"use strict";
|
1144
|
+
(function(RequestMethod) {
|
1145
|
+
RequestMethod[RequestMethod["Get"] = 0] = "Get";
|
1146
|
+
RequestMethod[RequestMethod["Post"] = 1] = "Post";
|
1147
|
+
RequestMethod[RequestMethod["Put"] = 2] = "Put";
|
1148
|
+
RequestMethod[RequestMethod["Delete"] = 3] = "Delete";
|
1149
|
+
RequestMethod[RequestMethod["Options"] = 4] = "Options";
|
1150
|
+
RequestMethod[RequestMethod["Head"] = 5] = "Head";
|
1151
|
+
RequestMethod[RequestMethod["Patch"] = 6] = "Patch";
|
1152
|
+
})(exports.RequestMethod || (exports.RequestMethod = {}));
|
1153
|
+
var RequestMethod = exports.RequestMethod;
|
1154
|
+
(function(ReadyState) {
|
1155
|
+
ReadyState[ReadyState["Unsent"] = 0] = "Unsent";
|
1156
|
+
ReadyState[ReadyState["Open"] = 1] = "Open";
|
1157
|
+
ReadyState[ReadyState["HeadersReceived"] = 2] = "HeadersReceived";
|
1158
|
+
ReadyState[ReadyState["Loading"] = 3] = "Loading";
|
1159
|
+
ReadyState[ReadyState["Done"] = 4] = "Done";
|
1160
|
+
ReadyState[ReadyState["Cancelled"] = 5] = "Cancelled";
|
1161
|
+
})(exports.ReadyState || (exports.ReadyState = {}));
|
1162
|
+
var ReadyState = exports.ReadyState;
|
1163
|
+
(function(ResponseType) {
|
1164
|
+
ResponseType[ResponseType["Basic"] = 0] = "Basic";
|
1165
|
+
ResponseType[ResponseType["Cors"] = 1] = "Cors";
|
1166
|
+
ResponseType[ResponseType["Default"] = 2] = "Default";
|
1167
|
+
ResponseType[ResponseType["Error"] = 3] = "Error";
|
1168
|
+
ResponseType[ResponseType["Opaque"] = 4] = "Opaque";
|
1169
|
+
})(exports.ResponseType || (exports.ResponseType = {}));
|
1170
|
+
var ResponseType = exports.ResponseType;
|
1171
|
+
global.define = __define;
|
1172
|
+
return module.exports;
|
1173
|
+
});
|
1174
|
+
|
1175
|
+
System.register("angular2/src/http/http_utils", ["angular2/src/facade/lang", "angular2/src/http/enums", "angular2/src/facade/exceptions", "angular2/src/facade/lang"], true, function(require, exports, module) {
|
1176
|
+
var global = System.global,
|
1177
|
+
__define = global.define;
|
1178
|
+
global.define = undefined;
|
1179
|
+
"use strict";
|
1180
|
+
var lang_1 = require("angular2/src/facade/lang");
|
1181
|
+
var enums_1 = require("angular2/src/http/enums");
|
1182
|
+
var exceptions_1 = require("angular2/src/facade/exceptions");
|
1183
|
+
function normalizeMethodName(method) {
|
1184
|
+
if (lang_1.isString(method)) {
|
1185
|
+
var originalMethod = method;
|
1186
|
+
method = method.replace(/(\w)(\w*)/g, function(g0, g1, g2) {
|
1187
|
+
return g1.toUpperCase() + g2.toLowerCase();
|
1188
|
+
});
|
1189
|
+
method = enums_1.RequestMethod[method];
|
1190
|
+
if (typeof method !== 'number')
|
1191
|
+
throw exceptions_1.makeTypeError("Invalid request method. The method \"" + originalMethod + "\" is not supported.");
|
1192
|
+
}
|
1193
|
+
return method;
|
1194
|
+
}
|
1195
|
+
exports.normalizeMethodName = normalizeMethodName;
|
1196
|
+
exports.isSuccess = function(status) {
|
1197
|
+
return (status >= 200 && status < 300);
|
1198
|
+
};
|
1199
|
+
function getResponseURL(xhr) {
|
1200
|
+
if ('responseURL' in xhr) {
|
1201
|
+
return xhr.responseURL;
|
1202
|
+
}
|
1203
|
+
if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
|
1204
|
+
return xhr.getResponseHeader('X-Request-URL');
|
1205
|
+
}
|
1206
|
+
return ;
|
1207
|
+
}
|
1208
|
+
exports.getResponseURL = getResponseURL;
|
1209
|
+
var lang_2 = require("angular2/src/facade/lang");
|
1210
|
+
exports.isJsObject = lang_2.isJsObject;
|
1211
|
+
global.define = __define;
|
1212
|
+
return module.exports;
|
1213
|
+
});
|
1214
|
+
|
1215
|
+
System.register("angular2/src/http/static_request", ["angular2/src/http/headers", "angular2/src/http/http_utils", "angular2/src/facade/lang"], true, function(require, exports, module) {
|
1216
|
+
var global = System.global,
|
1217
|
+
__define = global.define;
|
1218
|
+
global.define = undefined;
|
1219
|
+
"use strict";
|
1220
|
+
var headers_1 = require("angular2/src/http/headers");
|
1221
|
+
var http_utils_1 = require("angular2/src/http/http_utils");
|
1222
|
+
var lang_1 = require("angular2/src/facade/lang");
|
1223
|
+
var Request = (function() {
|
1224
|
+
function Request(requestOptions) {
|
1225
|
+
var url = requestOptions.url;
|
1226
|
+
this.url = requestOptions.url;
|
1227
|
+
if (lang_1.isPresent(requestOptions.search)) {
|
1228
|
+
var search = requestOptions.search.toString();
|
1229
|
+
if (search.length > 0) {
|
1230
|
+
var prefix = '?';
|
1231
|
+
if (lang_1.StringWrapper.contains(this.url, '?')) {
|
1232
|
+
prefix = (this.url[this.url.length - 1] == '&') ? '' : '&';
|
1233
|
+
}
|
1234
|
+
this.url = url + prefix + search;
|
1235
|
+
}
|
1236
|
+
}
|
1237
|
+
this._body = requestOptions.body;
|
1238
|
+
this.method = http_utils_1.normalizeMethodName(requestOptions.method);
|
1239
|
+
this.headers = new headers_1.Headers(requestOptions.headers);
|
1240
|
+
}
|
1241
|
+
Request.prototype.text = function() {
|
1242
|
+
return lang_1.isPresent(this._body) ? this._body.toString() : '';
|
1243
|
+
};
|
1244
|
+
return Request;
|
1245
|
+
}());
|
1246
|
+
exports.Request = Request;
|
1247
|
+
global.define = __define;
|
1248
|
+
return module.exports;
|
1249
|
+
});
|
1250
|
+
|
1251
|
+
System.register("angular2/src/http/backends/mock_backend", ["angular2/core", "angular2/src/http/static_request", "angular2/src/http/enums", "angular2/src/facade/lang", "angular2/src/facade/exceptions", "rxjs/Subject", "rxjs/subject/ReplaySubject", "rxjs/operator/take"], true, function(require, exports, module) {
|
1252
|
+
var global = System.global,
|
1253
|
+
__define = global.define;
|
1254
|
+
global.define = undefined;
|
1255
|
+
"use strict";
|
1256
|
+
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
1257
|
+
var c = arguments.length,
|
1258
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
1259
|
+
d;
|
1260
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
1261
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
1262
|
+
else
|
1263
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
1264
|
+
if (d = decorators[i])
|
1265
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
1266
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
1267
|
+
};
|
1268
|
+
var __metadata = (this && this.__metadata) || function(k, v) {
|
1269
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
1270
|
+
return Reflect.metadata(k, v);
|
1271
|
+
};
|
1272
|
+
var core_1 = require("angular2/core");
|
1273
|
+
var static_request_1 = require("angular2/src/http/static_request");
|
1274
|
+
var enums_1 = require("angular2/src/http/enums");
|
1275
|
+
var lang_1 = require("angular2/src/facade/lang");
|
1276
|
+
var exceptions_1 = require("angular2/src/facade/exceptions");
|
1277
|
+
var Subject_1 = require("rxjs/Subject");
|
1278
|
+
var ReplaySubject_1 = require("rxjs/subject/ReplaySubject");
|
1279
|
+
var take_1 = require("rxjs/operator/take");
|
1280
|
+
var MockConnection = (function() {
|
1281
|
+
function MockConnection(req) {
|
1282
|
+
this.response = take_1.take.call(new ReplaySubject_1.ReplaySubject(1), 1);
|
1283
|
+
this.readyState = enums_1.ReadyState.Open;
|
1284
|
+
this.request = req;
|
1285
|
+
}
|
1286
|
+
MockConnection.prototype.mockRespond = function(res) {
|
1287
|
+
if (this.readyState === enums_1.ReadyState.Done || this.readyState === enums_1.ReadyState.Cancelled) {
|
1288
|
+
throw new exceptions_1.BaseException('Connection has already been resolved');
|
1289
|
+
}
|
1290
|
+
this.readyState = enums_1.ReadyState.Done;
|
1291
|
+
this.response.next(res);
|
1292
|
+
this.response.complete();
|
1293
|
+
};
|
1294
|
+
MockConnection.prototype.mockDownload = function(res) {};
|
1295
|
+
MockConnection.prototype.mockError = function(err) {
|
1296
|
+
this.readyState = enums_1.ReadyState.Done;
|
1297
|
+
this.response.error(err);
|
1298
|
+
};
|
1299
|
+
return MockConnection;
|
1300
|
+
}());
|
1301
|
+
exports.MockConnection = MockConnection;
|
1302
|
+
var MockBackend = (function() {
|
1303
|
+
function MockBackend() {
|
1304
|
+
var _this = this;
|
1305
|
+
this.connectionsArray = [];
|
1306
|
+
this.connections = new Subject_1.Subject();
|
1307
|
+
this.connections.subscribe(function(connection) {
|
1308
|
+
return _this.connectionsArray.push(connection);
|
1309
|
+
});
|
1310
|
+
this.pendingConnections = new Subject_1.Subject();
|
1311
|
+
}
|
1312
|
+
MockBackend.prototype.verifyNoPendingRequests = function() {
|
1313
|
+
var pending = 0;
|
1314
|
+
this.pendingConnections.subscribe(function(c) {
|
1315
|
+
return pending++;
|
1316
|
+
});
|
1317
|
+
if (pending > 0)
|
1318
|
+
throw new exceptions_1.BaseException(pending + " pending connections to be resolved");
|
1319
|
+
};
|
1320
|
+
MockBackend.prototype.resolveAllConnections = function() {
|
1321
|
+
this.connections.subscribe(function(c) {
|
1322
|
+
return c.readyState = 4;
|
1323
|
+
});
|
1324
|
+
};
|
1325
|
+
MockBackend.prototype.createConnection = function(req) {
|
1326
|
+
if (!lang_1.isPresent(req) || !(req instanceof static_request_1.Request)) {
|
1327
|
+
throw new exceptions_1.BaseException("createConnection requires an instance of Request, got " + req);
|
1328
|
+
}
|
1329
|
+
var connection = new MockConnection(req);
|
1330
|
+
this.connections.next(connection);
|
1331
|
+
return connection;
|
1332
|
+
};
|
1333
|
+
MockBackend = __decorate([core_1.Injectable(), __metadata('design:paramtypes', [])], MockBackend);
|
1334
|
+
return MockBackend;
|
1335
|
+
}());
|
1336
|
+
exports.MockBackend = MockBackend;
|
1337
|
+
global.define = __define;
|
1338
|
+
return module.exports;
|
1339
|
+
});
|
1340
|
+
|
1341
|
+
System.register("angular2/http/testing", ["angular2/src/http/backends/mock_backend"], true, function(require, exports, module) {
|
1342
|
+
var global = System.global,
|
1343
|
+
__define = global.define;
|
1344
|
+
global.define = undefined;
|
1345
|
+
"use strict";
|
1346
|
+
function __export(m) {
|
1347
|
+
for (var p in m)
|
1348
|
+
if (!exports.hasOwnProperty(p))
|
1349
|
+
exports[p] = m[p];
|
1350
|
+
}
|
1351
|
+
__export(require("angular2/src/http/backends/mock_backend"));
|
1352
|
+
global.define = __define;
|
1353
|
+
return module.exports;
|
1354
|
+
});
|
1355
|
+
|
1356
|
+
System.register("angular2/src/testing/fake_async", ["angular2/src/facade/lang", "angular2/src/facade/exceptions", "angular2/src/facade/collection"], true, function(require, exports, module) {
|
1357
|
+
var global = System.global,
|
1358
|
+
__define = global.define;
|
1359
|
+
global.define = undefined;
|
1360
|
+
"use strict";
|
1361
|
+
var lang_1 = require("angular2/src/facade/lang");
|
1362
|
+
var exceptions_1 = require("angular2/src/facade/exceptions");
|
1363
|
+
var collection_1 = require("angular2/src/facade/collection");
|
1364
|
+
var _scheduler;
|
1365
|
+
var _microtasks = [];
|
1366
|
+
var _pendingPeriodicTimers = [];
|
1367
|
+
var _pendingTimers = [];
|
1368
|
+
var FakeAsyncZoneSpec = (function() {
|
1369
|
+
function FakeAsyncZoneSpec() {
|
1370
|
+
this.name = 'fakeAsync';
|
1371
|
+
this.properties = {'inFakeAsyncZone': true};
|
1372
|
+
}
|
1373
|
+
FakeAsyncZoneSpec.assertInZone = function() {
|
1374
|
+
if (!Zone.current.get('inFakeAsyncZone')) {
|
1375
|
+
throw new Error('The code should be running in the fakeAsync zone to call this function');
|
1376
|
+
}
|
1377
|
+
};
|
1378
|
+
FakeAsyncZoneSpec.prototype.onScheduleTask = function(delegate, current, target, task) {
|
1379
|
+
switch (task.type) {
|
1380
|
+
case 'microTask':
|
1381
|
+
_microtasks.push(task.invoke);
|
1382
|
+
break;
|
1383
|
+
case 'macroTask':
|
1384
|
+
switch (task.source) {
|
1385
|
+
case 'setTimeout':
|
1386
|
+
task.data['handleId'] = _setTimeout(task.invoke, task.data['delay'], task.data['args']);
|
1387
|
+
break;
|
1388
|
+
case 'setInterval':
|
1389
|
+
task.data['handleId'] = _setInterval(task.invoke, task.data['delay'], task.data['args']);
|
1390
|
+
break;
|
1391
|
+
default:
|
1392
|
+
task = delegate.scheduleTask(target, task);
|
1393
|
+
}
|
1394
|
+
break;
|
1395
|
+
case 'eventTask':
|
1396
|
+
task = delegate.scheduleTask(target, task);
|
1397
|
+
break;
|
1398
|
+
}
|
1399
|
+
return task;
|
1400
|
+
};
|
1401
|
+
FakeAsyncZoneSpec.prototype.onCancelTask = function(delegate, current, target, task) {
|
1402
|
+
switch (task.source) {
|
1403
|
+
case 'setTimeout':
|
1404
|
+
return _clearTimeout(task.data['handleId']);
|
1405
|
+
case 'setInterval':
|
1406
|
+
return _clearInterval(task.data['handleId']);
|
1407
|
+
default:
|
1408
|
+
return delegate.scheduleTask(target, task);
|
1409
|
+
}
|
1410
|
+
};
|
1411
|
+
return FakeAsyncZoneSpec;
|
1412
|
+
}());
|
1413
|
+
function fakeAsync(fn) {
|
1414
|
+
if (Zone.current.get('inFakeAsyncZone')) {
|
1415
|
+
throw new Error('fakeAsync() calls can not be nested');
|
1416
|
+
}
|
1417
|
+
var fakeAsyncZone = Zone.current.fork(new FakeAsyncZoneSpec());
|
1418
|
+
return function() {
|
1419
|
+
var args = [];
|
1420
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
1421
|
+
args[_i - 0] = arguments[_i];
|
1422
|
+
}
|
1423
|
+
_scheduler = new jasmine.DelayedFunctionScheduler();
|
1424
|
+
clearPendingTimers();
|
1425
|
+
var res = fakeAsyncZone.run(function() {
|
1426
|
+
var res = fn.apply(void 0, args);
|
1427
|
+
flushMicrotasks();
|
1428
|
+
return res;
|
1429
|
+
});
|
1430
|
+
if (_pendingPeriodicTimers.length > 0) {
|
1431
|
+
throw new exceptions_1.BaseException(_pendingPeriodicTimers.length + " periodic timer(s) still in the queue.");
|
1432
|
+
}
|
1433
|
+
if (_pendingTimers.length > 0) {
|
1434
|
+
throw new exceptions_1.BaseException(_pendingTimers.length + " timer(s) still in the queue.");
|
1435
|
+
}
|
1436
|
+
_scheduler = null;
|
1437
|
+
collection_1.ListWrapper.clear(_microtasks);
|
1438
|
+
return res;
|
1439
|
+
};
|
1440
|
+
}
|
1441
|
+
exports.fakeAsync = fakeAsync;
|
1442
|
+
function clearPendingTimers() {
|
1443
|
+
collection_1.ListWrapper.clear(_microtasks);
|
1444
|
+
collection_1.ListWrapper.clear(_pendingPeriodicTimers);
|
1445
|
+
collection_1.ListWrapper.clear(_pendingTimers);
|
1446
|
+
}
|
1447
|
+
exports.clearPendingTimers = clearPendingTimers;
|
1448
|
+
function tick(millis) {
|
1449
|
+
if (millis === void 0) {
|
1450
|
+
millis = 0;
|
1451
|
+
}
|
1452
|
+
FakeAsyncZoneSpec.assertInZone();
|
1453
|
+
flushMicrotasks();
|
1454
|
+
_scheduler.tick(millis);
|
1455
|
+
}
|
1456
|
+
exports.tick = tick;
|
1457
|
+
function flushMicrotasks() {
|
1458
|
+
FakeAsyncZoneSpec.assertInZone();
|
1459
|
+
while (_microtasks.length > 0) {
|
1460
|
+
var microtask = collection_1.ListWrapper.removeAt(_microtasks, 0);
|
1461
|
+
microtask();
|
1462
|
+
}
|
1463
|
+
}
|
1464
|
+
exports.flushMicrotasks = flushMicrotasks;
|
1465
|
+
function _setTimeout(fn, delay, args) {
|
1466
|
+
var cb = _fnAndFlush(fn);
|
1467
|
+
var id = _scheduler.scheduleFunction(cb, delay, args);
|
1468
|
+
_pendingTimers.push(id);
|
1469
|
+
_scheduler.scheduleFunction(_dequeueTimer(id), delay);
|
1470
|
+
return id;
|
1471
|
+
}
|
1472
|
+
function _clearTimeout(id) {
|
1473
|
+
_dequeueTimer(id);
|
1474
|
+
return _scheduler.removeFunctionWithId(id);
|
1475
|
+
}
|
1476
|
+
function _setInterval(fn, interval) {
|
1477
|
+
var args = [];
|
1478
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
1479
|
+
args[_i - 2] = arguments[_i];
|
1480
|
+
}
|
1481
|
+
var cb = _fnAndFlush(fn);
|
1482
|
+
var id = _scheduler.scheduleFunction(cb, interval, args, true);
|
1483
|
+
_pendingPeriodicTimers.push(id);
|
1484
|
+
return id;
|
1485
|
+
}
|
1486
|
+
function _clearInterval(id) {
|
1487
|
+
collection_1.ListWrapper.remove(_pendingPeriodicTimers, id);
|
1488
|
+
return _scheduler.removeFunctionWithId(id);
|
1489
|
+
}
|
1490
|
+
function _fnAndFlush(fn) {
|
1491
|
+
return function() {
|
1492
|
+
var args = [];
|
1493
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
1494
|
+
args[_i - 0] = arguments[_i];
|
1495
|
+
}
|
1496
|
+
fn.apply(lang_1.global, args);
|
1497
|
+
flushMicrotasks();
|
1498
|
+
};
|
1499
|
+
}
|
1500
|
+
function _dequeueTimer(id) {
|
1501
|
+
return function() {
|
1502
|
+
collection_1.ListWrapper.remove(_pendingTimers, id);
|
1503
|
+
};
|
1504
|
+
}
|
1505
|
+
global.define = __define;
|
1506
|
+
return module.exports;
|
1507
|
+
});
|
1508
|
+
|
1509
|
+
System.register("angular2/src/mock/mock_application_ref", ["angular2/src/core/application_ref", "angular2/src/core/di"], true, function(require, exports, module) {
|
1510
|
+
var global = System.global,
|
1511
|
+
__define = global.define;
|
1512
|
+
global.define = undefined;
|
1513
|
+
"use strict";
|
1514
|
+
var __extends = (this && this.__extends) || function(d, b) {
|
1515
|
+
for (var p in b)
|
1516
|
+
if (b.hasOwnProperty(p))
|
1517
|
+
d[p] = b[p];
|
1518
|
+
function __() {
|
1519
|
+
this.constructor = d;
|
1520
|
+
}
|
1521
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1522
|
+
};
|
1523
|
+
var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
1524
|
+
var c = arguments.length,
|
1525
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
1526
|
+
d;
|
1527
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
1528
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
1529
|
+
else
|
1530
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
1531
|
+
if (d = decorators[i])
|
1532
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
1533
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
1534
|
+
};
|
1535
|
+
var __metadata = (this && this.__metadata) || function(k, v) {
|
1536
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
1537
|
+
return Reflect.metadata(k, v);
|
1538
|
+
};
|
1539
|
+
var application_ref_1 = require("angular2/src/core/application_ref");
|
1540
|
+
var di_1 = require("angular2/src/core/di");
|
1541
|
+
var MockApplicationRef = (function(_super) {
|
1542
|
+
__extends(MockApplicationRef, _super);
|
1543
|
+
function MockApplicationRef() {
|
1544
|
+
_super.apply(this, arguments);
|
1545
|
+
}
|
1546
|
+
MockApplicationRef.prototype.registerBootstrapListener = function(listener) {};
|
1547
|
+
MockApplicationRef.prototype.registerDisposeListener = function(dispose) {};
|
1548
|
+
MockApplicationRef.prototype.bootstrap = function(componentType, bindings) {
|
1549
|
+
return null;
|
1550
|
+
};
|
1551
|
+
Object.defineProperty(MockApplicationRef.prototype, "injector", {
|
1552
|
+
get: function() {
|
1553
|
+
return null;
|
1554
|
+
},
|
1555
|
+
enumerable: true,
|
1556
|
+
configurable: true
|
1557
|
+
});
|
1558
|
+
;
|
1559
|
+
Object.defineProperty(MockApplicationRef.prototype, "zone", {
|
1560
|
+
get: function() {
|
1561
|
+
return null;
|
1562
|
+
},
|
1563
|
+
enumerable: true,
|
1564
|
+
configurable: true
|
1565
|
+
});
|
1566
|
+
;
|
1567
|
+
MockApplicationRef.prototype.dispose = function() {};
|
1568
|
+
MockApplicationRef.prototype.tick = function() {};
|
1569
|
+
Object.defineProperty(MockApplicationRef.prototype, "componentTypes", {
|
1570
|
+
get: function() {
|
1571
|
+
return null;
|
1572
|
+
},
|
1573
|
+
enumerable: true,
|
1574
|
+
configurable: true
|
1575
|
+
});
|
1576
|
+
;
|
1577
|
+
MockApplicationRef = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockApplicationRef);
|
1578
|
+
return MockApplicationRef;
|
1579
|
+
}(application_ref_1.ApplicationRef));
|
1580
|
+
exports.MockApplicationRef = MockApplicationRef;
|
1581
|
+
global.define = __define;
|
1582
|
+
return module.exports;
|
1583
|
+
});
|
1584
|
+
|
1585
|
+
System.register("angular2/src/testing/matchers", ["angular2/src/platform/dom/dom_adapter", "angular2/src/facade/lang", "angular2/src/facade/collection"], true, function(require, exports, module) {
|
1586
|
+
var global = System.global,
|
1587
|
+
__define = global.define;
|
1588
|
+
global.define = undefined;
|
1589
|
+
"use strict";
|
1590
|
+
var dom_adapter_1 = require("angular2/src/platform/dom/dom_adapter");
|
1591
|
+
var lang_1 = require("angular2/src/facade/lang");
|
1592
|
+
var collection_1 = require("angular2/src/facade/collection");
|
1593
|
+
var _global = (typeof window === 'undefined' ? lang_1.global : window);
|
1594
|
+
exports.expect = _global.expect;
|
1595
|
+
Map.prototype['jasmineToString'] = function() {
|
1596
|
+
var m = this;
|
1597
|
+
if (!m) {
|
1598
|
+
return '' + m;
|
1599
|
+
}
|
1600
|
+
var res = [];
|
1601
|
+
m.forEach(function(v, k) {
|
1602
|
+
res.push(k + ":" + v);
|
1603
|
+
});
|
1604
|
+
return "{ " + res.join(',') + " }";
|
1605
|
+
};
|
1606
|
+
_global.beforeEach(function() {
|
1607
|
+
jasmine.addMatchers({
|
1608
|
+
toEqual: function(util, customEqualityTesters) {
|
1609
|
+
return {compare: function(actual, expected) {
|
1610
|
+
return {pass: util.equals(actual, expected, [compareMap])};
|
1611
|
+
}};
|
1612
|
+
function compareMap(actual, expected) {
|
1613
|
+
if (actual instanceof Map) {
|
1614
|
+
var pass = actual.size === expected.size;
|
1615
|
+
if (pass) {
|
1616
|
+
actual.forEach(function(v, k) {
|
1617
|
+
pass = pass && util.equals(v, expected.get(k));
|
1618
|
+
});
|
1619
|
+
}
|
1620
|
+
return pass;
|
1621
|
+
} else {
|
1622
|
+
return undefined;
|
1623
|
+
}
|
1624
|
+
}
|
1625
|
+
},
|
1626
|
+
toBePromise: function() {
|
1627
|
+
return {compare: function(actual, expectedClass) {
|
1628
|
+
var pass = typeof actual === 'object' && typeof actual.then === 'function';
|
1629
|
+
return {
|
1630
|
+
pass: pass,
|
1631
|
+
get message() {
|
1632
|
+
return 'Expected ' + actual + ' to be a promise';
|
1633
|
+
}
|
1634
|
+
};
|
1635
|
+
}};
|
1636
|
+
},
|
1637
|
+
toBeAnInstanceOf: function() {
|
1638
|
+
return {compare: function(actual, expectedClass) {
|
1639
|
+
var pass = typeof actual === 'object' && actual instanceof expectedClass;
|
1640
|
+
return {
|
1641
|
+
pass: pass,
|
1642
|
+
get message() {
|
1643
|
+
return 'Expected ' + actual + ' to be an instance of ' + expectedClass;
|
1644
|
+
}
|
1645
|
+
};
|
1646
|
+
}};
|
1647
|
+
},
|
1648
|
+
toHaveText: function() {
|
1649
|
+
return {compare: function(actual, expectedText) {
|
1650
|
+
var actualText = elementText(actual);
|
1651
|
+
return {
|
1652
|
+
pass: actualText == expectedText,
|
1653
|
+
get message() {
|
1654
|
+
return 'Expected ' + actualText + ' to be equal to ' + expectedText;
|
1655
|
+
}
|
1656
|
+
};
|
1657
|
+
}};
|
1658
|
+
},
|
1659
|
+
toHaveCssClass: function() {
|
1660
|
+
return {
|
1661
|
+
compare: buildError(false),
|
1662
|
+
negativeCompare: buildError(true)
|
1663
|
+
};
|
1664
|
+
function buildError(isNot) {
|
1665
|
+
return function(actual, className) {
|
1666
|
+
return {
|
1667
|
+
pass: dom_adapter_1.DOM.hasClass(actual, className) == !isNot,
|
1668
|
+
get message() {
|
1669
|
+
return "Expected " + actual.outerHTML + " " + (isNot ? 'not ' : '') + "to contain the CSS class \"" + className + "\"";
|
1670
|
+
}
|
1671
|
+
};
|
1672
|
+
};
|
1673
|
+
}
|
1674
|
+
},
|
1675
|
+
toHaveCssStyle: function() {
|
1676
|
+
return {compare: function(actual, styles) {
|
1677
|
+
var allPassed;
|
1678
|
+
if (lang_1.isString(styles)) {
|
1679
|
+
allPassed = dom_adapter_1.DOM.hasStyle(actual, styles);
|
1680
|
+
} else {
|
1681
|
+
allPassed = !collection_1.StringMapWrapper.isEmpty(styles);
|
1682
|
+
collection_1.StringMapWrapper.forEach(styles, function(style, prop) {
|
1683
|
+
allPassed = allPassed && dom_adapter_1.DOM.hasStyle(actual, prop, style);
|
1684
|
+
});
|
1685
|
+
}
|
1686
|
+
return {
|
1687
|
+
pass: allPassed,
|
1688
|
+
get message() {
|
1689
|
+
var expectedValueStr = lang_1.isString(styles) ? styles : JSON.stringify(styles);
|
1690
|
+
return "Expected " + actual.outerHTML + " " + (!allPassed ? ' ' : 'not ') + "to contain the\n CSS " + (lang_1.isString(styles) ? 'property' : 'styles') + " \"" + expectedValueStr + "\"";
|
1691
|
+
}
|
1692
|
+
};
|
1693
|
+
}};
|
1694
|
+
},
|
1695
|
+
toContainError: function() {
|
1696
|
+
return {compare: function(actual, expectedText) {
|
1697
|
+
var errorMessage = actual.toString();
|
1698
|
+
return {
|
1699
|
+
pass: errorMessage.indexOf(expectedText) > -1,
|
1700
|
+
get message() {
|
1701
|
+
return 'Expected ' + errorMessage + ' to contain ' + expectedText;
|
1702
|
+
}
|
1703
|
+
};
|
1704
|
+
}};
|
1705
|
+
},
|
1706
|
+
toThrowErrorWith: function() {
|
1707
|
+
return {compare: function(actual, expectedText) {
|
1708
|
+
try {
|
1709
|
+
actual();
|
1710
|
+
return {
|
1711
|
+
pass: false,
|
1712
|
+
get message() {
|
1713
|
+
return "Was expected to throw, but did not throw";
|
1714
|
+
}
|
1715
|
+
};
|
1716
|
+
} catch (e) {
|
1717
|
+
var errorMessage = e.toString();
|
1718
|
+
return {
|
1719
|
+
pass: errorMessage.indexOf(expectedText) > -1,
|
1720
|
+
get message() {
|
1721
|
+
return 'Expected ' + errorMessage + ' to contain ' + expectedText;
|
1722
|
+
}
|
1723
|
+
};
|
1724
|
+
}
|
1725
|
+
}};
|
1726
|
+
},
|
1727
|
+
toMatchPattern: function() {
|
1728
|
+
return {
|
1729
|
+
compare: buildError(false),
|
1730
|
+
negativeCompare: buildError(true)
|
1731
|
+
};
|
1732
|
+
function buildError(isNot) {
|
1733
|
+
return function(actual, regex) {
|
1734
|
+
return {
|
1735
|
+
pass: regex.test(actual) == !isNot,
|
1736
|
+
get message() {
|
1737
|
+
return "Expected " + actual + " " + (isNot ? 'not ' : '') + "to match " + regex.toString();
|
1738
|
+
}
|
1739
|
+
};
|
1740
|
+
};
|
1741
|
+
}
|
1742
|
+
},
|
1743
|
+
toImplement: function() {
|
1744
|
+
return {compare: function(actualObject, expectedInterface) {
|
1745
|
+
var objProps = Object.keys(actualObject.constructor.prototype);
|
1746
|
+
var intProps = Object.keys(expectedInterface.prototype);
|
1747
|
+
var missedMethods = [];
|
1748
|
+
intProps.forEach(function(k) {
|
1749
|
+
if (!actualObject.constructor.prototype[k])
|
1750
|
+
missedMethods.push(k);
|
1751
|
+
});
|
1752
|
+
return {
|
1753
|
+
pass: missedMethods.length == 0,
|
1754
|
+
get message() {
|
1755
|
+
return 'Expected ' + actualObject + ' to have the following methods: ' + missedMethods.join(", ");
|
1756
|
+
}
|
1757
|
+
};
|
1758
|
+
}};
|
1759
|
+
}
|
1760
|
+
});
|
1761
|
+
});
|
1762
|
+
function elementText(n) {
|
1763
|
+
var hasNodes = function(n) {
|
1764
|
+
var children = dom_adapter_1.DOM.childNodes(n);
|
1765
|
+
return children && children.length > 0;
|
1766
|
+
};
|
1767
|
+
if (n instanceof Array) {
|
1768
|
+
return n.map(elementText).join("");
|
1769
|
+
}
|
1770
|
+
if (dom_adapter_1.DOM.isCommentNode(n)) {
|
1771
|
+
return '';
|
1772
|
+
}
|
1773
|
+
if (dom_adapter_1.DOM.isElementNode(n) && dom_adapter_1.DOM.tagName(n) == 'CONTENT') {
|
1774
|
+
return elementText(Array.prototype.slice.apply(dom_adapter_1.DOM.getDistributedNodes(n)));
|
1775
|
+
}
|
1776
|
+
if (dom_adapter_1.DOM.hasShadowRoot(n)) {
|
1777
|
+
return elementText(dom_adapter_1.DOM.childNodesAsList(dom_adapter_1.DOM.getShadowRoot(n)));
|
1778
|
+
}
|
1779
|
+
if (hasNodes(n)) {
|
1780
|
+
return elementText(dom_adapter_1.DOM.childNodesAsList(n));
|
1781
|
+
}
|
1782
|
+
return dom_adapter_1.DOM.getText(n);
|
1783
|
+
}
|
1784
|
+
global.define = __define;
|
1785
|
+
return module.exports;
|
1786
|
+
});
|
1787
|
+
|
1788
|
+
System.register("angular2/src/compiler/xhr_mock", ["angular2/src/compiler/xhr", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/facade/exceptions", "angular2/src/facade/async"], true, function(require, exports, module) {
|
1789
|
+
var global = System.global,
|
1790
|
+
__define = global.define;
|
1791
|
+
global.define = undefined;
|
1792
|
+
"use strict";
|
1793
|
+
var __extends = (this && this.__extends) || function(d, b) {
|
1794
|
+
for (var p in b)
|
1795
|
+
if (b.hasOwnProperty(p))
|
1796
|
+
d[p] = b[p];
|
1797
|
+
function __() {
|
1798
|
+
this.constructor = d;
|
1799
|
+
}
|
1800
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1801
|
+
};
|
1802
|
+
var xhr_1 = require("angular2/src/compiler/xhr");
|
1803
|
+
var collection_1 = require("angular2/src/facade/collection");
|
1804
|
+
var lang_1 = require("angular2/src/facade/lang");
|
1805
|
+
var exceptions_1 = require("angular2/src/facade/exceptions");
|
1806
|
+
var async_1 = require("angular2/src/facade/async");
|
1807
|
+
var MockXHR = (function(_super) {
|
1808
|
+
__extends(MockXHR, _super);
|
1809
|
+
function MockXHR() {
|
1810
|
+
_super.apply(this, arguments);
|
1811
|
+
this._expectations = [];
|
1812
|
+
this._definitions = new collection_1.Map();
|
1813
|
+
this._requests = [];
|
1814
|
+
}
|
1815
|
+
MockXHR.prototype.get = function(url) {
|
1816
|
+
var request = new _PendingRequest(url);
|
1817
|
+
this._requests.push(request);
|
1818
|
+
return request.getPromise();
|
1819
|
+
};
|
1820
|
+
MockXHR.prototype.expect = function(url, response) {
|
1821
|
+
var expectation = new _Expectation(url, response);
|
1822
|
+
this._expectations.push(expectation);
|
1823
|
+
};
|
1824
|
+
MockXHR.prototype.when = function(url, response) {
|
1825
|
+
this._definitions.set(url, response);
|
1826
|
+
};
|
1827
|
+
MockXHR.prototype.flush = function() {
|
1828
|
+
if (this._requests.length === 0) {
|
1829
|
+
throw new exceptions_1.BaseException('No pending requests to flush');
|
1830
|
+
}
|
1831
|
+
do {
|
1832
|
+
this._processRequest(this._requests.shift());
|
1833
|
+
} while (this._requests.length > 0);
|
1834
|
+
this.verifyNoOutstandingExpectations();
|
1835
|
+
};
|
1836
|
+
MockXHR.prototype.verifyNoOutstandingExpectations = function() {
|
1837
|
+
if (this._expectations.length === 0)
|
1838
|
+
return ;
|
1839
|
+
var urls = [];
|
1840
|
+
for (var i = 0; i < this._expectations.length; i++) {
|
1841
|
+
var expectation = this._expectations[i];
|
1842
|
+
urls.push(expectation.url);
|
1843
|
+
}
|
1844
|
+
throw new exceptions_1.BaseException("Unsatisfied requests: " + urls.join(', '));
|
1845
|
+
};
|
1846
|
+
MockXHR.prototype._processRequest = function(request) {
|
1847
|
+
var url = request.url;
|
1848
|
+
if (this._expectations.length > 0) {
|
1849
|
+
var expectation = this._expectations[0];
|
1850
|
+
if (expectation.url == url) {
|
1851
|
+
collection_1.ListWrapper.remove(this._expectations, expectation);
|
1852
|
+
request.complete(expectation.response);
|
1853
|
+
return ;
|
1854
|
+
}
|
1855
|
+
}
|
1856
|
+
if (this._definitions.has(url)) {
|
1857
|
+
var response = this._definitions.get(url);
|
1858
|
+
request.complete(lang_1.normalizeBlank(response));
|
1859
|
+
return ;
|
1860
|
+
}
|
1861
|
+
throw new exceptions_1.BaseException("Unexpected request " + url);
|
1862
|
+
};
|
1863
|
+
return MockXHR;
|
1864
|
+
}(xhr_1.XHR));
|
1865
|
+
exports.MockXHR = MockXHR;
|
1866
|
+
var _PendingRequest = (function() {
|
1867
|
+
function _PendingRequest(url) {
|
1868
|
+
this.url = url;
|
1869
|
+
this.completer = async_1.PromiseWrapper.completer();
|
1870
|
+
}
|
1871
|
+
_PendingRequest.prototype.complete = function(response) {
|
1872
|
+
if (lang_1.isBlank(response)) {
|
1873
|
+
this.completer.reject("Failed to load " + this.url, null);
|
1874
|
+
} else {
|
1875
|
+
this.completer.resolve(response);
|
1876
|
+
}
|
1877
|
+
};
|
1878
|
+
_PendingRequest.prototype.getPromise = function() {
|
1879
|
+
return this.completer.promise;
|
1880
|
+
};
|
1881
|
+
return _PendingRequest;
|
1882
|
+
}());
|
1883
|
+
var _Expectation = (function() {
|
1884
|
+
function _Expectation(url, response) {
|
1885
|
+
this.url = url;
|
1886
|
+
this.response = response;
|
1887
|
+
}
|
1888
|
+
return _Expectation;
|
1889
|
+
}());
|
1890
|
+
global.define = __define;
|
1891
|
+
return module.exports;
|
1892
|
+
});
|
1893
|
+
|
1894
|
+
System.register("angular2/src/testing/test_injector", ["angular2/core", "angular2/src/facade/exceptions", "angular2/src/facade/collection", "angular2/src/facade/lang"], true, function(require, exports, module) {
|
1895
|
+
var global = System.global,
|
1896
|
+
__define = global.define;
|
1897
|
+
global.define = undefined;
|
1898
|
+
"use strict";
|
1899
|
+
var core_1 = require("angular2/core");
|
1900
|
+
var exceptions_1 = require("angular2/src/facade/exceptions");
|
1901
|
+
var collection_1 = require("angular2/src/facade/collection");
|
1902
|
+
var lang_1 = require("angular2/src/facade/lang");
|
1903
|
+
var TestInjector = (function() {
|
1904
|
+
function TestInjector() {
|
1905
|
+
this._instantiated = false;
|
1906
|
+
this._injector = null;
|
1907
|
+
this._providers = [];
|
1908
|
+
this.platformProviders = [];
|
1909
|
+
this.applicationProviders = [];
|
1910
|
+
}
|
1911
|
+
TestInjector.prototype.reset = function() {
|
1912
|
+
this._injector = null;
|
1913
|
+
this._providers = [];
|
1914
|
+
this._instantiated = false;
|
1915
|
+
};
|
1916
|
+
TestInjector.prototype.addProviders = function(providers) {
|
1917
|
+
if (this._instantiated) {
|
1918
|
+
throw new exceptions_1.BaseException('Cannot add providers after test injector is instantiated');
|
1919
|
+
}
|
1920
|
+
this._providers = collection_1.ListWrapper.concat(this._providers, providers);
|
1921
|
+
};
|
1922
|
+
TestInjector.prototype.createInjector = function() {
|
1923
|
+
var rootInjector = core_1.Injector.resolveAndCreate(this.platformProviders);
|
1924
|
+
this._injector = rootInjector.resolveAndCreateChild(collection_1.ListWrapper.concat(this.applicationProviders, this._providers));
|
1925
|
+
this._instantiated = true;
|
1926
|
+
return this._injector;
|
1927
|
+
};
|
1928
|
+
TestInjector.prototype.execute = function(fn) {
|
1929
|
+
var additionalProviders = fn.additionalProviders();
|
1930
|
+
if (additionalProviders.length > 0) {
|
1931
|
+
this.addProviders(additionalProviders);
|
1932
|
+
}
|
1933
|
+
if (!this._instantiated) {
|
1934
|
+
this.createInjector();
|
1935
|
+
}
|
1936
|
+
return fn.execute(this._injector);
|
1937
|
+
};
|
1938
|
+
return TestInjector;
|
1939
|
+
}());
|
1940
|
+
exports.TestInjector = TestInjector;
|
1941
|
+
var _testInjector = null;
|
1942
|
+
function getTestInjector() {
|
1943
|
+
if (_testInjector == null) {
|
1944
|
+
_testInjector = new TestInjector();
|
1945
|
+
}
|
1946
|
+
return _testInjector;
|
1947
|
+
}
|
1948
|
+
exports.getTestInjector = getTestInjector;
|
1949
|
+
function setBaseTestProviders(platformProviders, applicationProviders) {
|
1950
|
+
var testInjector = getTestInjector();
|
1951
|
+
if (testInjector.platformProviders.length > 0 || testInjector.applicationProviders.length > 0) {
|
1952
|
+
throw new exceptions_1.BaseException('Cannot set base providers because it has already been called');
|
1953
|
+
}
|
1954
|
+
testInjector.platformProviders = platformProviders;
|
1955
|
+
testInjector.applicationProviders = applicationProviders;
|
1956
|
+
var injector = testInjector.createInjector();
|
1957
|
+
var inits = injector.getOptional(core_1.PLATFORM_INITIALIZER);
|
1958
|
+
if (lang_1.isPresent(inits)) {
|
1959
|
+
inits.forEach(function(init) {
|
1960
|
+
return init();
|
1961
|
+
});
|
1962
|
+
}
|
1963
|
+
testInjector.reset();
|
1964
|
+
}
|
1965
|
+
exports.setBaseTestProviders = setBaseTestProviders;
|
1966
|
+
function resetBaseTestProviders() {
|
1967
|
+
var testInjector = getTestInjector();
|
1968
|
+
testInjector.platformProviders = [];
|
1969
|
+
testInjector.applicationProviders = [];
|
1970
|
+
testInjector.reset();
|
1971
|
+
}
|
1972
|
+
exports.resetBaseTestProviders = resetBaseTestProviders;
|
1973
|
+
function inject(tokens, fn) {
|
1974
|
+
return new FunctionWithParamTokens(tokens, fn, false);
|
1975
|
+
}
|
1976
|
+
exports.inject = inject;
|
1977
|
+
var InjectSetupWrapper = (function() {
|
1978
|
+
function InjectSetupWrapper(_providers) {
|
1979
|
+
this._providers = _providers;
|
1980
|
+
}
|
1981
|
+
InjectSetupWrapper.prototype.inject = function(tokens, fn) {
|
1982
|
+
return new FunctionWithParamTokens(tokens, fn, false, this._providers);
|
1983
|
+
};
|
1984
|
+
InjectSetupWrapper.prototype.injectAsync = function(tokens, fn) {
|
1985
|
+
return new FunctionWithParamTokens(tokens, fn, true, this._providers);
|
1986
|
+
};
|
1987
|
+
return InjectSetupWrapper;
|
1988
|
+
}());
|
1989
|
+
exports.InjectSetupWrapper = InjectSetupWrapper;
|
1990
|
+
function withProviders(providers) {
|
1991
|
+
return new InjectSetupWrapper(providers);
|
1992
|
+
}
|
1993
|
+
exports.withProviders = withProviders;
|
1994
|
+
function injectAsync(tokens, fn) {
|
1995
|
+
return new FunctionWithParamTokens(tokens, fn, true);
|
1996
|
+
}
|
1997
|
+
exports.injectAsync = injectAsync;
|
1998
|
+
function emptyArray() {
|
1999
|
+
return [];
|
2000
|
+
}
|
2001
|
+
var FunctionWithParamTokens = (function() {
|
2002
|
+
function FunctionWithParamTokens(_tokens, _fn, isAsync, additionalProviders) {
|
2003
|
+
if (additionalProviders === void 0) {
|
2004
|
+
additionalProviders = emptyArray;
|
2005
|
+
}
|
2006
|
+
this._tokens = _tokens;
|
2007
|
+
this._fn = _fn;
|
2008
|
+
this.isAsync = isAsync;
|
2009
|
+
this.additionalProviders = additionalProviders;
|
2010
|
+
}
|
2011
|
+
FunctionWithParamTokens.prototype.execute = function(injector) {
|
2012
|
+
var params = this._tokens.map(function(t) {
|
2013
|
+
return injector.get(t);
|
2014
|
+
});
|
2015
|
+
return lang_1.FunctionWrapper.apply(this._fn, params);
|
2016
|
+
};
|
2017
|
+
FunctionWithParamTokens.prototype.hasToken = function(token) {
|
2018
|
+
return this._tokens.indexOf(token) > -1;
|
2019
|
+
};
|
2020
|
+
return FunctionWithParamTokens;
|
2021
|
+
}());
|
2022
|
+
exports.FunctionWithParamTokens = FunctionWithParamTokens;
|
2023
|
+
global.define = __define;
|
2024
|
+
return module.exports;
|
2025
|
+
});
|
2026
|
+
|
2027
|
+
System.register("angular2/src/testing/testing", ["angular2/src/facade/lang", "angular2/src/testing/test_injector", "angular2/src/testing/test_injector", "angular2/src/testing/matchers"], true, function(require, exports, module) {
|
2028
|
+
var global = System.global,
|
2029
|
+
__define = global.define;
|
2030
|
+
global.define = undefined;
|
2031
|
+
"use strict";
|
2032
|
+
var lang_1 = require("angular2/src/facade/lang");
|
2033
|
+
var test_injector_1 = require("angular2/src/testing/test_injector");
|
2034
|
+
var test_injector_2 = require("angular2/src/testing/test_injector");
|
2035
|
+
exports.inject = test_injector_2.inject;
|
2036
|
+
exports.injectAsync = test_injector_2.injectAsync;
|
2037
|
+
var matchers_1 = require("angular2/src/testing/matchers");
|
2038
|
+
exports.expect = matchers_1.expect;
|
2039
|
+
var _global = (typeof window === 'undefined' ? lang_1.global : window);
|
2040
|
+
exports.afterEach = _global.afterEach;
|
2041
|
+
exports.describe = _global.describe;
|
2042
|
+
exports.ddescribe = _global.fdescribe;
|
2043
|
+
exports.fdescribe = _global.fdescribe;
|
2044
|
+
exports.xdescribe = _global.xdescribe;
|
2045
|
+
var jsmBeforeEach = _global.beforeEach;
|
2046
|
+
var jsmIt = _global.it;
|
2047
|
+
var jsmIIt = _global.fit;
|
2048
|
+
var jsmXIt = _global.xit;
|
2049
|
+
var testInjector = test_injector_1.getTestInjector();
|
2050
|
+
jsmBeforeEach(function() {
|
2051
|
+
testInjector.reset();
|
2052
|
+
});
|
2053
|
+
function beforeEachProviders(fn) {
|
2054
|
+
jsmBeforeEach(function() {
|
2055
|
+
var providers = fn();
|
2056
|
+
if (!providers)
|
2057
|
+
return ;
|
2058
|
+
try {
|
2059
|
+
testInjector.addProviders(providers);
|
2060
|
+
} catch (e) {
|
2061
|
+
throw new Error('beforeEachProviders was called after the injector had ' + 'been used in a beforeEach or it block. This invalidates the ' + 'test injector');
|
2062
|
+
}
|
2063
|
+
});
|
2064
|
+
}
|
2065
|
+
exports.beforeEachProviders = beforeEachProviders;
|
2066
|
+
function _isPromiseLike(input) {
|
2067
|
+
return input && !!(input.then);
|
2068
|
+
}
|
2069
|
+
function _it(jsmFn, name, testFn, testTimeOut) {
|
2070
|
+
var timeOut = testTimeOut;
|
2071
|
+
if (testFn instanceof test_injector_1.FunctionWithParamTokens) {
|
2072
|
+
var testFnT_1 = testFn;
|
2073
|
+
jsmFn(name, function(done) {
|
2074
|
+
var returnedTestValue;
|
2075
|
+
try {
|
2076
|
+
returnedTestValue = testInjector.execute(testFnT_1);
|
2077
|
+
} catch (err) {
|
2078
|
+
done.fail(err);
|
2079
|
+
return ;
|
2080
|
+
}
|
2081
|
+
if (testFnT_1.isAsync) {
|
2082
|
+
if (_isPromiseLike(returnedTestValue)) {
|
2083
|
+
returnedTestValue.then(function() {
|
2084
|
+
done();
|
2085
|
+
}, function(err) {
|
2086
|
+
done.fail(err);
|
2087
|
+
});
|
2088
|
+
} else {
|
2089
|
+
done.fail('Error: injectAsync was expected to return a promise, but the ' + ' returned value was: ' + returnedTestValue);
|
2090
|
+
}
|
2091
|
+
} else {
|
2092
|
+
if (!(returnedTestValue === undefined)) {
|
2093
|
+
done.fail('Error: inject returned a value. Did you mean to use injectAsync? Returned ' + 'value was: ' + returnedTestValue);
|
2094
|
+
}
|
2095
|
+
done();
|
2096
|
+
}
|
2097
|
+
}, timeOut);
|
2098
|
+
} else {
|
2099
|
+
jsmFn(name, testFn, timeOut);
|
2100
|
+
}
|
2101
|
+
}
|
2102
|
+
function beforeEach(fn) {
|
2103
|
+
if (fn instanceof test_injector_1.FunctionWithParamTokens) {
|
2104
|
+
var fnT_1 = fn;
|
2105
|
+
jsmBeforeEach(function(done) {
|
2106
|
+
var returnedTestValue;
|
2107
|
+
try {
|
2108
|
+
returnedTestValue = testInjector.execute(fnT_1);
|
2109
|
+
} catch (err) {
|
2110
|
+
done.fail(err);
|
2111
|
+
return ;
|
2112
|
+
}
|
2113
|
+
if (fnT_1.isAsync) {
|
2114
|
+
if (_isPromiseLike(returnedTestValue)) {
|
2115
|
+
returnedTestValue.then(function() {
|
2116
|
+
done();
|
2117
|
+
}, function(err) {
|
2118
|
+
done.fail(err);
|
2119
|
+
});
|
2120
|
+
} else {
|
2121
|
+
done.fail('Error: injectAsync was expected to return a promise, but the ' + ' returned value was: ' + returnedTestValue);
|
2122
|
+
}
|
2123
|
+
} else {
|
2124
|
+
if (!(returnedTestValue === undefined)) {
|
2125
|
+
done.fail('Error: inject returned a value. Did you mean to use injectAsync? Returned ' + 'value was: ' + returnedTestValue);
|
2126
|
+
}
|
2127
|
+
done();
|
2128
|
+
}
|
2129
|
+
});
|
2130
|
+
} else {
|
2131
|
+
if (fn.length === 0) {
|
2132
|
+
jsmBeforeEach(function() {
|
2133
|
+
fn();
|
2134
|
+
});
|
2135
|
+
} else {
|
2136
|
+
jsmBeforeEach(function(done) {
|
2137
|
+
fn(done);
|
2138
|
+
});
|
2139
|
+
}
|
2140
|
+
}
|
2141
|
+
}
|
2142
|
+
exports.beforeEach = beforeEach;
|
2143
|
+
function it(name, fn, timeOut) {
|
2144
|
+
if (timeOut === void 0) {
|
2145
|
+
timeOut = null;
|
2146
|
+
}
|
2147
|
+
return _it(jsmIt, name, fn, timeOut);
|
2148
|
+
}
|
2149
|
+
exports.it = it;
|
2150
|
+
function xit(name, fn, timeOut) {
|
2151
|
+
if (timeOut === void 0) {
|
2152
|
+
timeOut = null;
|
2153
|
+
}
|
2154
|
+
return _it(jsmXIt, name, fn, timeOut);
|
2155
|
+
}
|
2156
|
+
exports.xit = xit;
|
2157
|
+
function iit(name, fn, timeOut) {
|
2158
|
+
if (timeOut === void 0) {
|
2159
|
+
timeOut = null;
|
2160
|
+
}
|
2161
|
+
return _it(jsmIIt, name, fn, timeOut);
|
2162
|
+
}
|
2163
|
+
exports.iit = iit;
|
2164
|
+
function fit(name, fn, timeOut) {
|
2165
|
+
if (timeOut === void 0) {
|
2166
|
+
timeOut = null;
|
2167
|
+
}
|
2168
|
+
return _it(jsmIIt, name, fn, timeOut);
|
2169
|
+
}
|
2170
|
+
exports.fit = fit;
|
2171
|
+
global.define = __define;
|
2172
|
+
return module.exports;
|
2173
|
+
});
|
2174
|
+
|
2175
|
+
System.register("angular2/testing", ["angular2/src/testing/testing", "angular2/src/testing/test_component_builder", "angular2/src/testing/test_injector", "angular2/src/testing/fake_async", "angular2/src/mock/view_resolver_mock", "angular2/src/compiler/xhr_mock", "angular2/src/mock/ng_zone_mock", "angular2/src/mock/mock_application_ref", "angular2/src/mock/directive_resolver_mock"], true, function(require, exports, module) {
|
2176
|
+
var global = System.global,
|
2177
|
+
__define = global.define;
|
2178
|
+
global.define = undefined;
|
2179
|
+
"use strict";
|
2180
|
+
function __export(m) {
|
2181
|
+
for (var p in m)
|
2182
|
+
if (!exports.hasOwnProperty(p))
|
2183
|
+
exports[p] = m[p];
|
2184
|
+
}
|
2185
|
+
__export(require("angular2/src/testing/testing"));
|
2186
|
+
var test_component_builder_1 = require("angular2/src/testing/test_component_builder");
|
2187
|
+
exports.ComponentFixture = test_component_builder_1.ComponentFixture;
|
2188
|
+
exports.TestComponentBuilder = test_component_builder_1.TestComponentBuilder;
|
2189
|
+
__export(require("angular2/src/testing/test_injector"));
|
2190
|
+
__export(require("angular2/src/testing/fake_async"));
|
2191
|
+
var view_resolver_mock_1 = require("angular2/src/mock/view_resolver_mock");
|
2192
|
+
exports.MockViewResolver = view_resolver_mock_1.MockViewResolver;
|
2193
|
+
var xhr_mock_1 = require("angular2/src/compiler/xhr_mock");
|
2194
|
+
exports.MockXHR = xhr_mock_1.MockXHR;
|
2195
|
+
var ng_zone_mock_1 = require("angular2/src/mock/ng_zone_mock");
|
2196
|
+
exports.MockNgZone = ng_zone_mock_1.MockNgZone;
|
2197
|
+
var mock_application_ref_1 = require("angular2/src/mock/mock_application_ref");
|
2198
|
+
exports.MockApplicationRef = mock_application_ref_1.MockApplicationRef;
|
2199
|
+
var directive_resolver_mock_1 = require("angular2/src/mock/directive_resolver_mock");
|
2200
|
+
exports.MockDirectiveResolver = directive_resolver_mock_1.MockDirectiveResolver;
|
2201
|
+
global.define = __define;
|
2202
|
+
return module.exports;
|
2203
|
+
});
|
2204
|
+
|
2205
|
+
//# sourceMappingURL=testing.dev.js.map
|