parent
ebb3236ad5
commit
65344fcac9
|
@ -85,3 +85,16 @@ if (!Object.hasOwnProperty('name')) {
|
||||||
}
|
}
|
||||||
global.URLPolyfill = URLPolyfill;
|
global.URLPolyfill = URLPolyfill;
|
||||||
})(typeof self != 'undefined' ? self : global);
|
})(typeof self != 'undefined' ? self : global);
|
||||||
|
|
||||||
|
//classList (IE9)
|
||||||
|
/*! @license please refer to http://unlicense.org/ */
|
||||||
|
/*! @author Eli Grey */
|
||||||
|
/*! @source https://github.com/eligrey/classList.js */
|
||||||
|
;if("document" in self&&!("classList" in document.createElement("_"))){(function(j){"use strict";if(!("Element" in j)){return}var a="classList",f="prototype",m=j.Element[f],b=Object,k=String[f].trim||function(){return this.replace(/^\s+|\s+$/g,"")},c=Array[f].indexOf||function(q){var p=0,o=this.length;for(;p<o;p++){if(p in this&&this[p]===q){return p}}return -1},n=function(o,p){this.name=o;this.code=DOMException[o];this.message=p},g=function(p,o){if(o===""){throw new n("SYNTAX_ERR","An invalid or illegal string was specified")}if(/\s/.test(o)){throw new n("INVALID_CHARACTER_ERR","String contains an invalid character")}return c.call(p,o)},d=function(s){var r=k.call(s.getAttribute("class")||""),q=r?r.split(/\s+/):[],p=0,o=q.length;for(;p<o;p++){this.push(q[p])}this._updateClassName=function(){s.setAttribute("class",this.toString())}},e=d[f]=[],i=function(){return new d(this)};n[f]=Error[f];e.item=function(o){return this[o]||null};e.contains=function(o){o+="";return g(this,o)!==-1};e.add=function(){var s=arguments,r=0,p=s.length,q,o=false;do{q=s[r]+"";if(g(this,q)===-1){this.push(q);o=true}}while(++r<p);if(o){this._updateClassName()}};e.remove=function(){var t=arguments,s=0,p=t.length,r,o=false;do{r=t[s]+"";var q=g(this,r);if(q!==-1){this.splice(q,1);o=true}}while(++s<p);if(o){this._updateClassName()}};e.toggle=function(p,q){p+="";var o=this.contains(p),r=o?q!==true&&"remove":q!==false&&"add";if(r){this[r](p)}return !o};e.toString=function(){return this.join(" ")};if(b.defineProperty){var l={get:i,enumerable:true,configurable:true};try{b.defineProperty(m,a,l)}catch(h){if(h.number===-2146823252){l.enumerable=false;b.defineProperty(m,a,l)}}}else{if(b[f].__defineGetter__){m.__defineGetter__(a,i)}}}(self))};
|
||||||
|
|
||||||
|
//console mock (IE9)
|
||||||
|
if (!window.console) window.console = {};
|
||||||
|
if (!window.console.log) window.console.log = function () { };
|
||||||
|
if (!window.console.error) window.console.error = function () { };
|
||||||
|
if (!window.console.warn) window.console.warn = function () { };
|
||||||
|
if (!window.console.assert) window.console.assert = function () { };
|
||||||
|
|
|
@ -269,8 +269,8 @@ function commonTests() {
|
||||||
.toEqual(
|
.toEqual(
|
||||||
'onTurnStart; start run; nested run; end run; nested run microtask; onTurnDone');
|
'onTurnStart; start run; nested run; end run; nested run microtask; onTurnDone');
|
||||||
async.done();
|
async.done();
|
||||||
}, 80);
|
}, 150);
|
||||||
}));
|
}), 200);
|
||||||
|
|
||||||
it('should not run onTurnStart and onTurnDone for nested Zone.run invoked from onTurnDone',
|
it('should not run onTurnStart and onTurnDone for nested Zone.run invoked from onTurnDone',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -512,7 +512,7 @@ function commonTests() {
|
||||||
macroTask(() => { _zone.run(() => { completerA.resolve(null); }); }, 20);
|
macroTask(() => { _zone.run(() => { completerA.resolve(null); }); }, 20);
|
||||||
|
|
||||||
|
|
||||||
macroTask(() => { _zone.run(() => { completerB.resolve(null); }); }, 60);
|
macroTask(() => { _zone.run(() => { completerB.resolve(null); }); }, 100);
|
||||||
|
|
||||||
macroTask(() => {
|
macroTask(() => {
|
||||||
expect(_log.result())
|
expect(_log.result())
|
||||||
|
@ -524,8 +524,8 @@ function commonTests() {
|
||||||
// Third VM turn
|
// Third VM turn
|
||||||
'onTurnStart; b then; onTurnDone');
|
'onTurnStart; b then; onTurnDone');
|
||||||
async.done();
|
async.done();
|
||||||
}, 90);
|
}, 180);
|
||||||
}));
|
}), 200);
|
||||||
|
|
||||||
it('should call onTurnStart and onTurnDone before and after (respectively) all turns in a chain',
|
it('should call onTurnStart and onTurnDone before and after (respectively) all turns in a chain',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -597,8 +597,8 @@ function commonTests() {
|
||||||
expect(_errors.length).toBe(1);
|
expect(_errors.length).toBe(1);
|
||||||
expect(_errors[0]).toEqual(exception);
|
expect(_errors[0]).toEqual(exception);
|
||||||
async.done();
|
async.done();
|
||||||
}, 80);
|
}, 150);
|
||||||
}));
|
}), 200);
|
||||||
|
|
||||||
it('should call onError when onTurnDone throws and the zone is sync',
|
it('should call onError when onTurnDone throws and the zone is sync',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
|
|
@ -63,7 +63,7 @@ export function main() {
|
||||||
expect(ev['url']).toEqual('/user/btford');
|
expect(ev['url']).toEqual('/user/btford');
|
||||||
async.done();
|
async.done();
|
||||||
})
|
})
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should normalize location path', () => {
|
it('should normalize location path', () => {
|
||||||
locationStrategy.internalPath = '/my/app/user/btford';
|
locationStrategy.internalPath = '/my/app/user/btford';
|
||||||
|
|
|
@ -102,7 +102,7 @@ export function main() {
|
||||||
expect(rootTC.nativeElement).toHaveText('hello');
|
expect(rootTC.nativeElement).toHaveText('hello');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
|
|
||||||
it('should navigate between components with different parameters',
|
it('should navigate between components with different parameters',
|
||||||
|
@ -120,7 +120,7 @@ export function main() {
|
||||||
expect(rootTC.nativeElement).toHaveText('hello igor');
|
expect(rootTC.nativeElement).toHaveText('hello igor');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
|
|
||||||
it('should work with child routers', inject([AsyncTestCompleter], (async) => {
|
it('should work with child routers', inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -132,7 +132,7 @@ export function main() {
|
||||||
expect(rootTC.nativeElement).toHaveText('outer { inner { hello } }');
|
expect(rootTC.nativeElement).toHaveText('outer { inner { hello } }');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
|
|
||||||
it('should work with redirects', inject([AsyncTestCompleter, Location], (async, location) => {
|
it('should work with redirects', inject([AsyncTestCompleter, Location], (async, location) => {
|
||||||
|
@ -148,7 +148,7 @@ export function main() {
|
||||||
expect(location.urlChanges).toEqual(['/redirected']);
|
expect(location.urlChanges).toEqual(['/redirected']);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
function getHref(tc) {
|
function getHref(tc) {
|
||||||
return DOM.getAttribute(tc.componentViewChildren[0].nativeElement, 'href');
|
return DOM.getAttribute(tc.componentViewChildren[0].nativeElement, 'href');
|
||||||
|
@ -165,7 +165,7 @@ export function main() {
|
||||||
expect(getHref(rootTC)).toEqual('/my/base/user');
|
expect(getHref(rootTC)).toEqual('/my/base/user');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
|
|
||||||
it('should generate link hrefs without params', inject([AsyncTestCompleter], (async) => {
|
it('should generate link hrefs without params', inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -177,7 +177,7 @@ export function main() {
|
||||||
expect(getHref(rootTC)).toEqual('/user');
|
expect(getHref(rootTC)).toEqual('/user');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
|
|
||||||
it('should reuse common parent components', inject([AsyncTestCompleter], (async) => {
|
it('should reuse common parent components', inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -196,7 +196,7 @@ export function main() {
|
||||||
expect(rootTC.nativeElement).toHaveText('team angular { hello victor }');
|
expect(rootTC.nativeElement).toHaveText('team angular { hello victor }');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
|
|
||||||
it('should generate link hrefs with params', inject([AsyncTestCompleter], (async) => {
|
it('should generate link hrefs with params', inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -212,7 +212,7 @@ export function main() {
|
||||||
.toEqual('/user/brian');
|
.toEqual('/user/brian');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should generate link hrefs from a child to its sibling',
|
it('should generate link hrefs from a child to its sibling',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -228,7 +228,7 @@ export function main() {
|
||||||
.toEqual('/page/2');
|
.toEqual('/page/2');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should generate relative links preserving the existing parent route',
|
it('should generate relative links preserving the existing parent route',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -251,7 +251,7 @@ export function main() {
|
||||||
.toEqual('/book/1984/page/2');
|
.toEqual('/book/1984/page/2');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should inject RouteData into component', inject([AsyncTestCompleter], (async) => {
|
it('should inject RouteData into component', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
|
@ -264,7 +264,7 @@ export function main() {
|
||||||
expect(rootTC.nativeElement).toHaveText(Json.stringify({'isAdmin': true}));
|
expect(rootTC.nativeElement).toHaveText(Json.stringify({'isAdmin': true}));
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should inject RouteData into component with AsyncRoute',
|
it('should inject RouteData into component with AsyncRoute',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -279,7 +279,7 @@ export function main() {
|
||||||
expect(rootTC.nativeElement).toHaveText(Json.stringify({'isAdmin': true}));
|
expect(rootTC.nativeElement).toHaveText(Json.stringify({'isAdmin': true}));
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should inject nested RouteData into component', inject([AsyncTestCompleter], (async) => {
|
it('should inject nested RouteData into component', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
|
@ -297,7 +297,7 @@ export function main() {
|
||||||
.toHaveText(Json.stringify({'isAdmin': true, 'test': {'moreData': 'testing'}}));
|
.toHaveText(Json.stringify({'isAdmin': true, 'test': {'moreData': 'testing'}}));
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should inject null if the route has no data property',
|
it('should inject null if the route has no data property',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -310,7 +310,7 @@ export function main() {
|
||||||
expect(rootTC.nativeElement).toHaveText('null');
|
expect(rootTC.nativeElement).toHaveText('null');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should allow an array as the route data', inject([AsyncTestCompleter], (async) => {
|
it('should allow an array as the route data', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
|
@ -323,7 +323,7 @@ export function main() {
|
||||||
expect(rootTC.nativeElement).toHaveText(Json.stringify([1, 2, 3]));
|
expect(rootTC.nativeElement).toHaveText(Json.stringify([1, 2, 3]));
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should allow a string as the route data', inject([AsyncTestCompleter], (async) => {
|
it('should allow a string as the route data', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
|
@ -337,7 +337,7 @@ export function main() {
|
||||||
expect(rootTC.nativeElement).toHaveText(Json.stringify('hello world'));
|
expect(rootTC.nativeElement).toHaveText(Json.stringify('hello world'));
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
describe('lifecycle hooks', () => {
|
describe('lifecycle hooks', () => {
|
||||||
it('should call the onActivate hook', inject([AsyncTestCompleter], (async) => {
|
it('should call the onActivate hook', inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -350,7 +350,7 @@ export function main() {
|
||||||
expect(log).toEqual(['activate: null -> /on-activate']);
|
expect(log).toEqual(['activate: null -> /on-activate']);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should wait for a parent component\'s onActivate hook to resolve before calling its child\'s',
|
it('should wait for a parent component\'s onActivate hook to resolve before calling its child\'s',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -373,7 +373,7 @@ export function main() {
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should call the onDeactivate hook', inject([AsyncTestCompleter], (async) => {
|
it('should call the onDeactivate hook', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
|
@ -386,7 +386,7 @@ export function main() {
|
||||||
expect(log).toEqual(['deactivate: /on-deactivate -> /a']);
|
expect(log).toEqual(['deactivate: /on-deactivate -> /a']);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should wait for a child component\'s onDeactivate hook to resolve before calling its parent\'s',
|
it('should wait for a child component\'s onDeactivate hook to resolve before calling its parent\'s',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -411,7 +411,7 @@ export function main() {
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should reuse a component when the canReuse hook returns true',
|
it('should reuse a component when the canReuse hook returns true',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -432,7 +432,7 @@ export function main() {
|
||||||
expect(cmpInstanceCount).toBe(1);
|
expect(cmpInstanceCount).toBe(1);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
|
|
||||||
it('should not reuse a component when the canReuse hook returns false',
|
it('should not reuse a component when the canReuse hook returns false',
|
||||||
|
@ -454,7 +454,7 @@ export function main() {
|
||||||
expect(cmpInstanceCount).toBe(2);
|
expect(cmpInstanceCount).toBe(2);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
|
|
||||||
it('should navigate when canActivate returns true', inject([AsyncTestCompleter], (async) => {
|
it('should navigate when canActivate returns true', inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -474,7 +474,7 @@ export function main() {
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should not navigate when canActivate returns false',
|
it('should not navigate when canActivate returns false',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -494,7 +494,7 @@ export function main() {
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should navigate away when canDeactivate returns true',
|
it('should navigate away when canDeactivate returns true',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -519,7 +519,7 @@ export function main() {
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should not navigate away when canDeactivate returns false',
|
it('should not navigate away when canDeactivate returns false',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -544,7 +544,7 @@ export function main() {
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
|
|
||||||
it('should run activation and deactivation hooks in the correct order',
|
it('should run activation and deactivation hooks in the correct order',
|
||||||
|
@ -572,7 +572,7 @@ export function main() {
|
||||||
]);
|
]);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should only run reuse hooks when reusing', inject([AsyncTestCompleter], (async) => {
|
it('should only run reuse hooks when reusing', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
|
@ -599,7 +599,7 @@ export function main() {
|
||||||
]);
|
]);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should not run reuse hooks when not reusing', inject([AsyncTestCompleter], (async) => {
|
it('should not run reuse hooks when not reusing', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
|
@ -628,7 +628,7 @@ export function main() {
|
||||||
]);
|
]);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
router.navigate('/parent/child');
|
router.navigate('/parent/child');
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
|
|
||||||
it('should work in an app with redirects', inject([AsyncTestCompleter], (async) => {
|
it('should work in an app with redirects', inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -79,7 +79,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
router.navigate('/before');
|
router.navigate('/before');
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
|
|
||||||
it('should work in an app with async components', inject([AsyncTestCompleter], (async) => {
|
it('should work in an app with async components', inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -93,7 +93,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
router.navigate('/hello');
|
router.navigate('/hello');
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
|
|
||||||
it('should work in an app with a constructor component',
|
it('should work in an app with a constructor component',
|
||||||
|
@ -108,7 +108,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
router.navigate('/hello');
|
router.navigate('/hello');
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should throw if a config is missing a target',
|
it('should throw if a config is missing a target',
|
||||||
inject(
|
inject(
|
||||||
|
|
|
@ -125,7 +125,7 @@ var aliases = {
|
||||||
'SAFARI': ['SL_SAFARI7', 'SL_SAFARI8'],
|
'SAFARI': ['SL_SAFARI7', 'SL_SAFARI8'],
|
||||||
'BETA': ['SL_CHROMEBETA', 'SL_FIREFOXBETA'],
|
'BETA': ['SL_CHROMEBETA', 'SL_FIREFOXBETA'],
|
||||||
'DEV': ['SL_CHROMEDEV', 'SL_FIREFOXDEV'],
|
'DEV': ['SL_CHROMEDEV', 'SL_FIREFOXDEV'],
|
||||||
'CI': ['SL_CHROME', 'SL_ANDROID5.1', 'SL_SAFARI8', 'SL_IOS8', 'SL_FIREFOX', 'SL_IE11', 'SL_IE10']
|
'CI': ['SL_CHROME', 'SL_ANDROID5.1', 'SL_SAFARI8', 'SL_IOS8', 'SL_FIREFOX', 'SL_IE11', 'SL_IE10', 'SL_IE9']
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
Loading…
Reference in New Issue