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