From 2f182a65fe560950cf2d2cd4f01bc55dac76cec1 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 19 May 2015 00:22:04 +0200 Subject: [PATCH] HTML closing specs for
/
elements --- .../xml/lexer/html_closing_rules/dd_spec.rb | 27 +++++++++++++++++++ .../xml/lexer/html_closing_rules/dt_spec.rb | 27 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 spec/oga/xml/lexer/html_closing_rules/dd_spec.rb create mode 100644 spec/oga/xml/lexer/html_closing_rules/dt_spec.rb diff --git a/spec/oga/xml/lexer/html_closing_rules/dd_spec.rb b/spec/oga/xml/lexer/html_closing_rules/dd_spec.rb new file mode 100644 index 0000000..dc3f7ae --- /dev/null +++ b/spec/oga/xml/lexer/html_closing_rules/dd_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe Oga::XML::Lexer do + describe 'using HTML
elements' do + it 'lexes two unclosed
elements following each other as separate elements' do + lex_html('
foo
bar').should == [ + [:T_ELEM_NAME, 'dd', 1], + [:T_TEXT, 'foo', 1], + [:T_ELEM_END, nil, 1], + [:T_ELEM_NAME, 'dd', 1], + [:T_TEXT, 'bar', 1], + [:T_ELEM_END, nil, 1] + ] + end + + it 'lexes an unclosed
followed by a
as separate elements' do + lex_html('
foo
bar').should == [ + [:T_ELEM_NAME, 'dd', 1], + [:T_TEXT, 'foo', 1], + [:T_ELEM_END, nil, 1], + [:T_ELEM_NAME, 'dt', 1], + [:T_TEXT, 'bar', 1], + [:T_ELEM_END, nil, 1] + ] + end + end +end diff --git a/spec/oga/xml/lexer/html_closing_rules/dt_spec.rb b/spec/oga/xml/lexer/html_closing_rules/dt_spec.rb new file mode 100644 index 0000000..9f5e199 --- /dev/null +++ b/spec/oga/xml/lexer/html_closing_rules/dt_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe Oga::XML::Lexer do + describe 'using HTML
elements' do + it 'lexes two unclosed
elements following each other as separate elements' do + lex_html('
foo
bar').should == [ + [:T_ELEM_NAME, 'dt', 1], + [:T_TEXT, 'foo', 1], + [:T_ELEM_END, nil, 1], + [:T_ELEM_NAME, 'dt', 1], + [:T_TEXT, 'bar', 1], + [:T_ELEM_END, nil, 1] + ] + end + + it 'lexes an unclosed
followed by a
as separate elements' do + lex_html('
foo
bar').should == [ + [:T_ELEM_NAME, 'dt', 1], + [:T_TEXT, 'foo', 1], + [:T_ELEM_END, nil, 1], + [:T_ELEM_NAME, 'dd', 1], + [:T_TEXT, 'bar', 1], + [:T_ELEM_END, nil, 1] + ] + end + end +end