Sha256: 089f96944d7a53208bba1144961cb7bdbc24512154cdd1a0a6a074077d53d350

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

# feature tests for Pre
# revision: $Revision: 1348 $

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
require 'unittests/setup'

class TC_Pre < Test::Unit::TestCase
  
  def setup
    goto_page "pre.html"
  end
  
  def test_Pre_Count
    assert( $ie.pres.length == 3 )
  end
  
  def test_Pre_Exists
    assert(! $ie.pre( :id, 'missingPre' ).exists? )
    assert(! $ie.pre( :index, 33 ).exists? )
    
    assert( $ie.pre( :id, '1' ).exists? )
    assert( $ie.pre( :id, /[3-9]/ ).exists? )
    
    assert(! $ie.pre( :id, /missing_pre/ ).exists? )
    
    assert( $ie.pre( :index, 1 ).exists? )
    assert( $ie.pre( :index, 2 ).exists? )
    assert( $ie.pre( :index, 3 ).exists? )
    
    assert( $ie.pre( :name, '3' ).exists? )
    assert(! $ie.pre( :name, "name_missing" ).exists? )
  end
  
  def test_simple_access
    pre = $ie.pre( :index, 1 )
    assert( pre.text.include?( "simple pre space" ) )
    assert(! pre.text.include?( "A second block" ) )
    
    assert( pre.html.include?( "id=1 name=\"1\"" ) )
    
    pre = $ie.pre( :index, 2 )
    assert( pre.text.include?( "A second block" ) )
    assert(! pre.text.include?( "this is the last block" ) )
    
    pre = $ie.pre( :index, 3 )
    assert( pre.text.include?( "continue    to work" ) )
    assert(! pre.text.include?( "Pre Tag Test" ) )
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
watir-1.5.5 unittests/pre_test.rb
watir-1.5.6 unittests/pre_test.rb