Fix and simplify JS quirks tests

This commit is contained in:
Florian Bruhin 2025-03-25 14:23:48 +01:00
parent c4d8502872
commit b6d5a5cf14
2 changed files with 7 additions and 7 deletions

View File

@ -45,7 +45,7 @@ Fixed
error is shown instead).
- The default user agent now only contains the shortened Chromium version
number, which fixes overzealous blocking on ScienceDirect.
- New site-specific quirk to fix existing accounts showing as non-existant on
- New site-specific quirk to fix existing accounts showing as non-existent on
Digitec/Galaxus.
- Resolved issues in userscripts:
* `qute-bitwarden` will now prompt a re-login if its cached session has

View File

@ -61,17 +61,17 @@ def test_js_quirks_match_files(webengine_tab):
def test_js_quirks_match_settings(webengine_tab, configdata_init):
quirks_code = {q.name for q in webengine_tab._scripts._get_quirks()}
opt = configdata.DATA["content.site_specific_quirks.skip"]
prefix = "js-"
valid_values = opt.typ.get_valid_values()
assert valid_values is not None
quirks_config = {
val.removeprefix(prefix).replace("-", "_")
val
for val in valid_values
if val.startswith(prefix)
# some JS quirks are actually only setting the user agent, so we include
# those as well.
if val.startswith("js-") or (val.startswith("ua-") and val in quirks_code)
}
quirks_code = {q.filename for q in webengine_tab._scripts._get_quirks()}
quirks_code -= {"googledocs"} # special case, UA quirk
assert quirks_code == quirks_config