From d5b8b95a2d65c8b1d3211cc71ebf3fdb4599db8d Mon Sep 17 00:00:00 2001 From: Matt York Date: Fri, 20 Jun 2014 18:35:25 -0700 Subject: [PATCH 1/2] Add onCall(n) and friends to SinonStub definition These were added in Sinon 1.8, and the definition claims to be Sinon 1.8.1 From documentation: "As of Sinon version 1.8, you can use the onCall method to make a stub respond differently on consecutive calls." http://sinonjs.org/docs/ --- sinon/sinon.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sinon/sinon.d.ts b/sinon/sinon.d.ts index f8bed61b0..4b8656661 100644 --- a/sinon/sinon.d.ts +++ b/sinon/sinon.d.ts @@ -101,6 +101,10 @@ interface SinonStub extends SinonSpy { callsArgOnAsync(index: number, context: any): SinonStub; callsArgWithAsync(index: number, ...args: any[]): SinonStub; callsArgOnWithAsync(index: number, context: any, ...args: any[]): SinonStub; + onCall(n: number): SinonStub; + onFirstCall(): SinonStub; + onSecondCall(): SinonStub; + onThirdCall(): SinonStub; yields(...args: any[]): SinonStub; yieldsOn(context: any, ...args: any[]): SinonStub; yieldsTo(property: string, ...args: any[]): SinonStub; From edb66b0c70ca224559e7a89b6feaae92ef077670 Mon Sep 17 00:00:00 2001 From: Matt York Date: Fri, 20 Jun 2014 18:27:04 -0700 Subject: [PATCH 2/2] ui-router fix move parameters() and format() from IUrlMatcherFactory to IUrlMatcher. Also adds tests for IUrlMatcher --- angular-ui/angular-ui-router-tests.ts | 4 ++++ angular-ui/angular-ui-router.d.ts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/angular-ui/angular-ui-router-tests.ts b/angular-ui/angular-ui-router-tests.ts index 5b0dec0ff..971a47cd2 100644 --- a/angular-ui/angular-ui-router-tests.ts +++ b/angular-ui/angular-ui-router-tests.ts @@ -13,6 +13,10 @@ myApp.config(( $urlMatcherFactory: ng.ui.IUrlMatcherFactory) => { var matcher: ng.ui.IUrlMatcher = $urlMatcherFactory.compile("/foo/:bar?param1"); + var obj: Object = matcher.exec('/user/bob', { x:'1', q:'hello' }); + var concat: ng.ui.IUrlMatcher = matcher.concat('/test'); + var str: string = matcher.format({ id:'bob', q:'yes' }); + var arr: string[] = matcher.parameters(); $urlRouterProvider .when('/test', '/list') diff --git a/angular-ui/angular-ui-router.d.ts b/angular-ui/angular-ui-router.d.ts index 6327719b5..081d35723 100644 --- a/angular-ui/angular-ui-router.d.ts +++ b/angular-ui/angular-ui-router.d.ts @@ -33,13 +33,13 @@ declare module ng.ui { interface IUrlMatcher { concat(pattern: string): IUrlMatcher; exec(path: string, searchParams: {}): {}; + parameters(): string[]; + format(values: {}): string; } interface IUrlMatcherFactory { compile(pattern: string): IUrlMatcher; isMatcher(o: any): boolean; - parameters(): string[]; - format(values: {}): string; } interface IUrlRouterProvider extends IServiceProvider {