browser_rules_css-compatibility-tooltip-telemetry.js (1355B)
1 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ 2 /* Any copyright is dedicated to the Public Domain. 3 http://creativecommons.org/publicdomain/zero/1.0/ */ 4 5 "use strict"; 6 7 // Test - Toggling rules linked to the element and the class 8 // Checking whether the compatibility warning icon is displayed 9 // correctly. 10 // If a rule is disabled, it is marked compatible to keep 11 // consistency with compatibility panel. 12 // We test both the compatible and incompatible rules here 13 14 const TEST_URI = ` 15 <style> 16 div { 17 -moz-float-edge: content-box; 18 } 19 </style> 20 <div></div>`; 21 22 const TEST_DATA = [ 23 { 24 selector: "div", 25 rules: [ 26 {}, 27 { 28 "-moz-float-edge": { 29 value: "content-box", 30 expected: COMPATIBILITY_TOOLTIP_MESSAGE.deprecated, 31 }, 32 }, 33 ], 34 }, 35 ]; 36 37 add_task(async function () { 38 startTelemetry(); 39 40 await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); 41 const { inspector, view } = await openRuleView(); 42 43 info("Check correctness of data by toggling tooltip open"); 44 await runCSSCompatibilityTests(view, inspector, TEST_DATA); 45 46 checkResults(); 47 }); 48 49 function checkResults() { 50 info( 51 'Check the telemetry against "devtools.tooltip.shown" for label "css-compatibility" and ensure it is set' 52 ); 53 checkTelemetry("devtools.tooltip.shown", "", 1, "css-compatibility"); 54 }