Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('Connect createConnector component', () => {
const store = new Store();
store.addAction('reset-for-connect', () => {
let resetBuilder = updateBuilder()
.set('name', 'errorrik')
.set('emails', ['errorrik@gmail.com']);
return resetBuilder;
});
beforeEach(done => {
store.dispatch('reset-for-connect');
setTimeout(done, 1);
});
// 手动连接自己声明的store
const manualConnect = connect.createConnector(store);
it('data should be ready when component init', () => {
let MyComponent = manualConnect({
name: 'name',
email: 'emails[0]'
})(san.defineComponent({
template: '<u title="{{name}}-{{email}}">{{name}}-{{email}}</u>'
}));
let myComponent = new MyComponent();
let wrap = document.createElement('div');
document.body.appendChild(wrap);
myComponent.attach(wrap);
let u = wrap.getElementsByTagName('u')[0];
expect(u.title).toBe('errorrik-errorrik@gmail.com');