-
Notifications
You must be signed in to change notification settings - Fork 102
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
Need Help for testing #47
Comments
Hey there, thanks for contributing! $('#tete li')._.fire("click"); (in a rush so haven’t checked the rest of the code) |
Thank for the answer. When i use the fire function, i have no error but it didn't fire the click function from the $.delegate $('#tete li').click();
//replace by
$('#tete li')._.fire("click"); I don't know if i have to open an other issue. But when i try to create an element with the property 'events', i get an error: $.create("a", {
href: "#here",
title: "Permalink",
className: "permalink",
events: {
click: function(evt) {
console.log("test")
}
}
});
|
I think you're using an older version. Please pull? |
Ok, i update my fork and it works. My bad here Anyway for the test of delegate, it still doesn't work. it("add event on children of subject", function() {
var test = false;
var subject = document.createElement("div");
subject.id = "tete";
var aa = $.create("a", {
href: "#here",
title: "Permalink",
className: "permalink",
events: {
click: function(evt) {
console.log("testa")
}
}
});
subject.appendChild(aa)
document.body.appendChild(subject);
var tt = subject._.delegate("click",
{
a: function(){
console.log("tea");
test = true;
}
});
$('#tete a')._.fire('click');
expect(test).to.be.equal(true);
});
So when i fire 'click', the callback from the $.create works but the one from delegate doesn't. |
Based on a test by @wcastand in LeaVerou#47. (Thanks!) This seems to fail on PhantomJS due because Element.matches (used in $.delegate) is unavaiable. Changing $.delegate to use Element.webkitMatchesSelector makes the test pass. This test passes as is on Chrome and Firefox Developer.
Based on a test by @wcastand in LeaVerou#47. (Thanks!) This seems to fail on PhantomJS due because Element.matches (used in $.delegate) is unavailable. Changing $.delegate to use Element.webkitMatchesSelector makes the test pass. This test passes as is on Chrome and Firefox Developer.
So I rewrote the test to work independently of other Bliss methods. (I hope you don't mind, @wcastand.) I think the issue here is that
indicating that [Note: I force-pushed over commit 39c214e, so that's why it shows up twice. Didn't know the mention wouldn't go away. Sorry!] |
Hi, |
This begs the question, should we have tests that only execute in a real browser and tests that execute in a headless env? The strategy being that we try to make something work in Phantom, and if we can't, save it for when the developer is using a real browser. Just throwing out ideas. |
Honestly, I wouldn't mind. PhantomJS is being really buggy for me on watch mode. I'll |
I actually had the same issue when i was trying to figure it out delegate. Sometime my test just didn't pass on my DelegateSpec.js and at one point i get an error on a bliss file. i just save the file again and the error disappear. |
Actually, maybe we can use Firefox. Travis-ci seems to have support for that. |
I'm going to change our config to Firefox, and see if Travis builds. Probably better if we use a real browser if Travis supports one. |
This seems to be working completely on my local now, hopefully Travis-CI follows.
Ok. I think I'm almost there. |
Ok. It seems to be running the tests with Firefox now, but can anyone tell me if it's really running the tests or not. It seems like it is, but the counts are off: https://travis-ci.org/LeaVerou/bliss/jobs/95623030 |
According to the screenshot here (http://www.sitepoint.com/testing-javascript-jasmine-travis-karma/), it seems like that's the normal behavior. |
Okay, great. I don't think there's any cleanup that needs to be done. |
Close this one out then? |
Sure. |
Thank you all! |
Firefox is already on Travis. From what I've read, it seemed like I would need steps to build and install Chrome. I can try Chrome and see what happens. We can always go back to Firefox. |
I'm curious now. Going to try it. |
Given that Chrome has a much higher market share, I’d prioritize that. But if it's too much of a hassle, Firefox is fine! |
Ok. Looks like we can't start Chrome. I can get this to work. I've done it on Wercker. But it's going to take me a few tries. I don't mind. |
Chrome is set. Closing this out. |
Good work! |
@zdfs if we are going to run the suite in Chrome, should i back out that change i made to get the |
You can do that. I can merge something like that as opposed to changes that affect core code. |
Based on a test by @wcastand in LeaVerou#47. (Thanks!) This seems to fail on PhantomJS due because Element.matches (used in $.delegate) is unavailable. Changing $.delegate to use Element.webkitMatchesSelector makes the test pass. This test passes as is on Chrome and Firefox Developer.
Thank you so much @zdfs! |
Hi, i wanted to contribute so i decide to test the Events.
But i can't figure it out what i'm doing wrong here :
My file called "DelegateSpec.js" in the folder "tests/Events/" and i get this error by karma:
I'm quite new at testing (and already hate that :-P), so be nice with me please :-)
The text was updated successfully, but these errors were encountered: