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/grids/test/browser_grids_number-of-css-grids-telemetry.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/grids/test/browser_grids_number-of-css-grids-telemetry.js')
-rw-r--r-- | devtools/client/inspector/grids/test/browser_grids_number-of-css-grids-telemetry.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/devtools/client/inspector/grids/test/browser_grids_number-of-css-grids-telemetry.js b/devtools/client/inspector/grids/test/browser_grids_number-of-css-grids-telemetry.js new file mode 100644 index 0000000000..6ec6b32a63 --- /dev/null +++ b/devtools/client/inspector/grids/test/browser_grids_number-of-css-grids-telemetry.js @@ -0,0 +1,56 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Tests that the telemetry count for the number of CSS Grid Elements on a page navigation +// is correct when the toolbox is opened. + +const TEST_URI1 = ` + <div></div> +`; + +const TEST_URI2 = ` + <style type='text/css'> + #grid { + display: grid; + } + </style> + <div id="grid"> + <div id="cell1">cell1</div> + <div id="cell2">cell2</div> + </div> +`; + +add_task(async function () { + await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI1)); + + startTelemetry(); + + const { inspector } = await openLayoutView(); + const { store } = inspector; + + info("Navigate to TEST_URI2"); + + const onGridListUpdate = waitUntilState( + store, + state => state.grids.length == 1 + ); + await navigateTo( + "data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI2) + ); + await onGridListUpdate; + + checkResults(); +}); + +function checkResults() { + // Check for: + // - 1 CSS Grid Element + checkTelemetry( + "DEVTOOLS_NUMBER_OF_CSS_GRIDS_IN_A_PAGE", + "", + { 0: 0, 1: 1, 2: 0 }, + "array" + ); +} |