toHandle doesn't support delegated .on() syntax #145

Open
nzifnab opened this Issue Sep 9, 2013 · 4 comments

Comments

Projects
None yet
5 participants

nzifnab commented Sep 9, 2013

As the title suggests, when you bind an event using this syntax:

$('.my-parent-element').on('click', '.child-element', function(e){
  // Do cool things
});

This doesn't work:

expect($(".child-element")).toHandle('click')

But this does:

expect($(".my-parent-element")).toHandle('click')

Event though it's not actually clicking that parent element that causes the function to run. I would almost expect some kind of method like

expect($(".child-element")).toHandleFromDelegation('click')

or something. I saw this: #40 but it was written for deprecated delegation syntax and closed quite some time ago. Is there a matcher I can use to work-around this issue and test that the child element has the handler on it? I'm not sure if it's a bug that toHandle fails on the child selector, but if it is I can produce a test case if needed.

👍

agreco commented Nov 19, 2013

is this issue being considered?

👍

👍 What's the status on this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment