Skip to content

Commit

Permalink
Merge pull request #801 from black7375/option
Browse files Browse the repository at this point in the history
Fix: `-moz-bool-pref` is moved from `@supports` to `@media` #799
  • Loading branch information
black7375 authored Oct 24, 2023
2 parents 0432012 + 8dc7a29 commit d7b0e55
Show file tree
Hide file tree
Showing 20 changed files with 19,456 additions and 42 deletions.
3 changes: 3 additions & 0 deletions __tests__/accent_color.test.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
@use "true" as *;
@use "../src/utils/accent_color" as *;
@use "../src/utils/mode";

@include test-module("Accent Color Option [mix]") {
@include mode.ESR;

@include test("simple") {
@include assert {
@include output {
Expand Down
60 changes: 60 additions & 0 deletions __tests__/mode.test.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,36 @@
}
}
}

@include test("support pref") {
@include mode.SUPPORT_PREF;

@include assert {
@include output {
@if mode.isMediaPref() {
@include example;
}
}
@include expect {
// IGNORE
}
}
}

@include test("media pref") {
@include mode.MEDIA_PREF;

@include assert {
@include output {
@if mode.isMediaPref() {
@include example;
}
}
@include expect {
// IGNORE
}
}
}
}

@include test-module("STANDARD Mode [mix]") {
Expand Down Expand Up @@ -54,4 +84,34 @@
}
}
}

@include test("support pref") {
@include mode.SUPPORT_PREF;

@include assert {
@include output {
@if mode.isMediaPref() {
@include example;
}
}
@include expect {
// IGNORE
}
}
}

@include test("media pref") {
@include mode.MEDIA_PREF;

@include assert {
@include output {
@if mode.isMediaPref() {
@include example;
}
}
@include expect {
@include example;
}
}
}
}
120 changes: 120 additions & 0 deletions __tests__/native_menu.test.scss
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@

@include test-module("Native Menu Option - Standard [mix]") {
@include mode.STANDARD;
@include mode.SUPPORT_PREF;

@include test("simple") {
@include assert {
Expand Down Expand Up @@ -252,3 +253,122 @@
}
}
}

@include test-module("Native Menu Option - MediaPref [mix]") {
@include mode.STANDARD;
@include mode.MEDIA_PREF;

@include test("simple") {
@include assert {
@include output {
@include native_menu.NativeToolkitMenu {
@include example;
}

@include native_menu.NativeMenuPopup {
@include example;
}
}
@include expect {
@media (-moz-bool-pref: '"widget.macos.native-context-menus"'), (-moz-bool-pref: '"widget.gtk.native-context-menus"') {
@include example;
}

menupopup:is(#historyMenuPopup, #bookmarksMenuPopup),
menupopup:not([placespopup="true"]) {
@include example;
}
}
}
}
@include test("native menu - with windows media") {
@include assert {
@include output {
@include native_menu.NativeMenu(true) {
@include example;
}

@include native_menu.NonNativeMenu(true) {
@include example;
}

@include native_menu.WinNativeMenu(true) {
@include example;
}

@include native_menu.WinNonNativeMenu(true) {
@include example;
}
}
@include expect {
@media (not (-moz-bool-pref: '"userChrome.theme.non_native_menu"')) {
@media (-moz-gtk-csd-available) {
@include example;
}
}

// Only Windows
@media (-moz-platform: windows) {
@include example;
}
@media (-moz-bool-pref: '"userChrome.theme.non_native_menu"') {
@media (-moz-gtk-csd-available) {
@include example;
}
}

// IGNORE

// Only Windows
@media (-moz-platform: windows) {
@include example;
}
}
}
}
@include test("native menu - without windows media") {
@include assert {
@include output {
@include native_menu.NativeMenu {
@include example;
}

@include native_menu.NonNativeMenu {
@include example;
}

@include native_menu.WinNativeMenu {
@include example;
}

@include native_menu.WinNonNativeMenu {
@include example;
}
}
@include expect {
@media (not (-moz-bool-pref: '"userChrome.theme.non_native_menu"')) {
@media (-moz-gtk-csd-available) {
@include example;
}
}

// AS Windows
@media (-moz-platform: windows) {
@include example;
}
@media (-moz-bool-pref: '"userChrome.theme.non_native_menu"') {
@media (-moz-gtk-csd-available) {
@include example;
}
}

// IGNORE

// AS Windows
@media (-moz-platform: windows) {
@include example;
}
}
}
}
}
116 changes: 114 additions & 2 deletions __tests__/one_liner.test.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
@use "true" as *;
@use "example" as *;
@use "../src/utils/one_liner";
@use "../src/utils/mode";

@include test-module("One Liner - ESR [mix]") {
@include mode.ESR;

@include test-module("One Liner [mix]") {
@include test("content") {
@include assert {
@include output {
Expand Down Expand Up @@ -46,7 +49,54 @@
}
}

@include test-module("One Liner for Responsive [mix]") {
@include test-module("One Liner - MediaPref [mix]") {
@include mode.STANDARD;
@include mode.MEDIA_PREF;

@include test("content") {
@include assert {
@include output {
@include one_liner.OneLinerContent {
@include example;
}
}
@include expect {
@media (not (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"')) {
@include example;
}
@media (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"') {
@media screen and (min-width: 1100px) {
@include example;
}
}
}
}
}

@include test("explicitly") {
@include assert {
@include output {
@include one_liner.OneLiner {
@include example;
}
}
@include expect {
@media (-moz-bool-pref: '"userChrome.tabbar.one_liner"') and (not (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"')) {
@include example;
}
@media (-moz-bool-pref: '"userChrome.tabbar.one_liner"') {
@media screen and (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"') and (min-width: 1100px) {
@include example;
}
}
}
}
}
}

@include test-module("One Liner for Responsive - ESR [mix]") {
@include mode.ESR;

@include test("Tabs on bottom") {
@include assert {
@include output {
Expand Down Expand Up @@ -116,3 +166,65 @@
}
}
}

@include test-module("One Liner for Responsive - MEDIA_PREF [mix]") {
@include mode.STANDARD;
@include mode.MEDIA_PREF;

@include test("Tabs on bottom") {
@include assert {
@include output {
@include one_liner.OneLinerOnBottom {
@include example;
}
}
@include expect {
@media (not (-moz-bool-pref: '"userChrome.tabbar.one_liner"')) {
@include example;
}
@media screen and (-moz-bool-pref: '"userChrome.tabbar.one_liner"') and (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"') and (max-width: 1100px) {
@include example;
}
}
}
}

@include test("Tab bar") {
@include assert {
@include output {
@include one_liner.OneLinerTabbar {
@include example;
}
}
@include expect {
@media (not (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"')) {
@include example;
}
@media screen and (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"') and (min-width: 1100px) {
@include example;
}
@media (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"') and (-moz-bool-pref: '"userChrome.autohide.tabbar"') {
@include example;
}
}
}
}

@include test("Nav Bar") {
@include assert {
@include output {
@include one_liner.OneLinerNavbar {
@include example;
}
}
@include expect {
@media (-moz-bool-pref: '"userChrome.autohide.navbar"') and (not (-moz-bool-pref: '"userChrome.tabbar.one_liner"')) {
@include example;
}
@media screen and (-moz-bool-pref: '"userChrome.autohide.navbar"') and (-moz-bool-pref: '"userChrome.tabbar.one_liner"') and (-moz-bool-pref: '"userChrome.tabbar.one_liner.responsive"') and (max-width: 1100px) {
@include example;
}
}
}
}
}
Loading

0 comments on commit d7b0e55

Please sign in to comment.