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/rules/test/browser_rules_css-compatibility-learn-more-link.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/rules/test/browser_rules_css-compatibility-learn-more-link.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/devtools/client/inspector/rules/test/browser_rules_css-compatibility-learn-more-link.js b/devtools/client/inspector/rules/test/browser_rules_css-compatibility-learn-more-link.js new file mode 100644 index 0000000000..08e86e6202 --- /dev/null +++ b/devtools/client/inspector/rules/test/browser_rules_css-compatibility-learn-more-link.js @@ -0,0 +1,66 @@ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Test that the Learn More link is displayed when possible, +// and that it links to MDN or the spec if no MDN url is provided. + +const TEST_URI = ` +<style> + body { + user-select: none; + hyphenate-limit-chars: auto; + overflow-clip-box: padding-box; + } +</style> +<body> +</body>`; + +const TEST_DATA_INITIAL = [ + { + selector: "body", + rules: [ + {}, + { + "user-select": { + value: "none", + expected: COMPATIBILITY_TOOLTIP_MESSAGE.default, + // MDN url + expectedLearnMoreUrl: + "https://developer.mozilla.org/docs/Web/CSS/user-select?utm_source=devtools&utm_medium=inspector-css-compatibility&utm_campaign=default", + }, + "hyphenate-limit-chars": { + value: "auto", + expected: COMPATIBILITY_TOOLTIP_MESSAGE.default, + // No MDN url, but a spec one + expectedLearnMoreUrl: + "https://drafts.csswg.org/css-text-4/#propdef-hyphenate-limit-chars", + }, + "overflow-clip-box": { + expected: COMPATIBILITY_TOOLTIP_MESSAGE.default, + value: "padding-box", + // No MDN nor spec url + expectedLearnMoreUrl: null, + }, + }, + ], + }, +]; + +add_task(async function () { + await pushPref( + "devtools.inspector.ruleview.inline-compatibility-warning.enabled", + true + ); + await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); + const { inspector, view } = await openRuleView(); + + // If the test fail because the properties used are no longer in the dataset, or they + // now have mdn/spec url although we expected them not to, uncomment the next line + // to get all the properties in the dataset that don't have a MDN url. + // logCssCompatDataPropertiesWithoutMDNUrl() + + await runCSSCompatibilityTests(view, inspector, TEST_DATA_INITIAL); +}); |