enzyme

    0熱度

    1回答

    我正在用Jest和酶測試嵌套的Redux容器。 如果孩子嵌套組件類被稱爲MyComponent的,我淺使其與酶,它們顯示了一個快照: <Connect(MyComponent) myProp='someValue' /> 有沒有辦法找到這些容器用酵素?以下失敗: expect(wrapper.find(MyComponent)).toHaveLength(1); expect(wrapper

    4熱度

    1回答

    我一直在使用Enzyme在我的React應用程序中測試組件。在幾周內第一次更新我的軟件包後,我開始從我的測試中得到一個錯誤。 FAIL src/__tests__/title.test.ts ● Testing title component › renders Enzyme Internal Error: Enzyme expects an adapter to be configu

    1熱度

    2回答

    我有一個組件有2個輸入文本字段。 在componentDidMount()方法我打電話this.refs.password.focus(); 有棘手的業務邏輯的一定量的坐在我的componentDidMount內,但同時componentDidMount做一個淺淺的單元測試,我得到錯誤 不能訪問密碼未定義 我檢查了淺色組件的實例,看到this.refs是undefined。 我的問題是我們如何通過

    0熱度

    1回答

    我正在寫JS測試來檢查圖像的css類是否正確應用。該課程根據圖片的naturalHeight屬性進行計算。但是,因爲這是一個JS測試,所以沒有DOM,因此naturalHeight在測試中始終爲0。我如何正確測試/使用Jest和Enzyme模擬這個? 部件的簡化版本: class Image extends React.Component { public render() {

    3熱度

    1回答

    我在嘗試應用酶時遇到此錯誤,但無法找到任何相關問題。 這裏是test.js; import React from 'react'; import AccountLoginForm from './LoginPage'; import sinon from 'sinon'; import { mount, shallow, configure } from 'enzyme'; import

    1熱度

    1回答

    我有四個組件的包裝,所以當我做console.log(wrapper.find(LabeledInput).debug());,這是記錄: <LabeledInput label="Tenant ID" placeholder="Add a tenant" value="infor" onEnter={[Function]} updateValue={[Function]} /> <Label

    0熱度

    1回答

    我有一個組件調用Foo和render功能是這樣的: render() { if (!this.props.something) { return null; } return ( <div> <Bar /> <Baz /> </div> ); } 我想測試Foo部件,看是否div呈現: t

    1熱度

    1回答

    我想測試我的組件屬性「發現」,但我總是收到此錯誤: 類型錯誤:未定義 我的測試不能讀取屬性「發現」在將我的組件轉變爲無狀態組件之前工作正常。根據我的理解,您也可以測試功能無狀態組件。我沒有看到我在這裏做錯了什麼。 我的測試文件 import * as React from 'react'; import { LeftNavigation } from "../src/components/Lef

    1熱度

    1回答

    這是我的應用程序的入口點(其中我初始化並通過mobx店): import React from "react"; import ReactDOM from "react-dom"; import registerServiceWorker from "./registerServiceWorker"; import App from "./App"; import UiStore fr

    9熱度

    2回答

    昨天我升級我做出反應的項目v16.0,但我發現酶有一些問題 Error: Enzyme Internal Error: Enzyme expects an adapter to be configured, but found none. To configure an adapter, you should call `Enzyme.configure({ adapter