unabridged/motion

Add test helpers for generating events for testing

latortuga opened this issue · 0 comments

I find myself wanting to test a motion that pulls data from the event and I think it would be useful if the test helpers included some new stuff:

# current API
def run_motion(component, motion)
# proposed change
def run_motion(component, motion, event = motion_event)

# does not currently exist, build a fake (or real?) Motion::Event
def motion_event(attributes = {})
  Motion::Event.new(attributes)
end

This will be useful for when you take business logic based on what's in the event object (e.g. data attributes from the DOM).