diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /devtools/client/inspector/markup/test/browser_markup_events_react_production_16.2.0_jsx.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/inspector/markup/test/browser_markup_events_react_production_16.2.0_jsx.js')
-rw-r--r-- | devtools/client/inspector/markup/test/browser_markup_events_react_production_16.2.0_jsx.js | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/devtools/client/inspector/markup/test/browser_markup_events_react_production_16.2.0_jsx.js b/devtools/client/inspector/markup/test/browser_markup_events_react_production_16.2.0_jsx.js new file mode 100644 index 0000000000..4aedb216e2 --- /dev/null +++ b/devtools/client/inspector/markup/test/browser_markup_events_react_production_16.2.0_jsx.js @@ -0,0 +1,114 @@ +/* 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"; + +requestLongerTimeout(4); + +// Test that markup view event bubbles show the correct event info for React +// events (React production version 16.2.0) using JSX. + +const TEST_LIB = URL_ROOT_SSL + "lib_react_dom_16.2.0_min.js"; +const TEST_LIB_BABEL = URL_ROOT_SSL + "lib_babel_6.21.0_min.js"; +const TEST_EXTERNAL_LISTENERS = URL_ROOT_SSL + "react_external_listeners.js"; +const TEST_URL = + URL_ROOT_SSL + "doc_markup_events_react_production_16.2.0_jsx.html"; + +loadHelperScript("helper_events_test_runner.js"); + +/*eslint-disable */ +const TEST_DATA = [ + { + selector: "#inlinejsx", + expected: [ + { + type: "click", + filename: TEST_LIB + ":93:417", + attributes: ["Bubbling"], + handler: `function() {}`, + }, + { + type: "onClick", + filename: TEST_LIB_BABEL + ":26:34", + attributes: ["React", "Bubbling"], + handler: ` + function inlineFunction() { + alert("inlineFunction"); + }`, + }, + ], + }, + { + selector: "#externaljsx", + expected: [ + { + type: "click", + filename: TEST_LIB + ":93:417", + attributes: ["Bubbling"], + handler: `function() {}`, + }, + { + type: "onClick", + filename: TEST_EXTERNAL_LISTENERS + ":4:25", + attributes: ["React", "Bubbling"], + handler: ` + function externalFunction() { + alert("externalFunction"); + }`, + }, + ], + }, + { + selector: "#externalinlinejsx", + expected: [ + { + type: "click", + filename: TEST_LIB + ":93:417", + attributes: ["Bubbling"], + handler: `function() {}`, + }, + { + type: "onClick", + filename: TEST_EXTERNAL_LISTENERS + ":4:25", + attributes: ["React", "Bubbling"], + handler: ` + function externalFunction() { + alert("externalFunction"); + }`, + }, + { + type: "onMouseUp", + filename: TEST_LIB_BABEL + ":26:34", + attributes: ["React", "Bubbling"], + handler: ` + function inlineFunction() { + alert("inlineFunction"); + }`, + }, + ], + }, + { + selector: "#externalcapturingjsx", + expected: [ + { + type: "onClickCapture", + filename: TEST_EXTERNAL_LISTENERS + ":8:34", + attributes: ["React", "Capturing"], + handler: ` + function externalCapturingFunction() { + alert("externalCapturingFunction"); + }`, + }, + ], + }, +]; +/* eslint-enable */ + +add_task(async function () { + info( + "Switch to 2 pane inspector to avoid sidebar width issues with opening events" + ); + await pushPref("devtools.inspector.three-pane-enabled", false); + await pushPref("devtools.toolsidebar-width.inspector", 350); + await runEventPopupTests(TEST_URL, TEST_DATA); +}); |