-
Notifications
You must be signed in to change notification settings - Fork 0
Updating strategy
karak edited this page Apr 28, 2018
·
3 revisions
Current WeakWrapper
(v1.1.0) holds just found results. Therefore, it may be inconsistent after their parent tag updates.
We should make them refresh automatically at that time according to the context element and CSS selector.
Finding chains like find('header, footer').find('p')
should be also supported.
We can use updated
event, but any off('updated')
and off('*')
including the one called at unmount
prevents these observing. It would be limitation. To improve this, we could observe before-mount
and set some flag to warn on following use.
Manual API by default, and automatic one optionally.
// Default
const actives = wrapper.find('p:visible');
expect(actives).to.have.length(0);
wrapper.update({ disabled: false });
actives.refresh();
expect(actives).to.have.length(3);
// Live
const actives = wrapper.find('p:visible').live();
expect(actives).to.have.length(0);
wrapper.update({ disabled: false });
expect(actives).to.have.length(3);
As for find chain, find()
of the return-value of live()
is automatic by default, and never be manual.