Merge lp:~raoul-snyman/openlp/upgrade-jquery-2.4 into lp:openlp/2.4

Proposed by Raoul Snyman
Status: Merged
Merged at revision: 2662
Proposed branch: lp:~raoul-snyman/openlp/upgrade-jquery-2.4
Merge into: lp:openlp/2.4
Diff against target: 922 lines (+824/-35)
5 files modified
openlp/plugins/remotes/html/index.html (+12/-11)
openlp/plugins/remotes/html/jquery-migrate.js (+752/-0)
openlp/plugins/remotes/html/jquery-migrate.min.js (+2/-0)
openlp/plugins/remotes/html/openlp.js (+26/-24)
tests/interfaces/openlp_core_ui/test_shortcutlistform.py (+32/-0)
To merge this branch: bzr merge lp:~raoul-snyman/openlp/upgrade-jquery-2.4
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Tomas Groth Pending
Review via email: mp+313387@code.launchpad.net

This proposal supersedes a proposal from 2016-12-14.

To post a comment you must log in.
Revision history for this message
Tomas Groth (tomasgroth) wrote : Posted in a previous version of this proposal

"Once and for all" are rather big words ;)

review: Approve
Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Should we have console.log code here

review: Needs Fixing
Revision history for this message
Tim Bentley (trb143) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/plugins/remotes/html/index.html'
--- openlp/plugins/remotes/html/index.html 2016-01-10 16:00:05 +0000
+++ openlp/plugins/remotes/html/index.html 2016-12-15 18:14:46 +0000
@@ -27,17 +27,6 @@
27 <link rel="stylesheet" href="/files/jquery.mobile.min.css" />27 <link rel="stylesheet" href="/files/jquery.mobile.min.css" />
28 <link rel="stylesheet" href="/files/openlp.css" />28 <link rel="stylesheet" href="/files/openlp.css" />
29 <link rel="shortcut icon" type="image/x-icon" href="/files/images/favicon.ico">29 <link rel="shortcut icon" type="image/x-icon" href="/files/images/favicon.ico">
30 <script type="text/javascript" src="/files/jquery.min.js"></script>
31 <script type="text/javascript" src="/files/openlp.js"></script>
32 <script type="text/javascript" src="/files/jquery.mobile.min.js"></script>
33 <script type="text/javascript">
34 translationStrings = {
35 "go_live": "${go_live}",
36 "add_to_service": "${add_to_service}",
37 "no_results": "${no_results}",
38 "home": "${home}"
39 }
40 </script>
41</head>30</head>
42<body>31<body>
43<div data-role="page" id="home">32<div data-role="page" id="home">
@@ -173,5 +162,17 @@
173 <a href="#" id="add-and-go-to-service" data-role="button">${add_and_go_to_service}</a>162 <a href="#" id="add-and-go-to-service" data-role="button">${add_and_go_to_service}</a>
174 </div>163 </div>
175</div>164</div>
165<script type="text/javascript" src="/files/jquery.min.js"></script>
166<script type="text/javascript" src="/files/jquery-migrate.min.js"></script>
167<script type="text/javascript" src="/files/jquery.mobile.min.js"></script>
168<script type="text/javascript" src="/files/openlp.js"></script>
169<script type="text/javascript">
170translationStrings = {
171 "go_live": "${go_live}",
172 "add_to_service": "${add_to_service}",
173 "no_results": "${no_results}",
174 "home": "${home}"
175};
176</script>
176</body>177</body>
177</html>178</html>
178179
=== added file 'openlp/plugins/remotes/html/jquery-migrate.js'
--- openlp/plugins/remotes/html/jquery-migrate.js 1970-01-01 00:00:00 +0000
+++ openlp/plugins/remotes/html/jquery-migrate.js 2016-12-15 18:14:46 +0000
@@ -0,0 +1,752 @@
1/*!
2 * jQuery Migrate - v1.4.1 - 2016-05-19
3 * Copyright jQuery Foundation and other contributors
4 */
5(function( jQuery, window, undefined ) {
6// See http://bugs.jquery.com/ticket/13335
7// "use strict";
8
9
10jQuery.migrateVersion = "1.4.1";
11
12
13var warnedAbout = {};
14
15// List of warnings already given; public read only
16jQuery.migrateWarnings = [];
17
18// Set to true to prevent console output; migrateWarnings still maintained
19// jQuery.migrateMute = false;
20
21// Show a message on the console so devs know we're active
22if ( window.console && window.console.log ) {
23 window.console.log( "JQMIGRATE: Migrate is installed" +
24 ( jQuery.migrateMute ? "" : " with logging active" ) +
25 ", version " + jQuery.migrateVersion );
26}
27
28// Set to false to disable traces that appear with warnings
29if ( jQuery.migrateTrace === undefined ) {
30 jQuery.migrateTrace = true;
31}
32
33// Forget any warnings we've already given; public
34jQuery.migrateReset = function() {
35 warnedAbout = {};
36 jQuery.migrateWarnings.length = 0;
37};
38
39function migrateWarn( msg) {
40 var console = window.console;
41 if ( !warnedAbout[ msg ] ) {
42 warnedAbout[ msg ] = true;
43 jQuery.migrateWarnings.push( msg );
44 if ( console && console.warn && !jQuery.migrateMute ) {
45 console.warn( "JQMIGRATE: " + msg );
46 if ( jQuery.migrateTrace && console.trace ) {
47 console.trace();
48 }
49 }
50 }
51}
52
53function migrateWarnProp( obj, prop, value, msg ) {
54 if ( Object.defineProperty ) {
55 // On ES5 browsers (non-oldIE), warn if the code tries to get prop;
56 // allow property to be overwritten in case some other plugin wants it
57 try {
58 Object.defineProperty( obj, prop, {
59 configurable: true,
60 enumerable: true,
61 get: function() {
62 migrateWarn( msg );
63 return value;
64 },
65 set: function( newValue ) {
66 migrateWarn( msg );
67 value = newValue;
68 }
69 });
70 return;
71 } catch( err ) {
72 // IE8 is a dope about Object.defineProperty, can't warn there
73 }
74 }
75
76 // Non-ES5 (or broken) browser; just set the property
77 jQuery._definePropertyBroken = true;
78 obj[ prop ] = value;
79}
80
81if ( document.compatMode === "BackCompat" ) {
82 // jQuery has never supported or tested Quirks Mode
83 migrateWarn( "jQuery is not compatible with Quirks Mode" );
84}
85
86
87var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
88 oldAttr = jQuery.attr,
89 valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
90 function() { return null; },
91 valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
92 function() { return undefined; },
93 rnoType = /^(?:input|button)$/i,
94 rnoAttrNodeType = /^[238]$/,
95 rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
96 ruseDefault = /^(?:checked|selected)$/i;
97
98// jQuery.attrFn
99migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
100
101jQuery.attr = function( elem, name, value, pass ) {
102 var lowerName = name.toLowerCase(),
103 nType = elem && elem.nodeType;
104
105 if ( pass ) {
106 // Since pass is used internally, we only warn for new jQuery
107 // versions where there isn't a pass arg in the formal params
108 if ( oldAttr.length < 4 ) {
109 migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
110 }
111 if ( elem && !rnoAttrNodeType.test( nType ) &&
112 (attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
113 return jQuery( elem )[ name ]( value );
114 }
115 }
116
117 // Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
118 // for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
119 if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
120 migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
121 }
122
123 // Restore boolHook for boolean property/attribute synchronization
124 if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
125 jQuery.attrHooks[ lowerName ] = {
126 get: function( elem, name ) {
127 // Align boolean attributes with corresponding properties
128 // Fall back to attribute presence where some booleans are not supported
129 var attrNode,
130 property = jQuery.prop( elem, name );
131 return property === true || typeof property !== "boolean" &&
132 ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
133
134 name.toLowerCase() :
135 undefined;
136 },
137 set: function( elem, value, name ) {
138 var propName;
139 if ( value === false ) {
140 // Remove boolean attributes when set to false
141 jQuery.removeAttr( elem, name );
142 } else {
143 // value is true since we know at this point it's type boolean and not false
144 // Set boolean attributes to the same name and set the DOM property
145 propName = jQuery.propFix[ name ] || name;
146 if ( propName in elem ) {
147 // Only set the IDL specifically if it already exists on the element
148 elem[ propName ] = true;
149 }
150
151 elem.setAttribute( name, name.toLowerCase() );
152 }
153 return name;
154 }
155 };
156
157 // Warn only for attributes that can remain distinct from their properties post-1.9
158 if ( ruseDefault.test( lowerName ) ) {
159 migrateWarn( "jQuery.fn.attr('" + lowerName + "') might use property instead of attribute" );
160 }
161 }
162
163 return oldAttr.call( jQuery, elem, name, value );
164};
165
166// attrHooks: value
167jQuery.attrHooks.value = {
168 get: function( elem, name ) {
169 var nodeName = ( elem.nodeName || "" ).toLowerCase();
170 if ( nodeName === "button" ) {
171 return valueAttrGet.apply( this, arguments );
172 }
173 if ( nodeName !== "input" && nodeName !== "option" ) {
174 migrateWarn("jQuery.fn.attr('value') no longer gets properties");
175 }
176 return name in elem ?
177 elem.value :
178 null;
179 },
180 set: function( elem, value ) {
181 var nodeName = ( elem.nodeName || "" ).toLowerCase();
182 if ( nodeName === "button" ) {
183 return valueAttrSet.apply( this, arguments );
184 }
185 if ( nodeName !== "input" && nodeName !== "option" ) {
186 migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
187 }
188 // Does not return so that setAttribute is also used
189 elem.value = value;
190 }
191};
192
193
194var matched, browser,
195 oldInit = jQuery.fn.init,
196 oldFind = jQuery.find,
197 oldParseJSON = jQuery.parseJSON,
198 rspaceAngle = /^\s*</,
199 rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
200 rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g,
201 // Note: XSS check is done below after string is trimmed
202 rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
203
204// $(html) "looks like html" rule change
205jQuery.fn.init = function( selector, context, rootjQuery ) {
206 var match, ret;
207
208 if ( selector && typeof selector === "string" ) {
209 if ( !jQuery.isPlainObject( context ) &&
210 (match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
211
212 // This is an HTML string according to the "old" rules; is it still?
213 if ( !rspaceAngle.test( selector ) ) {
214 migrateWarn("$(html) HTML strings must start with '<' character");
215 }
216 if ( match[ 3 ] ) {
217 migrateWarn("$(html) HTML text after last tag is ignored");
218 }
219
220 // Consistently reject any HTML-like string starting with a hash (gh-9521)
221 // Note that this may break jQuery 1.6.x code that otherwise would work.
222 if ( match[ 0 ].charAt( 0 ) === "#" ) {
223 migrateWarn("HTML string cannot start with a '#' character");
224 jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
225 }
226
227 // Now process using loose rules; let pre-1.8 play too
228 // Is this a jQuery context? parseHTML expects a DOM element (#178)
229 if ( context && context.context && context.context.nodeType ) {
230 context = context.context;
231 }
232
233 if ( jQuery.parseHTML ) {
234 return oldInit.call( this,
235 jQuery.parseHTML( match[ 2 ], context && context.ownerDocument ||
236 context || document, true ), context, rootjQuery );
237 }
238 }
239 }
240
241 ret = oldInit.apply( this, arguments );
242
243 // Fill in selector and context properties so .live() works
244 if ( selector && selector.selector !== undefined ) {
245 // A jQuery object, copy its properties
246 ret.selector = selector.selector;
247 ret.context = selector.context;
248
249 } else {
250 ret.selector = typeof selector === "string" ? selector : "";
251 if ( selector ) {
252 ret.context = selector.nodeType? selector : context || document;
253 }
254 }
255
256 return ret;
257};
258jQuery.fn.init.prototype = jQuery.fn;
259
260jQuery.find = function( selector ) {
261 var args = Array.prototype.slice.call( arguments );
262
263 // Support: PhantomJS 1.x
264 // String#match fails to match when used with a //g RegExp, only on some strings
265 if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
266
267 // The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
268 // First see if qS thinks it's a valid selector, if so avoid a false positive
269 try {
270 document.querySelector( selector );
271 } catch ( err1 ) {
272
273 // Didn't *look* valid to qSA, warn and try quoting what we think is the value
274 selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
275 return "[" + attr + op + "\"" + value + "\"]";
276 } );
277
278 // If the regexp *may* have created an invalid selector, don't update it
279 // Note that there may be false alarms if selector uses jQuery extensions
280 try {
281 document.querySelector( selector );
282 migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] );
283 args[ 0 ] = selector;
284 } catch ( err2 ) {
285 migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] );
286 }
287 }
288 }
289
290 return oldFind.apply( this, args );
291};
292
293// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
294var findProp;
295for ( findProp in oldFind ) {
296 if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
297 jQuery.find[ findProp ] = oldFind[ findProp ];
298 }
299}
300
301// Let $.parseJSON(falsy_value) return null
302jQuery.parseJSON = function( json ) {
303 if ( !json ) {
304 migrateWarn("jQuery.parseJSON requires a valid JSON string");
305 return null;
306 }
307 return oldParseJSON.apply( this, arguments );
308};
309
310jQuery.uaMatch = function( ua ) {
311 ua = ua.toLowerCase();
312
313 var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
314 /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
315 /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
316 /(msie) ([\w.]+)/.exec( ua ) ||
317 ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
318 [];
319
320 return {
321 browser: match[ 1 ] || "",
322 version: match[ 2 ] || "0"
323 };
324};
325
326// Don't clobber any existing jQuery.browser in case it's different
327if ( !jQuery.browser ) {
328 matched = jQuery.uaMatch( navigator.userAgent );
329 browser = {};
330
331 if ( matched.browser ) {
332 browser[ matched.browser ] = true;
333 browser.version = matched.version;
334 }
335
336 // Chrome is Webkit, but Webkit is also Safari.
337 if ( browser.chrome ) {
338 browser.webkit = true;
339 } else if ( browser.webkit ) {
340 browser.safari = true;
341 }
342
343 jQuery.browser = browser;
344}
345
346// Warn if the code tries to get jQuery.browser
347migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
348
349// jQuery.boxModel deprecated in 1.3, jQuery.support.boxModel deprecated in 1.7
350jQuery.boxModel = jQuery.support.boxModel = (document.compatMode === "CSS1Compat");
351migrateWarnProp( jQuery, "boxModel", jQuery.boxModel, "jQuery.boxModel is deprecated" );
352migrateWarnProp( jQuery.support, "boxModel", jQuery.support.boxModel, "jQuery.support.boxModel is deprecated" );
353
354jQuery.sub = function() {
355 function jQuerySub( selector, context ) {
356 return new jQuerySub.fn.init( selector, context );
357 }
358 jQuery.extend( true, jQuerySub, this );
359 jQuerySub.superclass = this;
360 jQuerySub.fn = jQuerySub.prototype = this();
361 jQuerySub.fn.constructor = jQuerySub;
362 jQuerySub.sub = this.sub;
363 jQuerySub.fn.init = function init( selector, context ) {
364 var instance = jQuery.fn.init.call( this, selector, context, rootjQuerySub );
365 return instance instanceof jQuerySub ?
366 instance :
367 jQuerySub( instance );
368 };
369 jQuerySub.fn.init.prototype = jQuerySub.fn;
370 var rootjQuerySub = jQuerySub(document);
371 migrateWarn( "jQuery.sub() is deprecated" );
372 return jQuerySub;
373};
374
375// The number of elements contained in the matched element set
376jQuery.fn.size = function() {
377 migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" );
378 return this.length;
379};
380
381
382var internalSwapCall = false;
383
384// If this version of jQuery has .swap(), don't false-alarm on internal uses
385if ( jQuery.swap ) {
386 jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
387 var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
388
389 if ( oldHook ) {
390 jQuery.cssHooks[ name ].get = function() {
391 var ret;
392
393 internalSwapCall = true;
394 ret = oldHook.apply( this, arguments );
395 internalSwapCall = false;
396 return ret;
397 };
398 }
399 });
400}
401
402jQuery.swap = function( elem, options, callback, args ) {
403 var ret, name,
404 old = {};
405
406 if ( !internalSwapCall ) {
407 migrateWarn( "jQuery.swap() is undocumented and deprecated" );
408 }
409
410 // Remember the old values, and insert the new ones
411 for ( name in options ) {
412 old[ name ] = elem.style[ name ];
413 elem.style[ name ] = options[ name ];
414 }
415
416 ret = callback.apply( elem, args || [] );
417
418 // Revert the old values
419 for ( name in options ) {
420 elem.style[ name ] = old[ name ];
421 }
422
423 return ret;
424};
425
426
427// Ensure that $.ajax gets the new parseJSON defined in core.js
428jQuery.ajaxSetup({
429 converters: {
430 "text json": jQuery.parseJSON
431 }
432});
433
434
435var oldFnData = jQuery.fn.data;
436
437jQuery.fn.data = function( name ) {
438 var ret, evt,
439 elem = this[0];
440
441 // Handles 1.7 which has this behavior and 1.8 which doesn't
442 if ( elem && name === "events" && arguments.length === 1 ) {
443 ret = jQuery.data( elem, name );
444 evt = jQuery._data( elem, name );
445 if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
446 migrateWarn("Use of jQuery.fn.data('events') is deprecated");
447 return evt;
448 }
449 }
450 return oldFnData.apply( this, arguments );
451};
452
453
454var rscriptType = /\/(java|ecma)script/i;
455
456// Since jQuery.clean is used internally on older versions, we only shim if it's missing
457if ( !jQuery.clean ) {
458 jQuery.clean = function( elems, context, fragment, scripts ) {
459 // Set context per 1.8 logic
460 context = context || document;
461 context = !context.nodeType && context[0] || context;
462 context = context.ownerDocument || context;
463
464 migrateWarn("jQuery.clean() is deprecated");
465
466 var i, elem, handleScript, jsTags,
467 ret = [];
468
469 jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
470
471 // Complex logic lifted directly from jQuery 1.8
472 if ( fragment ) {
473 // Special handling of each script element
474 handleScript = function( elem ) {
475 // Check if we consider it executable
476 if ( !elem.type || rscriptType.test( elem.type ) ) {
477 // Detach the script and store it in the scripts array (if provided) or the fragment
478 // Return truthy to indicate that it has been handled
479 return scripts ?
480 scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
481 fragment.appendChild( elem );
482 }
483 };
484
485 for ( i = 0; (elem = ret[i]) != null; i++ ) {
486 // Check if we're done after handling an executable script
487 if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
488 // Append to fragment and handle embedded scripts
489 fragment.appendChild( elem );
490 if ( typeof elem.getElementsByTagName !== "undefined" ) {
491 // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
492 jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
493
494 // Splice the scripts into ret after their former ancestor and advance our index beyond them
495 ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
496 i += jsTags.length;
497 }
498 }
499 }
500 }
501
502 return ret;
503 };
504}
505
506var eventAdd = jQuery.event.add,
507 eventRemove = jQuery.event.remove,
508 eventTrigger = jQuery.event.trigger,
509 oldToggle = jQuery.fn.toggle,
510 oldLive = jQuery.fn.live,
511 oldDie = jQuery.fn.die,
512 oldLoad = jQuery.fn.load,
513 ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
514 rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
515 rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
516 hoverHack = function( events ) {
517 if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
518 return events;
519 }
520 if ( rhoverHack.test( events ) ) {
521 migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
522 }
523 return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
524 };
525
526// Event props removed in 1.9, put them back if needed; no practical way to warn them
527if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
528 jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
529}
530
531// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
532if ( jQuery.event.dispatch ) {
533 migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
534}
535
536// Support for 'hover' pseudo-event and ajax event warnings
537jQuery.event.add = function( elem, types, handler, data, selector ){
538 if ( elem !== document && rajaxEvent.test( types ) ) {
539 migrateWarn( "AJAX events should be attached to document: " + types );
540 }
541 eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
542};
543jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
544 eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
545};
546
547jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
548
549 jQuery.fn[ name ] = function() {
550 var args = Array.prototype.slice.call( arguments, 0 );
551
552 // If this is an ajax load() the first arg should be the string URL;
553 // technically this could also be the "Anything" arg of the event .load()
554 // which just goes to show why this dumb signature has been deprecated!
555 // jQuery custom builds that exclude the Ajax module justifiably die here.
556 if ( name === "load" && typeof args[ 0 ] === "string" ) {
557 return oldLoad.apply( this, args );
558 }
559
560 migrateWarn( "jQuery.fn." + name + "() is deprecated" );
561
562 args.splice( 0, 0, name );
563 if ( arguments.length ) {
564 return this.bind.apply( this, args );
565 }
566
567 // Use .triggerHandler here because:
568 // - load and unload events don't need to bubble, only applied to window or image
569 // - error event should not bubble to window, although it does pre-1.7
570 // See http://bugs.jquery.com/ticket/11820
571 this.triggerHandler.apply( this, args );
572 return this;
573 };
574
575});
576
577jQuery.fn.toggle = function( fn, fn2 ) {
578
579 // Don't mess with animation or css toggles
580 if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
581 return oldToggle.apply( this, arguments );
582 }
583 migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
584
585 // Save reference to arguments for access in closure
586 var args = arguments,
587 guid = fn.guid || jQuery.guid++,
588 i = 0,
589 toggler = function( event ) {
590 // Figure out which function to execute
591 var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
592 jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
593
594 // Make sure that clicks stop
595 event.preventDefault();
596
597 // and execute the function
598 return args[ lastToggle ].apply( this, arguments ) || false;
599 };
600
601 // link all the functions, so any of them can unbind this click handler
602 toggler.guid = guid;
603 while ( i < args.length ) {
604 args[ i++ ].guid = guid;
605 }
606
607 return this.click( toggler );
608};
609
610jQuery.fn.live = function( types, data, fn ) {
611 migrateWarn("jQuery.fn.live() is deprecated");
612 if ( oldLive ) {
613 return oldLive.apply( this, arguments );
614 }
615 jQuery( this.context ).on( types, this.selector, data, fn );
616 return this;
617};
618
619jQuery.fn.die = function( types, fn ) {
620 migrateWarn("jQuery.fn.die() is deprecated");
621 if ( oldDie ) {
622 return oldDie.apply( this, arguments );
623 }
624 jQuery( this.context ).off( types, this.selector || "**", fn );
625 return this;
626};
627
628// Turn global events into document-triggered events
629jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
630 if ( !elem && !rajaxEvent.test( event ) ) {
631 migrateWarn( "Global events are undocumented and deprecated" );
632 }
633 return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
634};
635jQuery.each( ajaxEvents.split("|"),
636 function( _, name ) {
637 jQuery.event.special[ name ] = {
638 setup: function() {
639 var elem = this;
640
641 // The document needs no shimming; must be !== for oldIE
642 if ( elem !== document ) {
643 jQuery.event.add( document, name + "." + jQuery.guid, function() {
644 jQuery.event.trigger( name, Array.prototype.slice.call( arguments, 1 ), elem, true );
645 });
646 jQuery._data( this, name, jQuery.guid++ );
647 }
648 return false;
649 },
650 teardown: function() {
651 if ( this !== document ) {
652 jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
653 }
654 return false;
655 }
656 };
657 }
658);
659
660jQuery.event.special.ready = {
661 setup: function() {
662 if ( this === document ) {
663 migrateWarn( "'ready' event is deprecated" );
664 }
665 }
666};
667
668var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack,
669 oldFnFind = jQuery.fn.find;
670
671jQuery.fn.andSelf = function() {
672 migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
673 return oldSelf.apply( this, arguments );
674};
675
676jQuery.fn.find = function( selector ) {
677 var ret = oldFnFind.apply( this, arguments );
678 ret.context = this.context;
679 ret.selector = this.selector ? this.selector + " " + selector : selector;
680 return ret;
681};
682
683
684// jQuery 1.6 did not support Callbacks, do not warn there
685if ( jQuery.Callbacks ) {
686
687 var oldDeferred = jQuery.Deferred,
688 tuples = [
689 // action, add listener, callbacks, .then handlers, final state
690 [ "resolve", "done", jQuery.Callbacks("once memory"),
691 jQuery.Callbacks("once memory"), "resolved" ],
692 [ "reject", "fail", jQuery.Callbacks("once memory"),
693 jQuery.Callbacks("once memory"), "rejected" ],
694 [ "notify", "progress", jQuery.Callbacks("memory"),
695 jQuery.Callbacks("memory") ]
696 ];
697
698 jQuery.Deferred = function( func ) {
699 var deferred = oldDeferred(),
700 promise = deferred.promise();
701
702 deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
703 var fns = arguments;
704
705 migrateWarn( "deferred.pipe() is deprecated" );
706
707 return jQuery.Deferred(function( newDefer ) {
708 jQuery.each( tuples, function( i, tuple ) {
709 var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
710 // deferred.done(function() { bind to newDefer or newDefer.resolve })
711 // deferred.fail(function() { bind to newDefer or newDefer.reject })
712 // deferred.progress(function() { bind to newDefer or newDefer.notify })
713 deferred[ tuple[1] ](function() {
714 var returned = fn && fn.apply( this, arguments );
715 if ( returned && jQuery.isFunction( returned.promise ) ) {
716 returned.promise()
717 .done( newDefer.resolve )
718 .fail( newDefer.reject )
719 .progress( newDefer.notify );
720 } else {
721 newDefer[ tuple[ 0 ] + "With" ](
722 this === promise ? newDefer.promise() : this,
723 fn ? [ returned ] : arguments
724 );
725 }
726 });
727 });
728 fns = null;
729 }).promise();
730
731 };
732
733 deferred.isResolved = function() {
734 migrateWarn( "deferred.isResolved is deprecated" );
735 return deferred.state() === "resolved";
736 };
737
738 deferred.isRejected = function() {
739 migrateWarn( "deferred.isRejected is deprecated" );
740 return deferred.state() === "rejected";
741 };
742
743 if ( func ) {
744 func.call( deferred, deferred );
745 }
746
747 return deferred;
748 };
749
750}
751
752})( jQuery, window );
0753
=== added file 'openlp/plugins/remotes/html/jquery-migrate.min.js'
--- openlp/plugins/remotes/html/jquery-migrate.min.js 1970-01-01 00:00:00 +0000
+++ openlp/plugins/remotes/html/jquery-migrate.min.js 2016-12-15 18:14:46 +0000
@@ -0,0 +1,2 @@
1/*! jQuery Migrate v1.4.1 | (c) jQuery Foundation and other contributors | jquery.org/license */
2"undefined"==typeof jQuery.migrateMute&&(jQuery.migrateMute=!0),function(a,b,c){function d(c){var d=b.console;f[c]||(f[c]=!0,a.migrateWarnings.push(c),d&&d.warn&&!a.migrateMute&&(d.warn("JQMIGRATE: "+c),a.migrateTrace&&d.trace&&d.trace()))}function e(b,c,e,f){if(Object.defineProperty)try{return void Object.defineProperty(b,c,{configurable:!0,enumerable:!0,get:function(){return d(f),e},set:function(a){d(f),e=a}})}catch(g){}a._definePropertyBroken=!0,b[c]=e}a.migrateVersion="1.4.1";var f={};a.migrateWarnings=[],b.console&&b.console.log&&b.console.log("JQMIGRATE: Migrate is installed"+(a.migrateMute?"":" with logging active")+", version "+a.migrateVersion),a.migrateTrace===c&&(a.migrateTrace=!0),a.migrateReset=function(){f={},a.migrateWarnings.length=0},"BackCompat"===document.compatMode&&d("jQuery is not compatible with Quirks Mode");var g=a("<input/>",{size:1}).attr("size")&&a.attrFn,h=a.attr,i=a.attrHooks.value&&a.attrHooks.value.get||function(){return null},j=a.attrHooks.value&&a.attrHooks.value.set||function(){return c},k=/^(?:input|button)$/i,l=/^[238]$/,m=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,n=/^(?:checked|selected)$/i;e(a,"attrFn",g||{},"jQuery.attrFn is deprecated"),a.attr=function(b,e,f,i){var j=e.toLowerCase(),o=b&&b.nodeType;return i&&(h.length<4&&d("jQuery.fn.attr( props, pass ) is deprecated"),b&&!l.test(o)&&(g?e in g:a.isFunction(a.fn[e])))?a(b)[e](f):("type"===e&&f!==c&&k.test(b.nodeName)&&b.parentNode&&d("Can't change the 'type' of an input or button in IE 6/7/8"),!a.attrHooks[j]&&m.test(j)&&(a.attrHooks[j]={get:function(b,d){var e,f=a.prop(b,d);return f===!0||"boolean"!=typeof f&&(e=b.getAttributeNode(d))&&e.nodeValue!==!1?d.toLowerCase():c},set:function(b,c,d){var e;return c===!1?a.removeAttr(b,d):(e=a.propFix[d]||d,e in b&&(b[e]=!0),b.setAttribute(d,d.toLowerCase())),d}},n.test(j)&&d("jQuery.fn.attr('"+j+"') might use property instead of attribute")),h.call(a,b,e,f))},a.attrHooks.value={get:function(a,b){var c=(a.nodeName||"").toLowerCase();return"button"===c?i.apply(this,arguments):("input"!==c&&"option"!==c&&d("jQuery.fn.attr('value') no longer gets properties"),b in a?a.value:null)},set:function(a,b){var c=(a.nodeName||"").toLowerCase();return"button"===c?j.apply(this,arguments):("input"!==c&&"option"!==c&&d("jQuery.fn.attr('value', val) no longer sets properties"),void(a.value=b))}};var o,p,q=a.fn.init,r=a.find,s=a.parseJSON,t=/^\s*</,u=/\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,v=/\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g,w=/^([^<]*)(<[\w\W]+>)([^>]*)$/;a.fn.init=function(b,e,f){var g,h;return b&&"string"==typeof b&&!a.isPlainObject(e)&&(g=w.exec(a.trim(b)))&&g[0]&&(t.test(b)||d("$(html) HTML strings must start with '<' character"),g[3]&&d("$(html) HTML text after last tag is ignored"),"#"===g[0].charAt(0)&&(d("HTML string cannot start with a '#' character"),a.error("JQMIGRATE: Invalid selector string (XSS)")),e&&e.context&&e.context.nodeType&&(e=e.context),a.parseHTML)?q.call(this,a.parseHTML(g[2],e&&e.ownerDocument||e||document,!0),e,f):(h=q.apply(this,arguments),b&&b.selector!==c?(h.selector=b.selector,h.context=b.context):(h.selector="string"==typeof b?b:"",b&&(h.context=b.nodeType?b:e||document)),h)},a.fn.init.prototype=a.fn,a.find=function(a){var b=Array.prototype.slice.call(arguments);if("string"==typeof a&&u.test(a))try{document.querySelector(a)}catch(c){a=a.replace(v,function(a,b,c,d){return"["+b+c+'"'+d+'"]'});try{document.querySelector(a),d("Attribute selector with '#' must be quoted: "+b[0]),b[0]=a}catch(e){d("Attribute selector with '#' was not fixed: "+b[0])}}return r.apply(this,b)};var x;for(x in r)Object.prototype.hasOwnProperty.call(r,x)&&(a.find[x]=r[x]);a.parseJSON=function(a){return a?s.apply(this,arguments):(d("jQuery.parseJSON requires a valid JSON string"),null)},a.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a.browser||(o=a.uaMatch(navigator.userAgent),p={},o.browser&&(p[o.browser]=!0,p.version=o.version),p.chrome?p.webkit=!0:p.webkit&&(p.safari=!0),a.browser=p),e(a,"browser",a.browser,"jQuery.browser is deprecated"),a.boxModel=a.support.boxModel="CSS1Compat"===document.compatMode,e(a,"boxModel",a.boxModel,"jQuery.boxModel is deprecated"),e(a.support,"boxModel",a.support.boxModel,"jQuery.support.boxModel is deprecated"),a.sub=function(){function b(a,c){return new b.fn.init(a,c)}a.extend(!0,b,this),b.superclass=this,b.fn=b.prototype=this(),b.fn.constructor=b,b.sub=this.sub,b.fn.init=function(d,e){var f=a.fn.init.call(this,d,e,c);return f instanceof b?f:b(f)},b.fn.init.prototype=b.fn;var c=b(document);return d("jQuery.sub() is deprecated"),b},a.fn.size=function(){return d("jQuery.fn.size() is deprecated; use the .length property"),this.length};var y=!1;a.swap&&a.each(["height","width","reliableMarginRight"],function(b,c){var d=a.cssHooks[c]&&a.cssHooks[c].get;d&&(a.cssHooks[c].get=function(){var a;return y=!0,a=d.apply(this,arguments),y=!1,a})}),a.swap=function(a,b,c,e){var f,g,h={};y||d("jQuery.swap() is undocumented and deprecated");for(g in b)h[g]=a.style[g],a.style[g]=b[g];f=c.apply(a,e||[]);for(g in b)a.style[g]=h[g];return f},a.ajaxSetup({converters:{"text json":a.parseJSON}});var z=a.fn.data;a.fn.data=function(b){var e,f,g=this[0];return!g||"events"!==b||1!==arguments.length||(e=a.data(g,b),f=a._data(g,b),e!==c&&e!==f||f===c)?z.apply(this,arguments):(d("Use of jQuery.fn.data('events') is deprecated"),f)};var A=/\/(java|ecma)script/i;a.clean||(a.clean=function(b,c,e,f){c=c||document,c=!c.nodeType&&c[0]||c,c=c.ownerDocument||c,d("jQuery.clean() is deprecated");var g,h,i,j,k=[];if(a.merge(k,a.buildFragment(b,c).childNodes),e)for(i=function(a){return!a.type||A.test(a.type)?f?f.push(a.parentNode?a.parentNode.removeChild(a):a):e.appendChild(a):void 0},g=0;null!=(h=k[g]);g++)a.nodeName(h,"script")&&i(h)||(e.appendChild(h),"undefined"!=typeof h.getElementsByTagName&&(j=a.grep(a.merge([],h.getElementsByTagName("script")),i),k.splice.apply(k,[g+1,0].concat(j)),g+=j.length));return k});var B=a.event.add,C=a.event.remove,D=a.event.trigger,E=a.fn.toggle,F=a.fn.live,G=a.fn.die,H=a.fn.load,I="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",J=new RegExp("\\b(?:"+I+")\\b"),K=/(?:^|\s)hover(\.\S+|)\b/,L=function(b){return"string"!=typeof b||a.event.special.hover?b:(K.test(b)&&d("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),b&&b.replace(K,"mouseenter$1 mouseleave$1"))};a.event.props&&"attrChange"!==a.event.props[0]&&a.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),a.event.dispatch&&e(a.event,"handle",a.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),a.event.add=function(a,b,c,e,f){a!==document&&J.test(b)&&d("AJAX events should be attached to document: "+b),B.call(this,a,L(b||""),c,e,f)},a.event.remove=function(a,b,c,d,e){C.call(this,a,L(b)||"",c,d,e)},a.each(["load","unload","error"],function(b,c){a.fn[c]=function(){var a=Array.prototype.slice.call(arguments,0);return"load"===c&&"string"==typeof a[0]?H.apply(this,a):(d("jQuery.fn."+c+"() is deprecated"),a.splice(0,0,c),arguments.length?this.bind.apply(this,a):(this.triggerHandler.apply(this,a),this))}}),a.fn.toggle=function(b,c){if(!a.isFunction(b)||!a.isFunction(c))return E.apply(this,arguments);d("jQuery.fn.toggle(handler, handler...) is deprecated");var e=arguments,f=b.guid||a.guid++,g=0,h=function(c){var d=(a._data(this,"lastToggle"+b.guid)||0)%g;return a._data(this,"lastToggle"+b.guid,d+1),c.preventDefault(),e[d].apply(this,arguments)||!1};for(h.guid=f;g<e.length;)e[g++].guid=f;return this.click(h)},a.fn.live=function(b,c,e){return d("jQuery.fn.live() is deprecated"),F?F.apply(this,arguments):(a(this.context).on(b,this.selector,c,e),this)},a.fn.die=function(b,c){return d("jQuery.fn.die() is deprecated"),G?G.apply(this,arguments):(a(this.context).off(b,this.selector||"**",c),this)},a.event.trigger=function(a,b,c,e){return c||J.test(a)||d("Global events are undocumented and deprecated"),D.call(this,a,b,c||document,e)},a.each(I.split("|"),function(b,c){a.event.special[c]={setup:function(){var b=this;return b!==document&&(a.event.add(document,c+"."+a.guid,function(){a.event.trigger(c,Array.prototype.slice.call(arguments,1),b,!0)}),a._data(this,c,a.guid++)),!1},teardown:function(){return this!==document&&a.event.remove(document,c+"."+a._data(this,c)),!1}}}),a.event.special.ready={setup:function(){this===document&&d("'ready' event is deprecated")}};var M=a.fn.andSelf||a.fn.addBack,N=a.fn.find;if(a.fn.andSelf=function(){return d("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),M.apply(this,arguments)},a.fn.find=function(a){var b=N.apply(this,arguments);return b.context=this.context,b.selector=this.selector?this.selector+" "+a:a,b},a.Callbacks){var O=a.Deferred,P=[["resolve","done",a.Callbacks("once memory"),a.Callbacks("once memory"),"resolved"],["reject","fail",a.Callbacks("once memory"),a.Callbacks("once memory"),"rejected"],["notify","progress",a.Callbacks("memory"),a.Callbacks("memory")]];a.Deferred=function(b){var c=O(),e=c.promise();return c.pipe=e.pipe=function(){var b=arguments;return d("deferred.pipe() is deprecated"),a.Deferred(function(d){a.each(P,function(f,g){var h=a.isFunction(b[f])&&b[f];c[g[1]](function(){var b=h&&h.apply(this,arguments);b&&a.isFunction(b.promise)?b.promise().done(d.resolve).fail(d.reject).progress(d.notify):d[g[0]+"With"](this===e?d.promise():this,h?[b]:arguments)})}),b=null}).promise()},c.isResolved=function(){return d("deferred.isResolved is deprecated"),"resolved"===c.state()},c.isRejected=function(){return d("deferred.isRejected is deprecated"),"rejected"===c.state()},b&&b.call(c,c),c}}}(jQuery,window);
0\ No newline at end of file3\ No newline at end of file
14
=== modified file 'openlp/plugins/remotes/html/openlp.js'
--- openlp/plugins/remotes/html/openlp.js 2016-01-05 19:32:12 +0000
+++ openlp/plugins/remotes/html/openlp.js 2016-12-15 18:14:46 +0000
@@ -345,40 +345,42 @@
345 $.mobile.defaultPageTransition = "none";345 $.mobile.defaultPageTransition = "none";
346});346});
347// Service Manager347// Service Manager
348$("#service-manager").live("pagebeforeshow", OpenLP.loadService);348$("#service-manager").on("pagebeforeshow", OpenLP.loadService);
349$("#service-refresh").live("click", OpenLP.loadService);349$("#service-refresh").on("click", OpenLP.loadService);
350$("#service-next").live("click", OpenLP.nextItem);350$("#service-next").on("click", OpenLP.nextItem);
351$("#service-previous").live("click", OpenLP.previousItem);351$("#service-previous").on("click", OpenLP.previousItem);
352$("#service-blank").live("click", OpenLP.blankDisplay);352$("#service-blank").on("click", OpenLP.blankDisplay);
353$("#service-theme").live("click", OpenLP.themeDisplay);353$("#service-theme").on("click", OpenLP.themeDisplay);
354$("#service-desktop").live("click", OpenLP.desktopDisplay);354$("#service-desktop").on("click", OpenLP.desktopDisplay);
355$("#service-show").live("click", OpenLP.showDisplay);355$("#service-show").on("click", OpenLP.showDisplay);
356// Slide Controller356// Slide Controller
357$("#slide-controller").live("pagebeforeshow", OpenLP.loadController);357$("#slide-controller").on("pagebeforeshow", OpenLP.loadController);
358$("#controller-refresh").live("click", OpenLP.loadController);358$("#controller-refresh").on("click", OpenLP.loadController);
359$("#controller-next").live("click", OpenLP.nextSlide);359$("#controller-next").on("click", OpenLP.nextSlide);
360$("#controller-previous").live("click", OpenLP.previousSlide);360$("#controller-previous").on("click", OpenLP.previousSlide);
361$("#controller-blank").live("click", OpenLP.blankDisplay);361$("#controller-blank").on("click", OpenLP.blankDisplay);
362$("#controller-theme").live("click", OpenLP.themeDisplay);362$("#controller-theme").on("click", OpenLP.themeDisplay);
363$("#controller-desktop").live("click", OpenLP.desktopDisplay);363$("#controller-desktop").on("click", OpenLP.desktopDisplay);
364$("#controller-show").live("click", OpenLP.showDisplay);364$("#controller-show").on("click", OpenLP.showDisplay);
365// Alerts365// Alerts
366$("#alert-submit").live("click", OpenLP.showAlert);366$("#alert-submit").on("click", OpenLP.showAlert);
367// Search367// Search
368$("#search-submit").live("click", OpenLP.search);368$("#search-submit").on("click", OpenLP.search);
369$("#search-text").live("keypress", function(event) {369$("#search-text").on("keypress", function(event) {
370 if (event.which == 13)370 if (event.which == 13)
371 {371 {
372 OpenLP.search(event);372 OpenLP.search(event);
373 }373 }
374});374});
375$("#go-live").live("click", OpenLP.goLive);375$("#go-live").on("click", OpenLP.goLive);
376$("#add-to-service").live("click", OpenLP.addToService);376$("#add-to-service").on("click", OpenLP.addToService);
377$("#add-and-go-to-service").live("click", OpenLP.addAndGoToService);377$("#add-and-go-to-service").on("click", OpenLP.addAndGoToService);
378// Poll the server twice a second to get any updates.378// Poll the server twice a second to get any updates.
379$.ajaxSetup({cache: false});379$.ajaxSetup({cache: false});
380$("#search").live("pageinit", function (event) {380console.log("hook");
381$("#search").on("pageinit", function (event) {
382 console.log("Page init!");
381 OpenLP.getSearchablePlugins();383 OpenLP.getSearchablePlugins();
382});384});
383setInterval("OpenLP.pollServer();", 500);385setInterval(OpenLP.pollServer, 500);
384OpenLP.pollServer();386OpenLP.pollServer();
385387
=== modified file 'tests/interfaces/openlp_core_ui/test_shortcutlistform.py'
--- tests/interfaces/openlp_core_ui/test_shortcutlistform.py 2016-02-12 19:46:04 +0000
+++ tests/interfaces/openlp_core_ui/test_shortcutlistform.py 2016-12-15 18:14:46 +0000
@@ -28,6 +28,7 @@
2828
29from openlp.core.common import Registry29from openlp.core.common import Registry
30from openlp.core.ui.shortcutlistform import ShortcutListForm30from openlp.core.ui.shortcutlistform import ShortcutListForm
31from openlp.core.ui.shortcutlistdialog import CaptureShortcutButton, ShortcutTreeWidget
3132
32from tests.interfaces import MagicMock, patch33from tests.interfaces import MagicMock, patch
33from tests.helpers.testmixin import TestMixin34from tests.helpers.testmixin import TestMixin
@@ -227,3 +228,34 @@
227 mocked_action_shortcuts.assert_called_with(mocked_action)228 mocked_action_shortcuts.assert_called_with(mocked_action)
228 mocked_refresh_shortcut_list.assert_called_with()229 mocked_refresh_shortcut_list.assert_called_with()
229 mocked_set_text.assert_called_with('Esc')230 mocked_set_text.assert_called_with('Esc')
231
232
233def test_key_press_event():
234 """
235 Test the keyPressEvent method
236 """
237 # GIVEN: A checked button and a mocked event
238 button = CaptureShortcutButton()
239 button.setChecked(True)
240 mocked_event = MagicMock()
241 mocked_event.key.return_value = QtCore.Qt.Key_Space
242
243 # WHEN: keyPressEvent is called with an event that should be ignored
244 button.keyPressEvent(mocked_event)
245
246 # THEN: The ignore() method on the event should have been called
247 mocked_event.ignore.assert_called_once_with()
248
249
250def test_keyboard_search():
251 """
252 Test the keyboardSearch method of the ShortcutTreeWidget
253 """
254 # GIVEN: A ShortcutTreeWidget
255 widget = ShortcutTreeWidget()
256
257 # WHEN: keyboardSearch() is called
258 widget.keyboardSearch('')
259
260 # THEN: Nothing happens
261 assert True

Subscribers

People subscribed via source and target branches

to all changes: