From 502f0dfb79a3f1587a4b49b0c756bdcd12dbd1b1 Mon Sep 17 00:00:00 2001 From: Ezekiel Victor Date: Sat, 20 Aug 2016 02:55:51 -0700 Subject: [PATCH] definitions for karma-fixture (#10724) * definitions for karma-fixture * return type here can be any object with any keys (arbitrary JSON) * Update karma-fixture.d.ts --- karma-fixture/karma-fixture-tests.ts | 10 ++++++++++ karma-fixture/karma-fixture.d.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 karma-fixture/karma-fixture-tests.ts create mode 100644 karma-fixture/karma-fixture.d.ts diff --git a/karma-fixture/karma-fixture-tests.ts b/karma-fixture/karma-fixture-tests.ts new file mode 100644 index 0000000000..b3a1d8e51c --- /dev/null +++ b/karma-fixture/karma-fixture-tests.ts @@ -0,0 +1,10 @@ +/// + +fixture.setBase('fixtures/base/path'); +fixture.load('test1.html', 'test1.json', false); +fixture.load('test1.html', 'test2.html', 'test1.json'); +fixture.set('', true); +fixture.set('', ''); +fixture.cleanup(); +fixture.el.firstChild; +JSON.stringify(fixture.json[0]); diff --git a/karma-fixture/karma-fixture.d.ts b/karma-fixture/karma-fixture.d.ts new file mode 100644 index 0000000000..8e4d18fd47 --- /dev/null +++ b/karma-fixture/karma-fixture.d.ts @@ -0,0 +1,27 @@ +// Type definitions for karma-fixture 0.2.6 +// Project: https://github.com/billtrik/karma-fixture +// Definitions by: Ezekiel Victor +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module fixture { + var el: HTMLElement; + var json: any[]; + + function load(...files: string[]): any; + function load(file1: string, append?: boolean): any; + function load(file1: string, file2: string, append?: boolean): any; + function load(file1: string, file2: string, file3: string, append?: boolean): any; + function load(file1: string, file2: string, file3: string, file4: string, append?: boolean): any; + function load(file1: string, file2: string, file3: string, file4: string, file5: string, append?: boolean): any; + + function set(...htmlStrs: string[]): HTMLElement|HTMLElement[]; + function set(htmlStr1: string, append?: boolean): HTMLElement|HTMLElement[]; + function set(htmlStr1: string, htmlStr2: string, append?: boolean): HTMLElement|HTMLElement[]; + function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, append?: boolean): HTMLElement|HTMLElement[]; + function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, htmlStr4: string, append?: boolean): HTMLElement|HTMLElement[]; + function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, htmlStr4: string, htmlStr5: string, append?: boolean): HTMLElement|HTMLElement[]; + + function cleanup(): void; + + function setBase(fixtureBasePath: string): void; +}