當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript alsatian.SpyOn函數代碼示例

本文整理匯總了TypeScript中alsatian.SpyOn函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript SpyOn函數的具體用法?TypeScript SpyOn怎麽用?TypeScript SpyOn使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了SpyOn函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: prismCallbackNotCalledBeforeRender

    @Test("prism complete callback not called before render")
    public prismCallbackNotCalledBeforeRender() {
        const codeBlock = new CodeBlock({ 
            children: "",
            language: "typescript"
        });

        SpyOn(Prism.hooks, "run");

        codeBlock.componentDidMount();

        Expect(Prism.hooks.run).not.toHaveBeenCalled();
    }
開發者ID:alsatian-test,項目名稱:alsatian-website,代碼行數:13,代碼來源:code-block.component.spec.ts

示例2: togglingTheMenuMakesItOpen

    @Test("Initial toggle opens the menu")
    public togglingTheMenuMakesItOpen() {
        const navigationBar = new NavigationBarComponent();

        SpyOn(navigationBar, "setState").andCall((newState: any) => {
            Object.keys(newState).forEach(stateKey => {
                navigationBar.state[stateKey] = newState[stateKey];
            })
        });

        navigationBar.toggleMenu();

        Expect(navigationBar.state.isMenuOpen).toBe(true);
    }
開發者ID:alsatian-test,項目名稱:alsatian-website,代碼行數:14,代碼來源:navigation-bar-component.spec.ts

示例3: prismCallbackCalledAfterRender

    @Test("prism complete callback is called after render")
    public prismCallbackCalledAfterRender() {
        const codeBlock = new CodeBlock({ 
            children: "",
            language: "typescript"
        });

        SpyOn(Prism.hooks, "run");

        codeBlock.render().props.children.ref({});

        codeBlock.componentDidMount();

        Expect(Prism.hooks.run).toHaveBeenCalledWith("complete", Any(Object));
    }
開發者ID:alsatian-test,項目名稱:alsatian-website,代碼行數:15,代碼來源:code-block.component.spec.ts

示例4: prismCallbackCalledWithCodeElement

    @TestCase({ fake: "codeElement" })
    @TestCase({ something: "much", more: "interesting" })
    @Test("prism complete callback is called with code element")
    public prismCallbackCalledWithCodeElement(codeElement: any) {
        const codeBlock = new CodeBlock({ 
            children: "",
            language: "typescript"
        });

        SpyOn(Prism.hooks, "run");

        codeBlock.render().props.children.ref(codeElement);

        codeBlock.componentDidMount();

        Expect((Prism.hooks.run as any).calls[0].args[1].element).toBe(codeElement);
    }
開發者ID:alsatian-test,項目名稱:alsatian-website,代碼行數:17,代碼來源:code-block.component.spec.ts

示例5: prismCallbackCalledWithCode

    @TestCase("some code")
    @TestCase("much more fancy logic")
    @Test("prism complete callback is called with code")
    public prismCallbackCalledWithCode(code: string) {
        const codeBlock = new CodeBlock({ 
            children: code,
            language: "typescript"
        });

        SpyOn(Prism.hooks, "run");

        codeBlock.render().props.children.ref({});

        codeBlock.componentDidMount();

        Expect((Prism.hooks.run as any).calls[0].args[1].code).toBe(code);
    }
開發者ID:alsatian-test,項目名稱:alsatian-website,代碼行數:17,代碼來源:code-block.component.spec.ts


注:本文中的alsatian.SpyOn函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。