##
# Only for use with unit tests

class HtmlDocument #:nodoc:

  attr :head

  def initialize
    @head = Borges::HtmlElement.new :head
    @body = Borges::HtmlElement.new :body
    @stack = [@body]
  end

  def add_element(e)
    @stack.last.add e
  end

  def pop_element
    @stack.pop
  end

  def push_element(e)
    add_element e
    @stack.push e
  end

  def print_html_on(str)
    str << "<html>#{@head}#{@body}</html>"
  end

end # class HtmlDocument

