mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Button: Corrected default label applied to submit buttons. Fixed #8337: Submit inputs don't automatically set label option.
This commit is contained in:
parent
286941ef8d
commit
1f1613852c
@ -53,6 +53,7 @@ test("text false with icon", function() {
|
||||
test("label, default", function() {
|
||||
$("#button").button();
|
||||
deepEqual( $("#button").text(), "Label" );
|
||||
deepEqual( $( "#button").button( "option", "label" ), "Label" );
|
||||
|
||||
$("#button").button("destroy");
|
||||
});
|
||||
@ -62,12 +63,14 @@ test("label", function() {
|
||||
label: "xxx"
|
||||
});
|
||||
deepEqual( $("#button").text(), "xxx" );
|
||||
deepEqual( $("#button").button( "option", "label" ), "xxx" );
|
||||
|
||||
$("#button").button("destroy");
|
||||
});
|
||||
|
||||
test("label default with input type submit", function() {
|
||||
deepEqual( $("#submit").button().val(), "Label" );
|
||||
deepEqual( $("#submit").button( "option", "label" ), "Label" );
|
||||
});
|
||||
|
||||
test("label with input type submit", function() {
|
||||
@ -75,6 +78,7 @@ test("label with input type submit", function() {
|
||||
label: "xxx"
|
||||
}).val();
|
||||
deepEqual( label, "xxx" );
|
||||
deepEqual( $("#submit").button( "option", "label" ), "xxx" );
|
||||
});
|
||||
|
||||
test("icons", function() {
|
||||
|
2
ui/jquery.ui.button.js
vendored
2
ui/jquery.ui.button.js
vendored
@ -73,7 +73,7 @@ $.widget( "ui.button", {
|
||||
focusClass = "ui-state-focus";
|
||||
|
||||
if ( options.label === null ) {
|
||||
options.label = this.buttonElement.html();
|
||||
options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
|
||||
}
|
||||
|
||||
this.buttonElement
|
||||
|
Loading…
Reference in New Issue
Block a user