Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from teamplanes/feature/prevent-deep-nesting
Prevent unnecessary nesting of breakpoint nodes (fixes #132)
- Loading branch information
Showing
4 changed files
with
369 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Breakpoints } from "../Breakpoints" | ||
|
||
const config = { | ||
"extra-small": 0, | ||
small: 768, | ||
medium: 1024, | ||
large: 1120, | ||
} | ||
|
||
const breakpoint = new Breakpoints(config) | ||
|
||
describe("Breakpoints", () => { | ||
describe("toVisibleAtBreakpointSet", () => { | ||
it("returns correct values for greaterThan", () => { | ||
const breakpoints = breakpoint.toVisibleAtBreakpointSet({ | ||
greaterThan: "small", | ||
}) | ||
expect(breakpoints).toEqual(["medium", "large"]) | ||
}) | ||
it("returns correct values for greaterThanOrEqual", () => { | ||
const breakpoints = breakpoint.toVisibleAtBreakpointSet({ | ||
greaterThanOrEqual: "small", | ||
}) | ||
expect(breakpoints).toEqual(["small", "medium", "large"]) | ||
}) | ||
it("returns correct values for lessThan", () => { | ||
const breakpoints = breakpoint.toVisibleAtBreakpointSet({ | ||
lessThan: "small", | ||
}) | ||
expect(breakpoints).toEqual(["extra-small"]) | ||
}) | ||
it("returns correct values for at", () => { | ||
const breakpoints = breakpoint.toVisibleAtBreakpointSet({ at: "small" }) | ||
expect(breakpoints).toEqual(["small"]) | ||
}) | ||
it("returns correct values for between", () => { | ||
const breakpoints = breakpoint.toVisibleAtBreakpointSet({ | ||
between: ["extra-small", "medium"], | ||
}) | ||
expect(breakpoints).toEqual(["extra-small", "small"]) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.