diff --git a/README b/README
index 12846a17..f5535b09 100644
--- a/README
+++ b/README
@@ -10,15 +10,16 @@ A. How to get (and contribute) JMVC
http://github.com/jupiterjs/steal and
http://github.com/jupiterjs/jquerymx
- 3. Add steal and javascriptmvc as submodules of your project...
+ 3. Add steal and jquerymx as submodules of your project...
git submodule add git@github.com:_YOU_/steal.git steal
git submodule add git@github.com:_YOU_/jquerymx.git jquery
- * Notice javascriptmvc is under the jquery folder
+ * Notice jquerymx is under the jquery folder
4. Learn a little more about submodules ...
http://johnleach.co.uk/words/archives/2008/10/12/323/git-submodules-in-n-easy-steps
- 5. Make changes in steal or jmvc, and push them back to your fork.
+ 5. Make changes in steal or jquerymx, and push them back to your fork.
6. Make a pull request to your fork.
+
diff --git a/class/class.js b/class/class.js
index fd4cd611..b48d1d00 100644
--- a/class/class.js
+++ b/class/class.js
@@ -2,7 +2,7 @@
// This is a modified version of John Resig's class
// http://ejohn.org/blog/simple-javascript-inheritance/
// It provides class level inheritance and callbacks.
-//@steal-clean
+//!steal-clean
steal("jquery","jquery/lang/string",function( $ ) {
// =============== HELPERS =================
@@ -59,8 +59,9 @@ steal("jquery","jquery/lang/string",function( $ ) {
* @parent jquerymx
* @download dist/jquery/jquery.class.js
* @test jquery/class/qunit.html
+ * @description Easy inheritance in JavaScript.
*
- * Class provides simulated inheritance in JavaScript. Use clss to bridge the gap between
+ * Class provides simulated inheritance in JavaScript. Use Class to bridge the gap between
* jQuery's functional programming style and Object Oriented Programming. It
* is based off John Resig's [http://ejohn.org/blog/simple-javascript-inheritance/|Simple Class]
* Inheritance library. Besides prototypal inheritance, it includes a few important features:
@@ -348,7 +349,7 @@ steal("jquery","jquery/lang/string",function( $ ) {
clss = $.Class = function() {
if (arguments.length) {
- clss.extend.apply(clss, arguments);
+ return clss.extend.apply(clss, arguments);
}
};
@@ -424,13 +425,13 @@ steal("jquery","jquery/lang/string",function( $ ) {
// keep a reference to us in self
self = this;
- //@steal-remove-start
+ //!steal-remove-start
for( var i =0; i< funcs.length;i++ ) {
if(typeof funcs[i] == "string" && !isFunction(this[funcs[i]])){
throw ("class.js "+( this.fullName || this.Class.fullName)+" does not have a "+funcs[i]+"method!");
}
}
- //@steal-remove-end
+ //!steal-remove-end
return function class_cb() {
// add the arguments after the curried args
var cur = concatArgs(args, arguments),
@@ -611,14 +612,14 @@ steal("jquery","jquery/lang/string",function( $ ) {
current = getObject(parts.join('.'), window, true),
namespace = current;
- //@steal-remove-start
+ //!steal-remove-start
if (!Class.nameOk ) {
//steal.dev.isHappyName(fullName)
}
if(current[shortName]){
steal.dev.warn("class.js There's already something called "+fullName)
}
- //@steal-remove-end
+ //!steal-remove-end
current[shortName] = Class;
}
@@ -667,7 +668,7 @@ steal("jquery","jquery/lang/string",function( $ ) {
// call the class init
if ( Class.init ) {
- Class.init.apply(Class, args || []);
+ Class.init.apply(Class, args || concatArgs([_super_class],arguments));
}
/* @Prototype*/
@@ -781,4 +782,4 @@ steal("jquery","jquery/lang/string",function( $ ) {
proxy = clss.proxy;
-})();
\ No newline at end of file
+})();
diff --git a/controller/controller.js b/controller/controller.js
index 82c4c290..f3bd8476 100644
--- a/controller/controller.js
+++ b/controller/controller.js
@@ -80,6 +80,7 @@ steal('jquery/class', 'jquery/lang/string', 'jquery/event/destroyed', function(
* @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/controller/controller.js
* @test jquery/controller/qunit.html
* @inherits jQuery.Class
+ * @description jQuery widget factory.
*
* jQuery.Controller helps create organized, memory-leak free, rapidly performing
* jQuery widgets. Its extreme flexibility allows it to serve as both
@@ -222,7 +223,7 @@ steal('jquery/class', 'jquery/lang/string', 'jquery/event/destroyed', function(
* el.css("backgroundColor","")
* },
* ".create click" : function() {
- * this.find("ol").append("<li class='todo'>New Todo</li>");
+ * this.find("ol").append("
New Todo
");
* }
* })
*
@@ -393,11 +394,11 @@ steal('jquery/class', 'jquery/lang/string', 'jquery/event/destroyed', function(
}
// make sure listensTo is an array
- //@steal-remove-start
+ //!steal-remove-start
if (!isArray(this.listensTo) ) {
throw "listensTo is not an array in " + this.fullName;
}
- //@steal-remove-end
+ //!steal-remove-end
// calculate and cache actions
this.actions = {};
@@ -611,7 +612,8 @@ steal('jquery/class', 'jquery/lang/string', 'jquery/event/destroyed', function(
var funcName, ready, cls = this[STR_CONSTRUCTOR];
//want the raw element here
- element = element.jquery ? element[0] : element;
+ element = (typeof element == 'string' ? $(element) :
+ (element.jquery ? element : [element]) )[0];
//set element and className on element
var pluginname = cls.pluginName || cls._fullName;
@@ -726,7 +728,12 @@ steal('jquery/class', 'jquery/lang/string', 'jquery/event/destroyed', function(
* }
* }
*/
- return this.element;
+ return [this.element, this.options].concat(makeArray(arguments).slice(2));
+ /**
+ * @function init
+ *
+ * Implement this.
+ */
},
/**
* Bind attaches event handlers that will be
@@ -1079,4 +1086,4 @@ steal('jquery/class', 'jquery/lang/string', 'jquery/event/destroyed', function(
});
-});
\ No newline at end of file
+});
diff --git a/controller/route/qunit.html b/controller/route/qunit.html
new file mode 100644
index 00000000..25edc491
--- /dev/null
+++ b/controller/route/qunit.html
@@ -0,0 +1,18 @@
+
+
+
+
+ route QUnit Test
+
+
+
+
+
route Test Suite
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/controller/route/route.html b/controller/route/route.html
new file mode 100644
index 00000000..178af929
--- /dev/null
+++ b/controller/route/route.html
@@ -0,0 +1,35 @@
+
+
+
+ route
+
+
+
+
route Demo
+ foo/bar
+ foo/car
+ empty
+
+
+
+
\ No newline at end of file
diff --git a/controller/route/route.js b/controller/route/route.js
index 0e0228c4..bc0f1c67 100644
--- a/controller/route/route.js
+++ b/controller/route/route.js
@@ -8,7 +8,24 @@ steal('jquery/dom/route','jquery/controller', function(){
* @param {Object} selector
* @param {Object} cb
*/
- jQuery.Controller.processors.route = function(el, event, selector, cb){
-
+ jQuery.Controller.processors.route = function(el, event, selector, funcName, controller){
+ $.route(selector||"")
+ var batchNum;
+ var check = function(ev, attr, how){
+ if($.route.attr('route') === (selector||"") &&
+ (ev.batchNum === undefined || ev.batchNum !== batchNum ) ){
+
+ batchNum = ev.batchNum;
+
+ var d = $.route.attrs();
+ delete d.route;
+
+ controller[funcName](d)
+ }
+ }
+ $.route.bind('change',check);
+ return function(){
+ $.route.unbind('change',check)
+ }
}
})
diff --git a/controller/route/route_test.js b/controller/route/route_test.js
new file mode 100644
index 00000000..6a140d6b
--- /dev/null
+++ b/controller/route/route_test.js
@@ -0,0 +1,10 @@
+steal('funcunit/qunit','./route',function(){
+
+module("route");
+
+test("route testing works", function(){
+ ok(true,"an assert is run");
+});
+
+
+});
\ No newline at end of file
diff --git a/controller/view/view.js b/controller/view/view.js
index 5c05345f..c248fa5c 100644
--- a/controller/view/view.js
+++ b/controller/view/view.js
@@ -1,4 +1,6 @@
steal('jquery/controller', 'jquery/view').then(function( $ ) {
+ var URI = steal.URI || steal.File;
+
jQuery.Controller.getFolder = function() {
return jQuery.String.underscore(this.fullName.replace(/\./g, "/")).replace("/Controllers", "");
};
@@ -19,10 +21,10 @@ steal('jquery/controller', 'jquery/view').then(function( $ ) {
if ( typeof view == "string" ) {
if ( view.substr(0, 2) == "//" ) { //leave where it is
} else {
- view = "//" + new steal.File('views/' + (view.indexOf('/') !== -1 ? view : (hasControllers ? controller_name + '/' : "") + view)).joinFrom(path) + suffix;
+ view = "//" + URI(path).join( 'views/' + (view.indexOf('/') !== -1 ? view : (hasControllers ? controller_name + '/' : "") + view)) + suffix;
}
} else if (!view ) {
- view = "//" + new steal.File('views/' + (hasControllers ? controller_name + '/' : "") + action_name.replace(/\.|#/g, '').replace(/ /g, '_')).joinFrom(path) + suffix;
+ view = "//" + URI(path).join('views/' + (hasControllers ? controller_name + '/' : "") + action_name.replace(/\.|#/g, '').replace(/ /g, '_'))+ suffix;
}
return view;
};
@@ -45,12 +47,14 @@ steal('jquery/controller', 'jquery/view').then(function( $ ) {
var current = window;
var parts = this.constructor.fullName.split(/\./);
for ( var i = 0; i < parts.length; i++ ) {
- if ( typeof current.Helpers == 'object' ) {
- jQuery.extend(helpers, current.Helpers);
+ if(current){
+ if ( typeof current.Helpers == 'object' ) {
+ jQuery.extend(helpers, current.Helpers);
+ }
+ current = current[parts[i]];
}
- current = current[parts[i]];
}
- if ( typeof current.Helpers == 'object' ) {
+ if (current && typeof current.Helpers == 'object' ) {
jQuery.extend(helpers, current.Helpers);
}
this._default_helpers = helpers;
diff --git a/dom/dom.js b/dom/dom.js
index 9343b5c9..a47d8438 100644
--- a/dom/dom.js
+++ b/dom/dom.js
@@ -1,6 +1,8 @@
/**
@page dom DOM Helpers
@parent jquerymx
+@description jQuery DOM extension.
+
JavaScriptMVC adds a bunch of useful
jQuery extensions for the dom. Check them out on the left.
diff --git a/dom/fixture/fixture.js b/dom/fixture/fixture.js
index 07df8d8d..672b5a7b 100644
--- a/dom/fixture/fixture.js
+++ b/dom/fixture/fixture.js
@@ -35,11 +35,14 @@ steal('jquery/dom',
var url = settings.fixture;
if (/^\/\//.test(url) ) {
- url = steal.root.join(settings.fixture.substr(2));
+ var sub = settings.fixture.substr(2) + '';
+ url = typeof steal === "undefined" ?
+ url = "/" + sub :
+ steal.root.mapJoin(sub) +'';
}
- //@steal-remove-start
+ //!steal-remove-start
steal.dev.log("looking for fixture in " + url);
- //@steal-remove-end
+ //!steal-remove-end
settings.url = url;
settings.data = null;
settings.type = "GET";
@@ -50,9 +53,9 @@ steal('jquery/dom',
}
}else {
- //@steal-remove-start
+ //!steal-remove-start
steal.dev.log("using a dynamic fixture for " +settings.type+" "+ settings.url);
- //@steal-remove-end
+ //!steal-remove-end
//it's a function ... add the fixture datatype so our fixture transport handles it
// TODO: make everything go here for timing and other fun stuff
@@ -429,9 +432,10 @@ steal('jquery/dom',
// gets data from a url like "/todo/{id}" given "todo/5"
_getData : function(fixtureUrl, url){
var order = [],
- res = new RegExp(fixtureUrl.replace(replacer, function(whole, part){
+ fixtureUrlAdjusted = fixtureUrl.replace('.', '\\.').replace('?', '\\?'),
+ res = new RegExp(fixtureUrlAdjusted.replace(replacer, function(whole, part){
order.push(part)
- return "([^\/])+"
+ return "([^\/]+)"
})+"$").exec(url),
data = {};
@@ -897,4 +901,6 @@ steal('jquery/dom',
* }
*
*/
-});
\ No newline at end of file
+ //Expose this for fixture debugging
+ $.fixture.overwrites = overwrites;
+});
diff --git a/dom/fixture/fixture_test.js b/dom/fixture/fixture_test.js
index 581355c1..7559d1ba 100644
--- a/dom/fixture/fixture_test.js
+++ b/dom/fixture/fixture_test.js
@@ -1,10 +1,11 @@
+
steal("jquery/dom/fixture", "jquery/model",'funcunit/qunit',function(){
module("jquery/dom/fixture");
test("static fixtures", function(){
- stop(3000);
+ stop();
$.fixture("GET something", "//jquery/dom/fixture/fixtures/test.json");
$.fixture("POST something", "//jquery/dom/fixture/fixtures/test.json");
@@ -40,7 +41,7 @@ test("dynamic fixtures",function(){
test("fixture function", 3, function(){
stop();
- var url = steal.root.join("jquery/dom/fixture/fixtures/foo.json");
+ var url = steal.root.join("jquery/dom/fixture/fixtures/foo.json")+'';
$.fixture(url,"//jquery/dom/fixture/fixtures/foobar.json" );
$.get(url,function(data){
@@ -76,7 +77,7 @@ test("fixtures with converters", function(){
stop();
$.ajax( {
- url : steal.root.join("jquery/dom/fixture/fixtures/foobar.json"),
+ url : steal.root.join("jquery/dom/fixture/fixtures/foobar.json")+'',
dataType: "json fooBar",
converters: {
"json fooBar": function( data ) {
@@ -184,8 +185,15 @@ test("rand", function(){
test("_getData", function(){
var data = $.fixture._getData("/thingers/{id}", "/thingers/5");
equals(data.id, 5, "gets data");
+ var data = $.fixture._getData("/thingers/5?hi.there", "/thingers/5?hi.there");
+ deepEqual(data, {}, "gets data");
})
+test("_getData with double character value", function(){
+ var data = $.fixture._getData("/days/{id}/time_slots.json", "/days/17/time_slots.json");
+ equals(data.id, 17, "gets data");
+});
+
test("_compare", function(){
var same = $.Object.same(
{url : "/thingers/5"},
@@ -234,7 +242,7 @@ test("fixture function gets id", function(){
name: "justin"
}
})
- stop(3000);
+ stop();
$.get("/thingers/5", {}, function(data){
start();
ok(data.id)
@@ -242,7 +250,7 @@ test("fixture function gets id", function(){
});
test("replacing and removing a fixture", function(){
- var url = steal.root.join("jquery/dom/fixture/fixtures/remove.json")
+ var url = steal.root.join("jquery/dom/fixture/fixtures/remove.json")+''
$.fixture("GET "+url, function(){
return {weird: "ness!"}
})
@@ -263,7 +271,7 @@ test("replacing and removing a fixture", function(){
equals(json.weird,"ness","fixture set right");
start();
- });
+ },'json');
},'json')
@@ -271,8 +279,51 @@ test("replacing and removing a fixture", function(){
},'json')
+});
+
+return; // future fixture stuff
+
+// returning undefined means you want to control timing?
+$.fixture('GET /foo', function(orig, settings, headers, cb){
+ setTimeout(function(){
+ cb(200, "success",{json : "{}"},{})
+ },1000);
+})
+
+// fixture that hooks into model / vice versa?
+
+// fixture that creates a nice store
+
+var store = $.fixture.store(1000, function(){
+
})
+store.find()
+
+// make cloud
+
+var clouds = $.fixture.store(1, function(){
+ return {
+ name: "ESCCloud",
+ DN : "ESCCloud-ESCCloud",
+ type : "ESCCloud"
+ }
+});
+
+var computeCluster = $.fixture.store(5, function(i){
+ return {
+ name : "",
+ parentDN : clouds.find()[0].DN,
+ type: "ComputeCluster",
+ DN : "ComputeCluster-ComputeCluster"+i
+ }
+});
+
+$.fixture("GET /computeclusters", function(){
+ return []
+});
+
+// hacking models?
diff --git a/dom/form_params/form_params.js b/dom/form_params/form_params.js
index a47ca517..0234c4d4 100644
--- a/dom/form_params/form_params.js
+++ b/dom/form_params/form_params.js
@@ -2,22 +2,58 @@
* @add jQuery.fn
*/
steal("jquery/dom").then(function( $ ) {
- var radioCheck = /radio|checkbox/i,
- keyBreaker = /[^\[\]]+/g,
- numberMatcher = /^[\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?$/;
+ var keyBreaker = /[^\[\]]+/g,
+ convertValue = function( value ) {
+ if ( $.isNumeric( value )) {
+ return parseFloat( value );
+ } else if ( value === 'true') {
+ return true;
+ } else if ( value === 'false' ) {
+ return false;
+ } else if ( value === '' ) {
+ return undefined;
+ }
+ return value;
+ },
+ nestData = function( elem, type, data, parts, value, seen ) {
+ var name = parts.shift();
- var isNumber = function( value ) {
- if ( typeof value == 'number' ) {
- return true;
- }
+ if ( parts.length ) {
+ if ( ! data[ name ] ) {
+ data[ name ] = {};
+ }
+ // Recursive call
+ nestData( elem, type, data[ name ], parts, value, seen );
+ } else {
- if ( typeof value != 'string' ) {
- return false;
- }
+ // Handle same name case, as well as "last checkbox checked"
+ // case
+ if ( name in seen && type != "radio" && ! $.isArray( data[ name ] )) {
+ if ( name in data ) {
+ data[ name ] = [ data[name] ];
+ } else {
+ data[ name ] = [];
+ }
+ } else {
+ seen[ name ] = true;
+ }
+
+ // Finally, assign data
+ if ( ( type == "radio" || type == "checkbox" ) && ! elem.is(":checked") ) {
+ return
+ }
- return value.match(numberMatcher);
- };
+ if ( ! data[ name ] ) {
+ data[ name ] = value;
+ } else {
+ data[ name ].push( value );
+ }
+
+
+ }
+ };
+
$.fn.extend({
/**
* @parent dom
@@ -28,6 +64,9 @@ steal("jquery/dom").then(function( $ ) {
* Returns an object of name-value pairs that represents values in a form.
* It is able to nest values whose element's name has square brackets.
*
+ * When convert is set to true strings that represent numbers and booleans will
+ * be converted and empty string will not be added to the object.
+ *
* Example html:
* @codestart html
* <form>
@@ -42,76 +81,99 @@ steal("jquery/dom").then(function( $ ) {
*
* @demo jquery/dom/form_params/form_params.html
*
- * @param {Boolean} [convert=false] True if strings that look like numbers and booleans should be converted. Defaults to true.
+ * @param {Object} [params] If an object is passed, the form will be repopulated
+ * with the values of the object based on the name of the inputs within
+ * the form
+ * @param {Boolean} [convert=false] True if strings that look like numbers
+ * and booleans should be converted and if empty string should not be added
+ * to the result. Defaults to false.
* @return {Object} An object of name-value pairs.
*/
- formParams: function( convert ) {
- if ( this[0].nodeName.toLowerCase() == 'form' && this[0].elements ) {
+ formParams: function( params ) {
- return jQuery(jQuery.makeArray(this[0].elements)).getParams(convert);
+ var convert;
+
+ // Quick way to determine if something is a boolean
+ if ( !! params === params ) {
+ convert = params;
+ params = null;
+ }
+
+ if ( params ) {
+ return this.setParams( params );
+ } else {
+ return this.getParams( convert );
}
- return jQuery("input[name], textarea[name], select[name]", this[0]).getParams(convert);
+ },
+ setParams: function( params ) {
+
+ // Find all the inputs
+ this.find("[name]").each(function() {
+
+ var value = params[ $(this).attr("name") ],
+ $this;
+
+ // Don't do all this work if there's no value
+ if ( value !== undefined ) {
+ $this = $(this);
+
+ // Nested these if statements for performance
+ if ( $this.is(":radio") ) {
+ if ( $this.val() == value ) {
+ $this.attr("checked", true);
+ }
+ } else if ( $this.is(":checkbox") ) {
+ // Convert single value to an array to reduce
+ // complexity
+ value = $.isArray( value ) ? value : [value];
+ if ( $.inArray( $this.val(), value ) > -1) {
+ $this.attr("checked", true);
+ }
+ } else {
+ $this.val( value );
+ }
+ }
+ });
},
getParams: function( convert ) {
var data = {},
+ // This is used to keep track of the checkbox names that we've
+ // already seen, so we know that we should return an array if
+ // we see it multiple times. Fixes last checkbox checked bug.
+ seen = {},
current;
- convert = convert === undefined ? false : convert;
- this.each(function() {
- var el = this,
- type = el.type && el.type.toLowerCase();
- //if we are submit, ignore
- if ((type == 'submit') || !el.name ) {
+ this.find("[name]").each(function() {
+ var $this = $(this),
+ type = $this.attr("type"),
+ name = $this.attr("name"),
+ value = $this.val(),
+ parts;
+
+ // Don't accumulate submit buttons and nameless elements
+ if ( type == "submit" || ! name ) {
return;
}
- var key = el.name,
- value = $.data(el, "value") || $.fn.val.call([el]),
- isRadioCheck = radioCheck.test(el.type),
- parts = key.match(keyBreaker),
- write = !isRadioCheck || !! el.checked,
- //make an array of values
- lastPart;
-
- if ( convert ) {
- if ( isNumber(value) ) {
- value = parseFloat(value);
- } else if ( value === 'true') {
- value = true;
- } else if ( value === 'false' ) {
- value = false;
- }
- if(value === '') {
- value = undefined;
- }
+ // Figure out name parts
+ parts = name.match( keyBreaker );
+ if ( ! parts.length ) {
+ parts = [name];
}
- // go through and create nested objects
- current = data;
- for ( var i = 0; i < parts.length - 1; i++ ) {
- if (!current[parts[i]] ) {
- current[parts[i]] = {};
- }
- current = current[parts[i]];
+ // Convert the value
+ if ( convert ) {
+ value = convertValue( value );
}
- lastPart = parts[parts.length - 1];
- //now we are on the last part, set the value
- if ( lastPart in current && type === "checkbox" ) {
- if (!$.isArray(current[lastPart]) ) {
- current[lastPart] = current[lastPart] === undefined ? [] : [current[lastPart]];
- }
- if ( write ) {
- current[lastPart].push(value);
- }
- } else if ( write || !current[lastPart] ) {
- current[lastPart] = write ? value : undefined;
- }
+ // Assign data recursively
+ nestData( $this, type, data, parts, value, seen );
});
+
return data;
}
});
-});
\ No newline at end of file
+});
diff --git a/dom/form_params/form_params_test.js b/dom/form_params/form_params_test.js
index 44c2c2b1..2a9e2f3c 100644
--- a/dom/form_params/form_params_test.js
+++ b/dom/form_params/form_params_test.js
@@ -10,6 +10,7 @@ module("jquery/dom/form_params")
test("with a form", function(){
$("#qunit-test-area").html("//jquery/dom/form_params/test/basics.micro",{})
+
var formParams = $("#qunit-test-area form").formParams() ;
ok(formParams.params.one === "1","one is right");
@@ -17,12 +18,26 @@ test("with a form", function(){
ok(formParams.params.three === "3","three is right");
same(formParams.params.four,["4","1"],"four is right");
same(formParams.params.five,["2","3"],"five is right");
-
equal(typeof formParams.id , 'string', "Id value is empty");
+ equal( typeof formParams.singleRadio, "string", "Type of single named radio is string" );
+ equal( formParams.singleRadio, "2", "Value of single named radio is right" );
+
+ ok( $.isArray(formParams.lastOneChecked), "Type of checkbox with last option checked is array" );
+ equal( formParams.lastOneChecked, "4", "Value of checkbox with the last option checked is 4" );
});
+test("With a non-form element", function() {
+
+ $("#qunit-test-area").html("//jquery/dom/form_params/test/non-form.micro",{})
+
+ var formParams = $("#divform").formParams() ;
+
+ equal( formParams.id , "foo-bar-baz", "ID input read correctly" );
+
+});
+
test("with true false", function(){
$("#qunit-test-area").html("//jquery/dom/form_params/test/truthy.micro",{});
@@ -44,7 +59,15 @@ test("just strings",function(){
same(formParams.params.four,["4","1"],"four is right");
same(formParams.params.five,['2','3'],"five is right");
$("#qunit-test-area").html('')
-})
+});
+
+test("empty string conversion",function() {
+ $("#qunit-test-area").html("//jquery/dom/form_params/test/basics.micro",{});
+ var formParams = $("#qunit-test-area form").formParams(false) ;
+ ok('' === formParams.empty, 'Default empty string conversion');
+ formParams = $("#qunit-test-area form").formParams(true);
+ ok(undefined === formParams.empty, 'Default empty string conversion');
+});
test("missing names",function(){
$("#qunit-test-area").html("//jquery/dom/form_params/test/checkbox.micro",{});
@@ -52,4 +75,10 @@ test("missing names",function(){
ok(true, "does not break")
});
-});
\ No newline at end of file
+test("same input names to array", function() {
+ $("#qunit-test-area").html("//jquery/dom/form_params/test/basics.micro",{});
+ var formParams = $("#qunit-test-area form").formParams(true);
+ same(formParams.param1, ['first', 'second', 'third']);
+});
+
+});
diff --git a/dom/form_params/test/basics.micro b/dom/form_params/test/basics.micro
index 5c5b5be8..14e76957 100644
--- a/dom/form_params/test/basics.micro
+++ b/dom/form_params/test/basics.micro
@@ -11,8 +11,12 @@
+
+
+
+
-
+