Skip to content

Commit

Permalink
Change to rename mask symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Feb 16, 2019
1 parent 8131a69 commit 94f95dd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/tty/prompt/mask_question.rb
Expand Up @@ -13,7 +13,7 @@ class MaskQuestion < Question
# @api public
def initialize(prompt, **options)
super
@mask = options.fetch(:mask) { @prompt.symbols[:dot] }
@mask = options.fetch(:mask) { @prompt.symbols[:mask] }
@done_masked = false
@failure = false
end
Expand Down
4 changes: 2 additions & 2 deletions lib/tty/prompt/symbols.rb
Expand Up @@ -12,7 +12,7 @@ module Symbols
star: '★',
square: '◼',
square_empty: '◻',
dot: '•',
mask: '•',
pointer: '‣',
line: '─',
pipe: '|',
Expand All @@ -32,7 +32,7 @@ module Symbols
star: '*',
square: '[█]',
square_empty: '[ ]',
dot: '.',
mask: '.',
pointer: '>',
line: '-',
pipe: '|',
Expand Down
14 changes: 7 additions & 7 deletions spec/unit/mask_spec.rb
Expand Up @@ -14,17 +14,17 @@
expect(prompt.output.string).to eq([
"What is your password? ",
"\e[2K\e[1G",
"What is your password? #{symbols[:dot]}",
"What is your password? #{symbols[:mask]}",
"\e[2K\e[1G",
"What is your password? #{symbols[:dot] * 2}",
"What is your password? #{symbols[:mask] * 2}",
"\e[2K\e[1G",
"What is your password? #{symbols[:dot] * 3}",
"What is your password? #{symbols[:mask] * 3}",
"\e[2K\e[1G",
"What is your password? #{symbols[:dot] * 4}",
"What is your password? #{symbols[:mask] * 4}",
"\e[2K\e[1G",
"What is your password? \e[32m#{symbols[:dot] * 4}\e[0m\n",
"What is your password? \e[32m#{symbols[:mask] * 4}\e[0m\n",
"\e[1A\e[2K\e[1G",
"What is your password? \e[32m#{symbols[:dot] * 4}\e[0m\n"
"What is your password? \e[32m#{symbols[:mask] * 4}\e[0m\n"
].join)
end

Expand Down Expand Up @@ -96,7 +96,7 @@
end

it "validates input" do
prompt = TTY::TestPrompt.new(symbols: {dot: '*'})
prompt = TTY::TestPrompt.new(symbols: {mask: '*'})
prompt.input << "no\nyes\n"
prompt.input.rewind
answer = prompt.mask('What is your password?') do |q|
Expand Down

0 comments on commit 94f95dd

Please sign in to comment.