当前位置: 首页>>代码示例>>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;未经允许,请勿转载。