-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
defmodule SaladUI.HelperTest do | ||
use ExUnit.Case, async: true | ||
|
||
alias SaladUI.Helpers | ||
|
||
@vertical_align_classes %{ | ||
"start" => "top-0", | ||
"center" => "top-1/2 -translate-y-1/2 slide-in-from-top-1/2", | ||
"end" => "bottom-0" | ||
} | ||
|
||
@horizontal_align_classes %{ | ||
"start" => "left-0", | ||
"center" => "left-1/2 -translate-x-1/2 slide-in-from-left-1/2", | ||
"end" => "right-0" | ||
} | ||
|
||
@side_classes %{ | ||
"top" => "bottom-full mb-2", | ||
"bottom" => "top-full mt-2", | ||
"left" => "right-full mr-2", | ||
"right" => "left-full ml-2" | ||
} | ||
|
||
test "build variant for side with default center align" do | ||
for side <- ["top", "bottom"] do | ||
assert Helpers.side_variant(side) =~ @side_classes[side] | ||
assert Helpers.side_variant(side) =~ @horizontal_align_classes["center"] | ||
end | ||
|
||
for side <- ["left", "right"] do | ||
assert Helpers.side_variant(side) =~ @side_classes[side] | ||
assert Helpers.side_variant(side) =~ @vertical_align_classes["center"] | ||
end | ||
end | ||
|
||
test "build variant with correct allignment for top and bottom" do | ||
for side <- ["top", "bottom"], align <- ["start", "center", "end"] do | ||
assert Helpers.side_variant(side, align) =~ @horizontal_align_classes[align] | ||
end | ||
end | ||
|
||
test "build variant with correct allignment for left and right" do | ||
for side <- ["left", "right"], align <- ["start", "center", "end"] do | ||
assert Helpers.side_variant(side, align) =~ @vertical_align_classes[align] | ||
end | ||
end | ||
end |