require "test/unit"
require "phi"
class TCControl < Test::Unit::TestCase
  def test_ancestors
    assert_equal Phi::Component, Phi::Control.superclass
  end

  def test_1
    form = Phi::Form.new
    edit = Phi::Edit.new(form)
    assert_equal 1, form.controls.size
    assert_equal edit, form.controls.first
    assert_equal 0, form.controls(Phi::Component).size
    assert_equal 1, form.controls(Phi::Component, true).size
    assert_equal 1, form.controls(Phi::Edit).size
    assert_equal 1, form.controls(Phi::Edit, true).size
    assert_equal 0, edit.controls.size
  end
end
