Reporter listens for `onRaiseExceptionsClick` on a non-jasmine element #605

Closed
vire opened this Issue Jun 6, 2014 · 3 comments

Projects

None yet

2 participants

@vire
vire commented Jun 6, 2014

Hi, maybe this is somewhere duplicated, I've tried to search but found nothing relevant.

I discovered an tricky issue - I composed a test, that contains jasmine boot and a custom container to which i append elements and then I write test's for their presence and functionlity.

Obsuce is, that jasmine-boot appends a click listener to the first input I paste to my $('#custom-test-container') element.

here is an output from chrome -> devel tools -> elements -> event listeners -> click
handler: function () { queryString.setParam("catch", !env.catchingExceptions()); }
isAttribute: true
lineNumber: 126
listenerBody: "function () { queryString.setParam("catch", !env.catchingExceptions()); }"
node: input.seq-loopsection-input
sourceName: "http://localhost:7357/testem/jasmine2-boot.js"
type: "click"
useCapture: false

I also need to mention, that I've been using it with testem, so I don't know if this could be caused by testem, but more important is the logic that appends the _onRaiseExceptionsClick_ handler to DOM.

@sheelc sheelc added a commit to sheelc/jasmine that referenced this issue Jun 7, 2014
@sheelc sheelc Narrow down raise exceptions query selector
Finding by any input tag is a little bit broad [#605]
13e0dd2
@sheelc
Contributor
sheelc commented Jun 7, 2014

The HTML reporter was finding all inputs within the '.html-reporter' class, which is probably why it bound the event handler on your first input. I just pushed a change to find the input through the 'raise-exceptions' id instead. Does this help?

For some added context, the hope here, however, is that any content that needs to be added to the DOM for testing, etc, can be done outside of the '.html-reporter' div and instead in a separate div so that there's significantly less likely chance of collision.

@vire
vire commented Jun 7, 2014

@sheelc Hi, thx for the quick fix!problem solved, I'm closing the issue.

My issue was caused by the fact, that i was adding my test container in the test itself, so it was appended before the .html-reporter and it was the first input in DOM : )

but I've got it now.

@vire vire closed this Jun 7, 2014
@sheelc
Contributor
sheelc commented Jun 7, 2014

No problem! The original code should have only been finding the first input inside of .html-reporter and not the first input in DOM, so it's still a little unexplained why it was binding to your input if it was outside of .html-reporter

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