Sha256: 90ec7b088f67f35a40ecf52a2247d5987bd2100f19a0fa3e4ac9c2628cba5d32

Contents?: true

Size: 924 Bytes

Versions: 3

Compression:

Stored size: 924 Bytes

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

 
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
w3c_validators-0.9.1 test/test_css_validator.rb
w3c_validators-0.9.0 test/test_css_validator.rb
w3c_validators-0.9.2 test/test_css_validator.rb