Modified:
/branches/dev/tests/unit/button/button.html
/branches/dev/tests/unit/button/button_core.js
/branches/dev/tests/unit/button/button_options.js
/branches/dev/ui/jquery.ui.button.js
=======================================
--- /branches/dev/tests/unit/button/button.html Sun Jan 3 17:44:34 2010
+++ /branches/dev/tests/unit/button/button.html Tue Jan 5 07:25:05 2010
@@ -49,6 +49,7 @@
<input type="checkbox" id="check" /><label for="check">Toggle</label>
+ <div><input id="submit" type="submit" value="Label" /></div>
</div>
</body>
=======================================
--- /branches/dev/tests/unit/button/button_core.js Tue Jan 5 07:07:27 2010
+++ /branches/dev/tests/unit/button/button_core.js Tue Jan 5 07:25:05 2010
@@ -50,4 +50,11 @@
assert(":eq(1)", ":eq(0)", ":eq(0)");
});
+test("input type submit, don't create child elements", function() {
+ var input = $("#submit")
+ same( input.children().length, 0 );
+ input.button();
+ same( input.children().length, 0 );
+});
+
})(jQuery);
=======================================
--- /branches/dev/tests/unit/button/button_options.js Sun Jan 3 17:48:10
2010
+++ /branches/dev/tests/unit/button/button_options.js Tue Jan 5 07:25:05
2010
@@ -28,7 +28,7 @@
test("label, default", function() {
$("#button").button();
- same( "Label", $("#button").text() );
+ same( $("#button").text(), "Label" );
$("#button").button("destroy");
});
@@ -37,11 +37,22 @@
$("#button").button({
label: "xxx"
});
- same( "xxx", $("#button").text() );
+ same( $("#button").text(), "xxx" );
$("#button").button("destroy");
});
+test("label default with input type submit", function() {
+ same( $("#submit").button().val(), "Label" );
+});
+
+test("label with input type submit", function() {
+ var label = $("#submit").button({
+ label: "xxx"
+ }).val();
+ same( label, "xxx" );
+});
+
test("icons", function() {
$("#button").button({
text: false,
=======================================
--- /branches/dev/ui/jquery.ui.button.js Sun Jan 3 18:19:36 2010
+++ /branches/dev/ui/jquery.ui.button.js Tue Jan 5 07:25:05 2010
@@ -169,6 +169,12 @@
},
_resetButton: function() {
+ if (this.type == 'input') {
+ if (this.options.label) {
+ this.element.val(this.options.label);
+ }
+ return;
+ }
var buttonElement = this.buttonElement,
buttonText = $("<span></span>")
.addClass("ui-button-text")