下面我尝试从enzyme实现enzyme,但发现wrapper.debug()是空的。
import {mount} from 'enzyme';
const Foo = () => <div>Sairam</div>;
describe(...
it(...
const wrapper = mount(<Foo/>);
console.log(wrapper.debug()) // gives empty value更新:
import {
specs, describe, it,
beforeEach, before, after, afterEach, xdescribe
} from 'storybook-addon-specifications';
import {mount, shallow} from 'enzyme';
storiesOf('UI|Components', module)
.add('with text', () => {
const Foo = () => <div>Sairam</div>;
specs(() =>
describe('with text', () => {
it('Clicking on the showFirst button should select the first page', () => {
const wrapper = mount(<Foo/>);
console.log("WRAPPER TEST" , wrapper.debug());
// expect(wrapper.props().chipData).to.equal(ChipData);
wrapper.unmount();
expect(2).toBe(23);
});
})
);
return story;
})发布于 2019-03-27 10:06:45
对我来说失败的原因是因为增加了装饰师。
addDecorator(StoryRouter());到我的.storybookconfig文件
https://stackoverflow.com/questions/55355100
复制相似问题