Sha256: 981b1e40077d8086fe0bdfea8e1527e3747c6cc7e6bbb079490022667fbf0792

Contents?: true

Size: 1.57 KB

Versions: 4

Compression:

Stored size: 1.57 KB

Contents

require File.join(__FILE__.gsub(/(.*)?\/spec\/.*$/, '\1'), 'spec/spec_helper')

describe Rtml::Widgets::Screens do
  before :each do
    @doc = Rtml::Document.new
  end

  it "should have a #gui_configuration" do
    Rtml::Widgets::Screens.gui_configuration.should_not be_nil
  end

  context "with a #gui_configuration" do
    before(:each) { @gui = Rtml::Widgets::Screens.gui_configuration }

    #it "should have a title" do
    #  @gui.title.should_not be_blank
    #end

    it "should construct initialization arguments from a hash of fields" do
      fields = {:name => "screen_name", :next => "next_screen"}
      arguments = @gui.construct_arguments(fields)
      arguments.should == ["screen_name", {:next => "next_screen"}]
    end
  end

  it "should find or build a TML screen" do
    # build a few screens
    @doc.screen :init, :main, :timeout => 3
    @doc.screen :main
    @doc.screens.should have(2).items

    # find and update but don't create a screen
    scr = @doc.screen(:init, :other)
    scr.should be_kind_of(Rtml::Dom::ScreenElement)
    @doc.screens.should have(2).items
  end

  it "should allow subelements for screens" do
    # build a few screens
    @doc.screen :init, :main, :timeout => 3 do
      setvar :name => "oebr.transid", :lo => '1'
    end

    @doc.screen :main do
      display
    end
    
    @doc.screens.should have(2).items
    @doc.screens.first.elements.should have(1).item
    @doc.screens.second.elements.should have(1).item

    (@doc.screen(:init) / :setvar).should have(1).setvar
    (@doc.screen(:main) / :display).should have(1).element
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rtml-2.0.3 spec/widgets/screens_spec.rb
rtml-2.0.2 spec/widgets/screens_spec.rb
rtml-2.0.1 spec/widgets/screens_spec.rb
rtml-2.0.0.alpha.1 spec/widgets/screens_spec.rb