Sha256: 45e68605cc7734319c0dddea7ced28342b58a63e075a56a19098beac6953f4f6

Contents?: true

Size: 1.78 KB

Versions: 4

Compression:

Stored size: 1.78 KB

Contents

# -*- encoding : utf-8 -*-

describe Card::Set::All::RichHtml do
  describe 'missing view' do
    it "should prompt to add" do
      render_content('{{+cardipoo|open}}').match(/Add \<span/ ).should_not be_nil
    end
  end
  
  describe "type_list" do
    before do
      @card = Card['UserForm']  # no cards with this type
    end
    
    it "should get type options from type_field renderer method" do
      @card.format.type_field.should match(/<option [^>]*selected/)
      tf=@card.format.type_field(:no_current_type=>true)
      tf.should_not match(/<option [^>]*selected/)
      tf.scan(/<option /).length.should == 23
      tf=@card.format.type_field
      tf.should match(/<option [^>]*selected/)
      tf.scan(/<option /).length.should == 23
    end
    
    it "should get type list" do
      Card::Auth.as :anonymous do
        tf=@card.format.type_field(:no_current_type=>true)
        tf.should_not match(/<option [^>]*selected/)
        tf.scan(/<option /).length.should == 1
        tf=@card.format.type_field
        tf.should match(/<option [^>]*selected/)
        tf.scan(/<option /).length.should == 2
      end
    end
  end
  
  context "type and header" do
    it "should render type without no-edit class when no cards of type" do
      card = Card['UserForm']  # no cards with this type
      card.format.render_type.should match(/<a [^>]* class="([^"]* )?cardtype[^"]*"/)
      card.format.render_type.should_not match(/<a [^>]* class="([^"]* )?no-edit[^"]*"/)
    end
    it "should render type header with no-edit class when cards of type exist" do
      no_edit_card = Card['cardtype a']
      no_edit_card.format.render_type.should match(/<a [^>]* class="([^"]* )?cardtype[^"]*"/)
      no_edit_card.format.render_type.should match(/<a [^>]* class="([^"]* )?no-edit[^"]*"/)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wagn-1.13.0 spec/mod/standard/set/all/rich_html_spec.rb
wagn-1.13.0.pre2 spec/mods/standard/sets/all/rich_html_spec.rb
wagn-1.13.0.pre1 spec/mods/standard/sets/all/rich_html_spec.rb
wagn-1.13.0.pre spec/mods/standard/sets/all/rich_html_spec.rb