-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to style box frame and content
- Loading branch information
1 parent
ce94286
commit 5812e06
Showing
3 changed files
with
93 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
RSpec.describe TTY::Box, ":style option" do | ||
it "applies styling to content and border" do | ||
box = TTY::Box.frame( | ||
width: 30, | ||
height: 4, | ||
border: :thick, | ||
title: { | ||
top_left: ' file1 ' | ||
}, | ||
style: { | ||
fg: :bright_yellow, | ||
bg: :blue, | ||
border: { | ||
fg: :bright_yellow, | ||
bg: :blue | ||
} | ||
} | ||
) do | ||
"Midnight Commander\n is the best" | ||
end | ||
|
||
expect(box).to eq([ | ||
"\e[1;1H\e[44m\e[93m╔\e[0m\e[0m\e[44m file1 \e[0m\e[44m\e[93m══════════\e[0m\e[0m\e[44m\e[93m═══════════\e[0m\e[0m\e[44m\e[93m╗\e[0m\e[0m", | ||
"\e[2;1H\e[44m\e[93m║\e[0m\e[0m\e[44m\e[93mMidnight Commander\e[0m\e[0m\e[44m\e[93m \e[0m\e[0m\e[2;30H\e[44m\e[93m║\e[0m\e[0m", | ||
"\e[3;1H\e[44m\e[93m║\e[0m\e[0m\e[44m\e[93m is the best\e[0m\e[0m\e[44m\e[93m \e[0m\e[0m\e[3;30H\e[44m\e[93m║\e[0m\e[0m", | ||
"\e[4;1H\e[44m\e[93m╚\e[0m\e[0m\e[44m\e[93m══════════════\e[0m\e[0m\e[44m\e[93m══════════════\e[0m\e[0m\e[44m\e[93m╝\e[0m\e[0m" | ||
].join) | ||
end | ||
end |
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