browser_rules_css-compatibility-learn-more-link.js (1807B)
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 that the Learn More link is displayed when possible, 8 // and that it links to MDN or the spec if no MDN url is provided. 9 10 const TEST_URI = ` 11 <style> 12 body { 13 user-select: none; 14 background-repeat-x: repeat; 15 } 16 </style> 17 <body> 18 </body>`; 19 20 const TEST_DATA_INITIAL = [ 21 { 22 selector: "body", 23 rules: [ 24 {}, 25 { 26 "user-select": { 27 value: "none", 28 expected: COMPATIBILITY_TOOLTIP_MESSAGE.default, 29 // MDN url 30 expectedLearnMoreUrl: 31 "https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/user-select?utm_source=devtools&utm_medium=inspector-css-compatibility&utm_campaign=default", 32 }, 33 "background-repeat-x": { 34 value: "repeat", 35 expected: COMPATIBILITY_TOOLTIP_MESSAGE.experimental, 36 // No MDN url, but a spec one 37 expectedLearnMoreUrl: 38 "https://drafts.csswg.org/css-backgrounds-4/#background-repeat-longhands", 39 }, 40 // TODO: Add a test for it when we have another property with no MDN url nor spec url Bug 1840910 41 }, 42 ], 43 }, 44 ]; 45 46 add_task(async function () { 47 await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); 48 const { inspector, view } = await openRuleView(); 49 50 // If the test fail because the properties used are no longer in the dataset, or they 51 // now have mdn/spec url although we expected them not to, uncomment the next line 52 // to get all the properties in the dataset that don't have a MDN url. 53 // logCssCompatDataPropertiesWithoutMDNUrl() 54 55 await runCSSCompatibilityTests(view, inspector, TEST_DATA_INITIAL); 56 });