Permalink
Browse files

version 0.2.1 - bug fixes

  • Loading branch information...
1 parent cc00241 commit e479580c2a548bb42de886df75d596773e14aec1 @gabrielfalcao committed Mar 21, 2010
Showing with 47 additions and 4 deletions.
  1. +4 −0 NEWS.md
  2. +3 −4 jquery.yql.js
  3. +40 −0 tests/test.yql.js
View
@@ -1,5 +1,9 @@
# Changes since latest release:
+## version 0.2.1
+
+* Some bug fixes
+
## version 0.2
* Now it works with any tables, unless its JSONP support is screwed.
View
@@ -7,7 +7,7 @@
*
* http://www.gnu.org/copyleft/gpl.html
*
- * Version: 0.2
+ * Version: 0.2.1
*/
(function($){
@@ -17,8 +17,8 @@
$.each(
params, function (key) {
var name = "#{" + key + "}";
- var value = this;
- if (isNaN(parseInt(value))) {
+ var value = $.trim(this);
+ if (!value.match(/^[0-9]+$/)) {
value = '"' + value + '"';
}
query = query.replace(name, value);
@@ -28,7 +28,6 @@
},
yql: function (query) {
var $self = this;
- var params = {};
var successCallback = null;
if (typeof arguments[1] == 'object') {
View
@@ -84,3 +84,43 @@ asyncTest('Querying a community table (github)', function () {
});
});
+
+test('It should cast into integer only when is suitable', function() {
+ expect(1);
+
+ $.ajax = function (params){
+ equals(params.data.q, 'SELECT * FROM flickr.photos.search WHERE lat = "-12.55" AND lon = "100.23"');
+ }
+
+ $.yql(
+ "SELECT * FROM flickr.photos.search WHERE lat = #{latitude} AND lon = #{longitude}",
+ {
+ latitude: "-12.55",
+ longitude: "100.23",
+ }
+ );
+
+ $.ajax = oldAjax;
+ });
+
+asyncTest('It can fetch lastfm data', function() {
+ expect(1);
+
+ $.yql(
+ "SELECT * FROM lastfm.geo.getevents WHERE api_key=#{key} AND lat=#{latitude} AND long=#{longitude}",
+ {
+ key: "5a2242815c81e144c48b34716014ec7e",
+ latitude: "-23.550511",
+ longitude: "-46.633428"
+ },
+ function (data){
+ try {
+ equal(data.query.results.lfm.status, "ok");
+ }catch (e) {
+ ok(false, "should not reach here");
+ }
+ start();
+ }
+ );
+
+ });

0 comments on commit e479580

Please sign in to comment.