Sha256: 919fb4b07db8491cb5b8684db643a378f8410d103a7dc3da278de6a3406bab9b

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

require File.dirname(__FILE__) + '/test_helper'

# Test cases for the CSSValidator.
class CSSValidatorTests < Test::Unit::TestCase
  include W3CValidators
  def setup
    @v = CSSValidator.new

    @invalid_fragment = <<-EOT
    a { color: white; }
    body { margin: blue; }
    
    EOT

    sleep 1
  end

  def test_overriding_css_profile
    @v.set_profile!(:svgbasic)
    r = @v.validate_text(@invalid_fragment)
    assert_equal 'svgbasic', r.css_level
  end

  def test_validating_file
    file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/invalid_css.css')
    r = @v.validate_file(file_path)
    assert_equal 1, r.errors.length
  end

  def test_validating_uri
    @v.set_profile!(:svgbasic)
    r = @v.validate_text(@invalid_fragment)
    assert_equal 1, r.errors.length
  end
 
  def test_validating_text
    r = @v.validate_text(@invalid_fragment)
    assert_equal 1, r.errors.length
  end

  def test_validating_text_via_file
    file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/invalid_css.css')
    fh = File.new(file_path, 'r+')    
    r = @v.validate_file(fh)
    fh.close
    assert_equal 1, r.errors.length
  end


 
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
alexdunae-w3c_validators-1.0.0 test/test_css_validator.rb
w3c_validators-0.9.3 test/test_css_validator.rb