diff --git a/spec/oga/xml/lexer/html_closing_rules/body_spec.rb b/spec/oga/xml/lexer/html_closing_rules/body_spec.rb new file mode 100644 index 0000000..c732205 --- /dev/null +++ b/spec/oga/xml/lexer/html_closing_rules/body_spec.rb @@ -0,0 +1,37 @@ +require 'spec_helper' + +describe Oga::XML::Lexer do + describe 'using HTML elements' do + it 'lexes an unclosed followed by a as separate elements' do + lex_html('foobar').should == [ + [:T_ELEM_NAME, 'body', 1], + [:T_TEXT, 'foo', 1], + [:T_ELEM_END, nil, 1], + [:T_ELEM_NAME, 'head', 1], + [:T_TEXT, 'bar', 1], + [:T_ELEM_END, nil, 1] + ] + end + + it 'lexes an unclosed followed by a as separate elements' do + lex_html('foobar').should == [ + [:T_ELEM_NAME, 'body', 1], + [:T_TEXT, 'foo', 1], + [:T_ELEM_END, nil, 1], + [:T_ELEM_NAME, 'body', 1], + [:T_TEXT, 'bar', 1], + [:T_ELEM_END, nil, 1] + ] + end + + it 'lexes a

following an unclosed as a child element' do + lex_html('

foo').should == [ + [:T_ELEM_NAME, 'body', 1], + [:T_ELEM_NAME, 'p', 1], + [:T_TEXT, 'foo', 1], + [:T_ELEM_END, nil, 1], + [:T_ELEM_END, nil, 1] + ] + end + end +end diff --git a/spec/oga/xml/lexer/html_closing_rules/head_spec.rb b/spec/oga/xml/lexer/html_closing_rules/head_spec.rb index 583f696..d5248af 100644 --- a/spec/oga/xml/lexer/html_closing_rules/head_spec.rb +++ b/spec/oga/xml/lexer/html_closing_rules/head_spec.rb @@ -24,7 +24,7 @@ describe Oga::XML::Lexer do ] end - it 'lexes a followed an unclosed <head> as a child element' do + it 'lexes a <title> following an unclosed <head> as a child element' do lex_html('<head><title>foo').should == [ [:T_ELEM_NAME, 'head', 1], [:T_ELEM_NAME, 'title', 1],