Fixed #1070 by converting all setAttribute() values to a string which is what all...
[jquery.git] / test / unit / core.js
index e71de2d..f77d1f8 100644 (file)
@@ -276,7 +276,7 @@ test("attr(Hash)", function() {
 });
 
 test("attr(String, Object)", function() {
-       expect(13);
+       expect(16);
        var div = $("div");
        div.attr("foo", "bar");
        var pass = true;
@@ -302,6 +302,14 @@ test("attr(String, Object)", function() {
        $("#name").attr('maxLength', '10');
        ok( document.getElementById('name').maxLength == '10', 'Set maxlength attribute' );
 
+       // for #1070
+       $("#name").attr('someAttr', '0');
+       equals( $("#name").attr('someAttr'), '0', 'Set attribute to a string of "0"' );
+       $("#name").attr('someAttr', 0);
+       equals( $("#name").attr('someAttr'), 0, 'Set attribute to the number 0' );
+       $("#name").attr('someAttr', 1);
+       equals( $("#name").attr('someAttr'), 1, 'Set attribute to the number 1' );
+
        reset();
 
        var type = $("#check2").attr('type');