File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 5
5
6
6
module ( "button: tickets" ) ;
7
7
8
+ test ( "#5295 - button does not remove hoverstate if disabled" , function ( ) {
9
+ expect ( 1 ) ;
10
+ var btn = $ ( "#button" ) . button ( ) ;
11
+ btn . hover ( function ( ) {
12
+ btn . button ( "disable" ) ;
13
+ } ) ;
14
+ btn . trigger ( "mouseenter" ) ;
15
+ btn . trigger ( "mouseleave" ) ;
16
+ ok ( ! btn . is ( ".ui-state-hover" ) ) ;
17
+ } ) ;
18
+
8
19
test ( "#5946 - buttonset should ignore buttons that are not :visible" , function ( ) {
9
20
expect ( 2 ) ;
10
21
$ ( "#radio01" ) . next ( ) . andSelf ( ) . hide ( ) ;
Original file line number Diff line number Diff line change @@ -70,21 +70,22 @@ $.widget( "ui.button", {
70
70
var that = this ,
71
71
options = this . options ,
72
72
toggleButton = this . type === "checkbox" || this . type === "radio" ,
73
- hoverClass = "ui-state-hover" + ( ! toggleButton ? " ui-state-active" : "" ) ,
73
+ activeClass = ! toggleButton ? "ui-state-active" : "" ,
74
74
focusClass = "ui-state-focus" ;
75
75
76
76
if ( options . label === null ) {
77
77
options . label = ( this . type === "input" ? this . buttonElement . val ( ) : this . buttonElement . html ( ) ) ;
78
78
}
79
79
80
+ this . _hoverable ( this . buttonElement ) ;
81
+
80
82
this . buttonElement
81
83
. addClass ( baseClasses )
82
84
. attr ( "role" , "button" )
83
85
. bind ( "mouseenter" + this . eventNamespace , function ( ) {
84
86
if ( options . disabled ) {
85
87
return ;
86
88
}
87
- $ ( this ) . addClass ( "ui-state-hover" ) ;
88
89
if ( this === lastActive ) {
89
90
$ ( this ) . addClass ( "ui-state-active" ) ;
90
91
}
@@ -93,7 +94,7 @@ $.widget( "ui.button", {
93
94
if ( options . disabled ) {
94
95
return ;
95
96
}
96
- $ ( this ) . removeClass ( hoverClass ) ;
97
+ $ ( this ) . removeClass ( activeClass ) ;
97
98
} )
98
99
. bind ( "click" + this . eventNamespace , function ( event ) {
99
100
if ( options . disabled ) {
You can’t perform that action at this time.
0 commit comments