require 'test/unit'
require 'phi'

class TCCheckListBox < Test::Unit::TestCase
  def test_checked
    form = Phi::Form.new
    lbox = Phi::CheckListBox.new(form)
    lbox.add_item('hello', nil)
    assert ! lbox.checked[0]
    lbox.checked[0] = true
    assert lbox.checked[0]
  end

  def test_item_enabled
    form = Phi::Form.new
    lbox = Phi::CheckListBox.new(form)
    lbox.add_item('hello', nil)
    assert lbox.item_enabled[0]
    lbox.item_enabled[0] = false
    assert ! lbox.item_enabled[0]
  end

  def test_header
    form = Phi::Form.new
    lbox = Phi::CheckListBox.new(form)
    lbox.add_item('hello', nil)
    assert ! lbox.header[0]
    lbox.header[0] = true
    assert lbox.header[0]
  end

  def test_state
    form = Phi::Form.new
    lbox = Phi::CheckListBox.new(form)
    lbox.add_item('hello', nil)
    assert_equal 0, lbox.state[0]
    lbox.state[0] = 1
    assert_equal 1, lbox.state[0]
  end
end

