diff --git a/modules/programs/firefox/mkFirefoxModule.nix b/modules/programs/firefox/mkFirefoxModule.nix index 7cf51777c..e2e9935c7 100644 --- a/modules/programs/firefox/mkFirefoxModule.nix +++ b/modules/programs/firefox/mkFirefoxModule.nix @@ -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"; diff --git a/tests/modules/programs/firefox/common.nix b/tests/modules/programs/firefox/common.nix index 23a0a718b..35282c041 100644 --- a/tests/modules/programs/firefox/common.nix +++ b/tests/modules/programs/firefox/common.nix @@ -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; } diff --git a/tests/modules/programs/firefox/profiles/userchrome/chrome/userChrome.css b/tests/modules/programs/firefox/profiles/userchrome/chrome/userChrome.css new file mode 100644 index 000000000..120791fd7 --- /dev/null +++ b/tests/modules/programs/firefox/profiles/userchrome/chrome/userChrome.css @@ -0,0 +1,5 @@ +#urlbar { + min-width: none !important; + border: none !important; + outline: none !important; +} diff --git a/tests/modules/programs/firefox/profiles/userchrome/default.nix b/tests/modules/programs/firefox/profiles/userchrome/default.nix new file mode 100644 index 000000000..a0640afd8 --- /dev/null +++ b/tests/modules/programs/firefox/profiles/userchrome/default.nix @@ -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} + ''; + } + ); +} diff --git a/tests/modules/programs/firefox/profiles/userchrome/expected-userchrome.css b/tests/modules/programs/firefox/profiles/userchrome/expected-userchrome.css new file mode 100644 index 000000000..120791fd7 --- /dev/null +++ b/tests/modules/programs/firefox/profiles/userchrome/expected-userchrome.css @@ -0,0 +1,5 @@ +#urlbar { + min-width: none !important; + border: none !important; + outline: none !important; +}