当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript enzyme.mount函数代码示例

本文整理汇总了TypeScript中enzyme.mount函数的典型用法代码示例。如果您正苦于以下问题:TypeScript mount函数的具体用法?TypeScript mount怎么用?TypeScript mount使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mount函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

 it("renders children", () => {
   const wrapper = mount(WidgetHeader({
     title: "fakeWidget",
     children: "children"
   }));
   expect(wrapper.html()).toContain("children");
 });
开发者ID:FarmBot,项目名称:Farmbot-Web-API,代码行数:7,代码来源:widget_header_test.ts

示例2: it

 it("renders", () => {
   let element = mount(BackArrow());
   expect(element).toBeTruthy();
   expect(element.hasClass("back-arrow")).toBeTruthy();
   expect(element.find("i").at(0).hasClass("fa-arrow-left"))
     .toBeTruthy();
 });
开发者ID:MrChristofferson,项目名称:Farmbot-Web-API,代码行数:7,代码来源:back_arrow_test.ts

示例3: it

  it('should properly pass down useCapture', () => {
    const calls: string[] = [];
    let b: any;

    class Test extends React.Component<any, any> {
      public onClick() {
        calls.push('test');
      }

      public render() {
        return React.createElement('button', {
          onClick: () => calls.push('button'),
          ref: (i: any) => b = i,
        });
      }
    }

    const element = document.createElement('div');
    document.body.appendChild(element);

    const Mixout = mixout(listen('click', 'onClick', { target: 'document', useCapture: true }))(Test);
    mount(React.createElement(Mixout), { attachTo: element });

    expect(calls).to.deep.equal([]);
    b.click();
    expect(calls).to.deep.equal(['test', 'button']);
  });
开发者ID:alitaheri,项目名称:react-mixout,代码行数:27,代码来源:main.spec.ts

示例4: callback

export function safeMount<TComponent extends React.Component, TProps = TComponent['props'], TState = TComponent['state']>(
  content: React.ReactElement<TProps>,
  callback: (wrapper: ReactWrapper<TProps, TState, TComponent>) => void
): void {
  const wrapper = mount<TComponent, TProps, TState>(content);

  callback(wrapper);
  wrapper.unmount();
}
开发者ID:OfficeDev,项目名称:office-ui-fabric-react,代码行数:9,代码来源:safeMount.ts

示例5: it

 it("renders Router", () => {
   const renderSpy = spy(ReactDOM, "render");
   new CirculationWeb({});
   expect(renderSpy.callCount).to.equal(1);
   const component = renderSpy.args[0][0];
   const wrapper = mount(component);
   const router = wrapper.find(Router);
   expect(router.length).to.equal(1);
   renderSpy.restore();
 });
开发者ID:NYPL-Simplified,项目名称:circulation-web,代码行数:10,代码来源:index-test.ts

示例6: describe

describe("<Widget />", () => {
  const params = { children: "wow", className: "k" };
  const result = mount(Widget(params));
  it("renders correct children", () => {
    expect(result.html()).toContain("wow");
  });
  it("renders correct classnames", () => {
    const element = result.find("div");
    expect(element.hasClass("k")).toBeTruthy();
    expect(element.hasClass("widget-wrapper")).toBeTruthy();
  });
});
开发者ID:FarmBot,项目名称:Farmbot-Web-API,代码行数:12,代码来源:widget_test.ts


注:本文中的enzyme.mount函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。