1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

tests/firefox: add userchrome test cases

This commit is contained in:
Austin Horstman 2025-04-16 14:33:43 -05:00
parent 1827e84344
commit c6b75d69b6
5 changed files with 74 additions and 1 deletions

View file

@ -870,7 +870,7 @@ in
_: profile:
let
chromePath =
if (lib.isPath profile.userChrome && lib.pathIsDirectory profile.userChrome) then
if ((i: lib.isPath i && lib.pathIsDirectory i) profile.userChrome) then
"chrome"
else
"chrome/userChrome.css";

View file

@ -22,6 +22,7 @@ builtins.mapAttrs
"${name}-profiles-overwrite" = ./profiles/overwrite;
"${name}-profiles-search" = ./profiles/search;
"${name}-profiles-settings" = ./profiles/settings;
"${name}-profiles-userchrome" = ./profiles/userchrome;
"${name}-state-version-19_09" = ./state-version-19_09.nix;
"${name}-profiles-shared-path" = ./profiles/shared-path.nix;
}

View file

@ -0,0 +1,5 @@
#urlbar {
min-width: none !important;
border: none !important;
outline: none !important;
}

View file

@ -0,0 +1,62 @@
modulePath:
{ config, lib, ... }:
let
cfg = lib.getAttrFromPath modulePath config;
firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
in
{
imports = [ firefoxMockOverlay ];
config = lib.mkIf config.test.enableBig (
lib.setAttrByPath modulePath {
enable = true;
profiles = {
basic.isDefault = true;
lines = {
id = 1;
userChrome = # CSS
''
#urlbar {
min-width: none !important;
border: none !important;
outline: none !important;
}
'';
};
path = {
id = 2;
userChrome = ./chrome/userChrome.css;
};
folder = {
id = 3;
userChrome = ./chrome;
};
};
}
// {
nmt.script = ''
assertFileRegex \
home-path/bin/${cfg.wrappedPackageName} \
MOZ_APP_LAUNCHER
assertDirectoryExists home-files/${cfg.configPath}/basic
assertFileContent \
home-files/${cfg.configPath}/lines/chrome/userChrome.css \
${./expected-userchrome.css}
assertFileContent \
home-files/${cfg.configPath}/path/chrome/userChrome.css \
${./expected-userchrome.css}
assertFileContent \
home-files/${cfg.configPath}/folder/chrome/userChrome.css \
${./expected-userchrome.css}
'';
}
);
}

View file

@ -0,0 +1,5 @@
#urlbar {
min-width: none !important;
border: none !important;
outline: none !important;
}