jasmine-domの.d.ts書いてみた

最近はTypeScriptを勉強(遊んで)います。環境的にはWebstormをコード書いててTestem+jasmineでテストしています。今週DOMのテストしようと思い、調べたらjasmine-domを導入すればDOMのテストもできることがわかったのですが、TypeScript用の.d.tsファイルが転がってなかったので自前で書きました。自分が使用したMatchers以外は動作確認はしていないのですが、まぁとりあえず https://bitbucket.org/senbei_3/definitelytyped/src にアップしました。 ここにも貼っておきます。

// Type definitions for Jasmine-dom
// Project: http://github.com/jeffwatkins/jasmine-dom
// Definitions by:
// DefinitelyTyped:

declare function readFixtures(...fixtureUrls:string[]):void;
declare function loadFixtures(...fixtureUrls:string[]):void;
declare function setFixtures(html:HTMLElement):void;
declare function sandbox(attributes:string):HTMLElement;    // Must Check
declare function sandbox(attributes:any[]):HTMLElement;  // Must Check

declare module jasmine {
    function getFixtures():Fixtures;

    interface Fixtures {
        new ();
        set(html:HTMLElement):void;
        load():void;
        read():HTMLElement;
        clearCache():void;
        cleanUp():void;
        sandbox(attributes:string):HTMLElement; // Must Check
        sandbox(attributes:any[]):HTMLElement; // Must Check
    }

    interface Matchers {
        toHaveClass(className:string):bool;
        toBeVisible():bool;
        toBeHidden():bool;
        toBeSelected():bool;
        toBeChecked():bool;
        toBeEmpty():bool;
        toExist():bool;
        toHaveAttr(attributeName:string, expectedAttributeValue:any):bool;
        toHaveId(id:string):bool;
        toHaveHtml(html:string):bool;
        toHaveText(text:string):bool;
        toHaveValue(value:string):bool;
        toMatchSelector(selector:string):bool;
        toContain(selector:string):bool;
    }
}