summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatrinox <geofflee21@me.com>2016-01-24 19:09:46 -0800
committerAbinoam Praxedes Marques Jr <abinoam@gmail.com>2016-02-19 03:57:18 -0300
commitdb74d876215d9ba1ac82ea21d38475fb27e1677c (patch)
treef25bed545678b25b580491db18b7380c238cc314
parente3a65711e5a5073e275ab2a94629a45cb9697a11 (diff)
downloadhighline-db74d876215d9ba1ac82ea21d38475fb27e1677c.tar.gz
Add tests for text overide and name/text interaction
-rw-r--r--test/test_menu.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/test_menu.rb b/test/test_menu.rb
index 15d4e50..1a53f28 100644
--- a/test/test_menu.rb
+++ b/test/test_menu.rb
@@ -81,6 +81,26 @@ class TestMenu < Minitest::Test
assert_equal("1. Unicode right single quotation mark: ’\n? ".encode(@output.external_encoding, { :undef => :replace }), @output.string)
end
+ def test_text_overide
+ @input << "1\n"
+ @input.rewind
+
+ @terminal.choose do |menu|
+ menu.choice "Sample1", text: 'more choice1'
+ end
+ assert_equal("1. more choice1\n? ", @output.string)
+ end
+
+ def test_name_with_text
+ @input << "Sample2\n"
+ @input.rewind
+
+ @terminal.choose do |menu|
+ menu.choice "Sample2", text: 'Sample1'
+ end
+ assert_equal("1. Sample1\n? ", @output.string)
+ end
+
def test_help
@input << "help\nhelp load\nhelp rules\nhelp missing\n"
@input.rewind