File tree Expand file tree Collapse file tree 2 files changed +55
-2
lines changed
shelly/plotlyjs/static/plotlyjs Expand file tree Collapse file tree 2 files changed +55
-2
lines changed Original file line number Diff line number Diff line change @@ -73,10 +73,10 @@ var Events = {
73
73
* Now run all the node style event handlers
74
74
*/
75
75
var ev = plotObj . _ev ;
76
- if ( ! ev ) return ;
76
+ if ( ! ev ) return jQueryHandlerValue ;
77
77
78
78
var handlers = ev . _events [ event ] ;
79
- if ( ! handlers ) return ;
79
+ if ( ! handlers ) return jQueryHandlerValue ;
80
80
81
81
/*
82
82
* handlers can be function or an array of functions
Original file line number Diff line number Diff line change @@ -100,6 +100,59 @@ describe('Events', function () {
100
100
expect ( result ) . toBe ( 'pong' ) ;
101
101
} ) ;
102
102
103
+ it ( 'triggers jQuery handlers when no node events initialized' , function ( ) {
104
+ var eventBaton = 0 ;
105
+
106
+ Events . init ( plotDiv ) ;
107
+
108
+ $ ( plotDiv ) . bind ( 'ping' , function ( ) {
109
+ eventBaton ++ ;
110
+ return 'ping' ;
111
+ } ) ;
112
+
113
+ /*
114
+ * This will not be called
115
+ */
116
+ plotDiv . on ( 'pong' , function ( ) {
117
+ eventBaton ++ ;
118
+ return 'ping' ;
119
+ } ) ;
120
+
121
+ $ ( plotDiv ) . bind ( 'ping' , function ( ) {
122
+ eventBaton ++ ;
123
+ return 'pong' ;
124
+ } ) ;
125
+
126
+ var result = Events . triggerHandler ( plotDiv , 'ping' ) ;
127
+
128
+ expect ( eventBaton ) . toBe ( 2 ) ;
129
+ expect ( result ) . toBe ( 'pong' ) ;
130
+ } ) ;
131
+
132
+ it ( 'triggers jQuery handlers when no matching node events bound' , function ( ) {
133
+ var eventBaton = 0 ;
134
+
135
+ $ ( plotDiv ) . bind ( 'ping' , function ( ) {
136
+ eventBaton ++ ;
137
+ return 'ping' ;
138
+ } ) ;
139
+
140
+ $ ( plotDiv ) . bind ( 'ping' , function ( ) {
141
+ eventBaton ++ ;
142
+ return 'ping' ;
143
+ } ) ;
144
+
145
+ $ ( plotDiv ) . bind ( 'ping' , function ( ) {
146
+ eventBaton ++ ;
147
+ return 'pong' ;
148
+ } ) ;
149
+
150
+ var result = Events . triggerHandler ( plotDiv , 'ping' ) ;
151
+
152
+ expect ( eventBaton ) . toBe ( 3 ) ;
153
+ expect ( result ) . toBe ( 'pong' ) ;
154
+ } ) ;
155
+
103
156
104
157
it ( 'triggers jQuery + nodejs handlers and returns last jQuery value' , function ( ) {
105
158
var eventBaton = 0 ;
You can’t perform that action at this time.
0 commit comments