Is it possible to ask Mockolate to dispatch binding events?
For example, given this class:
class Person {
[Bindable]
public var name:String;
}
I'd like the mock:
var mockPerson:Person = nice(Person);
To dispatch a propertyChangeEvent when the name field is change.
As you mentioned Binding events are instances of
PropertyChangeEvent, just create an instance usingPropertyChangeEvent.createUpdateEvent()and use that with.dispatches().Like so:
Note however that the
oldValueandnewValuewill need to be supplied.I see merit in making a shortcut for this scenario seeing as binding is heavily used. The only tricky part is keeping the previous value.
If you wanted to tackle implementing this yourself I suggest looking at the
AnswerandDecoratorclasses and subclasses.