New testing helper: mockDOMResponse()
Added mockDOMResponse(mockedSelectors)
.
A testing utility which aids in creating a queryable collection of Observables. Call mockDOMResponse giving it an object specifying selectors, eventTypes and their Observabls, and get as output an object following the
same format as the DOM Driver's response.
Example:
// Create the mocked user events
const userEvents = mockDOMResponse({
'.foo': {
'click': Rx.Observable.just({target: {}}),
'mouseover': Rx.Observable.just({target: {}})
},
'.bar': {
'scroll': Rx.Observable.just({target: {}})
}
});
// Use them in your tests against `main`
const requests = main({DOM: userEvents});
requests.DOM.subscribe(function (vtree) {
// make assertions on vtree
});