praekelt / go-proto-fsm

Prototype of a new Vumi Go campaign manager UI (also known as the spaghetti monster).
0 stars 0 forks source link

Get d3 based events to be simulated in tests #13

Closed justinvdm closed 10 years ago

justinvdm commented 10 years ago

@andreit ready for review

I added test utils for simulating events with d3:

d3.select('.foo').simulate('bar', {baz: 'quux'});

and also for changing jquery selections to d3 selections:

$('.foo').d3().selectAll('.bar');

Used those to fix the broken test. Tried to get the test fixes to work without the test utils and couldn't seem to get that right, so I'm guessing there were two issues:

  1. there was no endpoint4
  2. d3 event simulation wasn't working

I might make a new PR for using these test utils to move over the current tests where we are doing things like .trigger('vumigo:dragstart', ...), but that might take a bit more work than its worth. At the very least, I'll try clean up and test the setup code that is making that possible (in a different PR to this one).

andreit commented 10 years ago

@justinvdm Looks good to me. I think if we have to improve the simulate service further we can do it as the need arises.