New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding tests for $.clone() #70
Conversation
Hey there, thanks for contributing! |
Right, shouldn't code when tired. Let me fix the test :) |
...actually... shall I leave this here or remove it more or less entirely and just test events then? |
I think it doesn't hurt to test other things as well, but the main things to test here are events, on both the cloned element and the descendants. |
@zdfs I thought we were trying to avoid using other Bliss methods (besides the one being tested) in tests, which I thought was a good idea. Should we document that somewhere, if it's actually a rule? |
@LeaVerou Quick question, this test should pass, no? var element = $.create("div", { class: "parent", contents: "This is the parent" });
element._.delegate("click", "p", function() {
done();
});
var child = $.create("p");
element.appendChild(child);
var clone = $.clone(element);
var ev = document.createEvent("MouseEvent");
ev.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
clone.childNodes[1].dispatchEvent(ev); |
@LeaVerou - Shit. I wasn't aware of that. I've actually been doing the opposite. If that's something you like, we should document it. |
@zdfs I have no strong opinion, it's just something I noticed as a pattern in other tests. I thought it made sense, since if it doesn't pass, we know for a fact which part of Bliss is problematic. Don't go back changing all your tests though! Let's just document it and try to follow it from now on :) @AVGP Oh, nice one! It should pass, yes! Btw, please try to avoid using Bliss functions other than the one being tested (see the side discussion with @zdfs) |
@LeaVerou - It shouldn't be difficult for me to clean my tests up. Do we need to do anything else here? Should we wait for the extraneous Bliss functions to come out? |
@LeaVerou |
|
@LeaVerou Hurray! The test has already payed off :P |
@LeaVerou Does this look good to you now? |
I'll merge this in since everything seems to be passing. If we need to refactor later, we will. |
Taking care of #67