
Security News
PyPI Expands Trusted Publishing to GitLab Self-Managed as Adoption Passes 25 Percent
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads
babel-plugin-test-to-storybook
Advanced tools
Babel plugin to help you make test file converted to storybook file
Babel plugin to help you make test file converted to storybook file
import React from 'react'
import useForm from '../../src/hooks/useForm'
describe("表单能力测试", () => {
function FormComponent({useForm, onSubmit, onError}) {
return <p>333333</p>
}
it("基础表单能力测试", (done) => {
const wrapper = mount(<FormComponent useForm={useForm} onSubmit={data => {
expect(data).to.deep.equal({
person : {
name : 'dwy'
}
})
done()
}} />)
expect(
wrapper
.find(".pname")
.first()
.props()
).to.have.property("value", "ramroll");
wrapper
.find(".pname input")
.first()
.simulate("change", { target: { value: "dwy" } });
})
it("表单-获取所有值", (done) => {
const wrapper = mount(
<FormComponent
useForm={useForm}
onSubmit={data => {
expect(data).to.deep.equal({
person: {
name: "ramroll",
id : 100
}
});
done()
}}
/>
);
wrapper.find('.pid input').first().simulate('change', {
target : {
value : 100
}
})
})
})
import React from 'react';
import { storiesOf } from "@storybook/react";
import useForm from '../../src/hooks/useForm';
function FormComponent(_ref) {
var useForm = _ref.useForm,
onSubmit = _ref.onSubmit,
onError = _ref.onError;
return React.createElement("p", null, "333333");
}
storiesOf("表单能力测试", module).add("基础表单能力测试", function (done) {
return React.createElement(FormComponent, {
useForm: useForm,
onSubmit: function onSubmit(data) {
done();
}
});
}).add("表单-获取所有值", function (done) {
return React.createElement(FormComponent, {
useForm: useForm,
onSubmit: function onSubmit(data) {
done();
}
});
}).add('表单-字段验证(验证一个字段)', function (done) {
return React.createElement(FormComponent, {
useForm: useForm
});
}).add('表单-设置所有值', function (done) {
return React.createElement(FormComponent, {
useForm: useForm,
onSubmit: function onSubmit(data) {
done();
}
});
}).add("校验-并获取值", function (done) {
return React.createElement(FormComponent, {
useForm: useForm,
onSubmit: function onSubmit(data) {},
onError: function onError(errors) {
console.log(errors);
done();
}
});
});
// webpack
{
test: /\.test\.js$/,
use: [
{
loader: 'babel-loader',
options: {
plugins: ['babel-plugin-test-to-storybook']
}
}
]
}
// babel.config.js
{
...,
"plugins": [
[
"babel-plugin-test-to-storybook",
{
"file": /\.test\.js$/
}
]
],
...
}
FAQs
Babel plugin to help you make test file converted to storybook file
The npm package babel-plugin-test-to-storybook receives a total of 0 weekly downloads. As such, babel-plugin-test-to-storybook popularity was classified as not popular.
We found that babel-plugin-test-to-storybook demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.