Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: twbs/bootstrap
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f25b1fdcb1f4fe0d7891e6e93d4b3afb2ee81331
Choose a base ref
..
head repository: twbs/bootstrap
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 570cd24fac0c174b3840e1a4db60c34307084e0b
Choose a head ref
Showing with 71 additions and 0 deletions.
  1. +71 −0 scss/tests/mixins/_color-modes-non-breaking.test.scss
71 changes: 71 additions & 0 deletions scss/tests/mixins/_color-modes-non-breaking.test.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// TODO: this file can be removed safely in v6 when `@import "variables-dark"` will be removed at the end of _variables.scss

// stylelint-disable selector-attribute-quotes

@import "../../functions";
@import "../../variables";
// Voluntarily not importing _variables-dark.scss
@import "../../maps";
@import "../../mixins";

@include describe("global $color-mode-type: data") {
@include it("generates data attribute selectors for dark mode") {
@include assert() {
@include output() {
@include color-mode(dark) {
.element {
color: var(--bs-primary-text-emphasis);
background-color: var(--bs-primary-bg-subtle);
}
}
@include color-mode(dark, true) {
--custom-color: #{mix($indigo, $blue, 50%)};
}
}
@include expect() {
[data-bs-theme=dark] .element {
color: var(--bs-primary-text-emphasis);
background-color: var(--bs-primary-bg-subtle);
}
[data-bs-theme=dark] {
--custom-color: #3a3ff8;
}
}
}
}
}

@include describe("global $color-mode-type: media-query") {
@include it("generates media queries for dark mode") {
$color-mode-type: media-query !global;

@include assert() {
@include output() {
@include color-mode(dark) {
.element {
color: var(--bs-primary-text-emphasis);
background-color: var(--bs-primary-bg-subtle);
}
}
@include color-mode(dark, true) {
--custom-color: #{mix($indigo, $blue, 50%)};
}
}
@include expect() {
@media (prefers-color-scheme: dark) {
.element {
color: var(--bs-primary-text-emphasis);
background-color: var(--bs-primary-bg-subtle);
}
}
@media (prefers-color-scheme: dark) {
:root {
--custom-color: #3a3ff8;
}
}
}
}

$color-mode-type: data !global;
}
}