`
Hooopo
  • 浏览: 337241 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

MarkupValidity

阅读更多
mark!

markup_validity version 1.0.0 has been released! 
* <http://github.com/tenderlove/markup_validity> 
MarkupValidity provides test/unit and rspec helpers for checking the validity 
of your documents.  Shortcuts for verifying xhtml-transitional and 
xhtml-strict documents are provided as well.  MarkupValidity will not only 
tell you when your document is invalid, but it will tell you what it *should* 
be. 
Changes: 
### 1.0.0 / 2009-06-11 
* 1 major enhancement 
  * Birthday! 
## FEATURES/PROBLEMS: 
* Make sure that markup_validity is required *after* test/unit, or mix 
  MarkupValidity::Assertions in to your test class yourself. 
* Currently AWESOME! 
## SYNOPSIS: 
  ### 
  # test/unit example 
  require 'test/unit' 
  require 'rubygems' 
  require 'markup_validity' 
  class ValidHTML < Test::Unit::TestCase 
    def test_i_can_has_valid_xhtml 
      assert_xhtml_transitional xhtml_document 
    end 
  end 
  ### 
  # rspec example 
  require 'rubygems' 
  require 'markup_validity' 
  describe "my XHTML document" do 
    it "can has transitional xhtml" do 
      xhtml_document.should be_xhtml_transitional 
    end 
  end 
  ### 
  # Rails controller test example 
  require 'test_helper' 
  require 'markup_validity' 
  class AwesomeControllerTest < ActionController::TestCase 
    test "valid markup" do 
      get :new 
      assert_xhtml_transitional @response.body 
    end 
  end 
  ### 
  # Here is an example error report 
  Error on line: 7: 
  Element 'p': This element is not expected. Expected is one of ( a, br, span, bdo, object, applet, img, map, iframe, tt ). 
  6:     <p> 
  7:       <p> 
  8:         Yo dawg, I heard you like p-tags 
  9:       </p> 
  10:     </p> 
  . 
  <false> is not true. 
## REQUIREMENTS: 
* depends on nokogiri 
## INSTALL: 
* gem install markup_validity 
* <http://github.com/tenderlove/markup_validity> 
-- 
Aaron Patterson 
http://tenderlovemaking.com/ 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics