mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-20 12:00:53 +08:00
jasmine ajax defs
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
|
||||
Vendored
+77
@@ -0,0 +1,77 @@
|
||||
// Type definitions for jasmine-ajax 3.1.1
|
||||
// Project: https://github.com/jasmine/jasmine-ajax
|
||||
// Definitions by: Louis Grignon <https://github.com/lgrignon>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface JasmineAjaxResponse {
|
||||
status?: string;
|
||||
statusText?: string;
|
||||
responseText?: string;
|
||||
response?: string;
|
||||
responseType?: string;
|
||||
contentType?: string;
|
||||
responseHeaders?: { [key: string]: string };
|
||||
}
|
||||
|
||||
interface JasmineAjaxRequest {
|
||||
url: string;
|
||||
respondWith(response: JasmineAjaxResponse): void;
|
||||
}
|
||||
|
||||
interface JasmineAjaxRequestTracker {
|
||||
track(request: JasmineAjaxRequest): void;
|
||||
first(): JasmineAjaxRequest;
|
||||
count(): number;
|
||||
reset(): void;
|
||||
mostRecent(): JasmineAjaxRequest;
|
||||
at(index: number): JasmineAjaxRequest;
|
||||
filter(urlToMatch: RegExp): JasmineAjaxRequest[];
|
||||
filter(urlToMatch: Function): JasmineAjaxRequest[];
|
||||
filter(urlToMatch: string): JasmineAjaxRequest[];
|
||||
}
|
||||
|
||||
interface JasmineAjaxRequestStubReturnOptions {
|
||||
status?: number;
|
||||
contentType?: string;
|
||||
response?: string;
|
||||
responseText?: string;
|
||||
responseHeaders?: { [key: string]: string };
|
||||
}
|
||||
|
||||
interface JasmineAjaxRequestStub {
|
||||
data?: string;
|
||||
method?: string;
|
||||
andReturn(options: JasmineAjaxRequestStubReturnOptions): void;
|
||||
matches(fullUrl: string, data: string, method: string): boolean;
|
||||
}
|
||||
|
||||
interface JasmineAjaxStubTracker {
|
||||
addStub(stub: JasmineAjaxRequestStub): void;
|
||||
reset(): void;
|
||||
findStub(url: string, data?: string, method?: string): JasmineAjaxRequestStub;
|
||||
}
|
||||
|
||||
interface JasmineAjaxParamParser {
|
||||
test(xhr: XMLHttpRequest): boolean;
|
||||
parse(paramString: string): any;
|
||||
}
|
||||
|
||||
declare class MockAjax {
|
||||
constructor(globals);
|
||||
|
||||
install(): void;
|
||||
uninstall(): void;
|
||||
|
||||
withMock(closure: () => void): void;
|
||||
addCustomParamParser(parser: JasmineAjaxParamParser): void;
|
||||
|
||||
stubRequest(url: RegExp, data?: string, method?: string): JasmineAjaxRequestStub;
|
||||
stubRequest(url: string, data?: string, method?: string): JasmineAjaxRequestStub;
|
||||
|
||||
requests: JasmineAjaxRequestTracker;
|
||||
stubs: JasmineAjaxStubTracker;
|
||||
}
|
||||
|
||||
declare module jasmine {
|
||||
export var Ajax: MockAjax;
|
||||
}
|
||||
Reference in New Issue
Block a user