Sha256: d3e4132051ba0d5dfb509da7551d879d44c244f013f87bf8820c86cc41060593

Contents?: true

Size: 1.9 KB

Versions: 5

Compression:

Stored size: 1.9 KB

Contents

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

describe Rtml::Widgets::Frontend do
  before :each do
    @doc = Rtml::Document.new(:name => 'magcard')
    @doc.view.view_paths << File.join(Rtml.root, "spec/support/app/views")
  end

  it "should not send the :file option into element properties" do
    scr = @doc.screen :main
    scr.display :file => 'magcard/main'
    scr.to_tml.should_not have_selector(:display, :file => 'magcard/main')
  end

  it "should accept a screen name for rendering" do
    scr = @doc.screen :main
    cnt = scr.display :main
    cnt.to_tml.should == "<display> \n\tHello, World!\n</display>"
  end

  it "should infer display view content from subprocessing" do
    content_text = "Hello, World"
    scr = @doc.screen :main
    cnt = scr.display { inner_content content_text }

    cnt.to_tml.should == "<display> \n\t#{content_text}\n</display>"
  end

  it "should infer display view content from document and screen names" do
    scr = @doc.screen :main
    cnt = scr.display
    cnt.to_tml.should == "<display> \n\tHello, World!\n</display>"
  end

  it "should infer print view content from subprocessing" do
    content_text = "Hello, World"
    scr = @doc.screen :main
    cnt = scr.print { inner_content content_text }
    cnt.to_tml.should == "<print> \n\t#{content_text}\n</print>"
  end

  it "should infer print view content from document and screen names" do
    scr = @doc.screen :main
    cnt = scr.print
    cnt.to_tml.should == "<print> \n\tHello, World!\n</print>"
  end

  it "should receive display content from a single string argument" do
    scr = @doc.screen :main
    cnt = scr.display "Hello"
    cnt.to_tml.should == "<display> \n\tHello\n</display>"
  end

  it "should receive print content from a single string argument" do
    scr = @doc.screen :main
    cnt = scr.print "Hello"
    cnt.to_tml.should == "<print> \n\tHello\n</print>"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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