-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtest_check_box.rb
More file actions
48 lines (34 loc) · 952 Bytes
/
test_check_box.rb
File metadata and controls
48 lines (34 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
require 'ui'
class CheckBoxTest < Test::Unit::TestCase
include UI::Builder
def test_basics
dialog = main_dialog {
vbox {
check_box "Option 1", :id => :opt1
check_box "Option 2", :id => :opt2
check_box "Option 3", :id => :opt3
}
}
opt1 = dialog.find(:opt1)
opt2 = dialog.find(:opt2) # FIXME: check those values too?
opt3 = dialog.find(:opt3)
assert_kind_of UI::CheckBox, opt1
assert !opt1.value
assert !opt1.checked?
assert !opt1.dont_care?
opt1.checked = true
assert opt1.checked?
assert !opt1.dont_care?
opt1.checked = false
assert !opt1.checked?
assert !opt1.dont_care?
opt1.value = nil
assert !opt1.checked?
assert opt1.dont_care?
opt1.dont_care!
assert !opt1.checked?
assert opt1.dont_care?
assert_equal "Option 1", opt1.label
end
end