diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /devtools/client/inspector/markup/test/browser_markup_events_jquery_1.2.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | devtools/client/inspector/markup/test/browser_markup_events_jquery_1.2.js | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/devtools/client/inspector/markup/test/browser_markup_events_jquery_1.2.js b/devtools/client/inspector/markup/test/browser_markup_events_jquery_1.2.js new file mode 100644 index 0000000000..8739f6f025 --- /dev/null +++ b/devtools/client/inspector/markup/test/browser_markup_events_jquery_1.2.js @@ -0,0 +1,141 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +/* import-globals-from helper_events_test_runner.js */ +"use strict"; + +// Test that markup view event bubbles show the correct event info for jQuery +// and jQuery Live events (jQuery version 1.2). + +const TEST_LIB = "lib_jquery_1.2_min.js"; +const TEST_URL = URL_ROOT_SSL + "doc_markup_events_jquery.html?" + TEST_LIB; + +loadHelperScript("helper_events_test_runner.js"); + +/*eslint-disable */ +const TEST_DATA = [ + { + selector: "html", + expected: [ + { + type: "load", + filename: TEST_URL + ":29:38", + attributes: ["Bubbling"], + handler: ` + () => { + const handler1 = function liveDivDblClick() { + alert(1); + }; + const handler2 = function liveDivDragStart() { + alert(2); + }; + const handler3 = function liveDivDragLeave() { + alert(3); + }; + const handler4 = function liveDivDragEnd() { + alert(4); + }; + const handler5 = function liveDivDrop() { + alert(5); + }; + const handler6 = function liveDivDragOver() { + alert(6); + }; + const handler7 = function divClick1() { + alert(7); + }; + const handler8 = function divClick2() { + alert(8); + }; + const handler9 = function divKeyDown() { + alert(9); + }; + const handler10 = function divDragOut() { + alert(10); + }; + + if ($("#livediv").live) { + $("#livediv").live("dblclick", handler1); + $("#livediv").live("dragstart", handler2); + } + + if ($("#livediv").delegate) { + $(document).delegate("#livediv", "dragleave", handler3); + $(document).delegate("#livediv", "dragend", handler4); + } + + if ($("#livediv").on) { + $(document).on("drop", "#livediv", handler5); + $(document).on("dragover", "#livediv", handler6); + $(document).on("dragout", "#livediv:xxxxx", handler10); + } + + const div = $("div")[0]; + $(div).click(handler7); + $(div).click(handler8); + $(div).keydown(handler9); + }`, + }, + ], + }, + { + selector: "#testdiv", + expected: [ + { + type: "click", + filename: TEST_URL + ":36:43", + attributes: ["jQuery"], + handler: ` + function divClick1() { + alert(7); + }`, + }, + { + type: "click", + filename: TEST_URL + ":37:43", + attributes: ["jQuery"], + handler: ` + function divClick2() { + alert(8); + }`, + }, + { + type: "click", + filename: URL_ROOT_SSL + TEST_LIB + ":24:10040", + attributes: ["Bubbling"], + handler: ` + function() { + var val; + if (typeof jQuery == "undefined" || jQuery.event.triggered) return val; + val = jQuery.event.handle.apply(element, arguments); + return val; + }`, + }, + { + type: "keydown", + filename: TEST_URL + ":38:44", + attributes: ["jQuery"], + handler: ` + function divKeyDown() { + alert(9); + }`, + }, + { + type: "keydown", + filename: URL_ROOT_SSL + TEST_LIB + ":24:10040", + attributes: ["Bubbling"], + handler: ` + function() { + var val; + if (typeof jQuery == "undefined" || jQuery.event.triggered) return val; + val = jQuery.event.handle.apply(element, arguments); + return val; + }`, + }, + ], + }, +]; +/* eslint-enable */ + +add_task(async function () { + await runEventPopupTests(TEST_URL, TEST_DATA); +}); |