From 81cf7ba9b62a64c84d8806562fdb925c7d9c7949 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 18 May 2015 00:32:01 +0200 Subject: [PATCH] Reworked HTML caption closing specs --- .../lexer/html_closing_rules/caption_spec.rb | 60 ++++++++++++++++++- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/spec/oga/xml/lexer/html_closing_rules/caption_spec.rb b/spec/oga/xml/lexer/html_closing_rules/caption_spec.rb index e660dac..037cabf 100644 --- a/spec/oga/xml/lexer/html_closing_rules/caption_spec.rb +++ b/spec/oga/xml/lexer/html_closing_rules/caption_spec.rb @@ -1,8 +1,52 @@ require 'spec_helper' describe Oga::XML::Lexer do - describe 'HTML caption elements' do - it 'lexes an unclosed followed by another ' do + describe 'using HTML elements' do + it 'lexes an unclosed followed by a as separate elements' do + lex_html('foobar').should == [ + [:T_ELEM_NAME, 'caption', 1], + [:T_TEXT, 'foo', 1], + [:T_ELEM_END, nil, 1], + [:T_ELEM_NAME, 'thead', 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, 'caption', 1], + [:T_TEXT, 'foo', 1], + [:T_ELEM_END, nil, 1], + [:T_ELEM_NAME, 'tbody', 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, 'caption', 1], + [:T_TEXT, 'foo', 1], + [:T_ELEM_END, nil, 1], + [:T_ELEM_NAME, 'tfoot', 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, 'caption', 1], + [:T_TEXT, 'foo', 1], + [:T_ELEM_END, nil, 1], + [:T_ELEM_NAME, 'tr', 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, 'caption', 1], [:T_TEXT, 'foo', 1], @@ -13,7 +57,7 @@ describe Oga::XML::Lexer do ] end - it 'lexes an unclosed followed by a ' do + it 'lexes an unclosed followed by a as separate elements' do lex_html('foobar').should == [ [:T_ELEM_NAME, 'caption', 1], [:T_TEXT, 'foo', 1], @@ -23,5 +67,15 @@ describe Oga::XML::Lexer do [:T_ELEM_END, nil, 1] ] end + + it 'lexes an unclosed followed by a as separate elements' do + lex_html('foo').should == [ + [:T_ELEM_NAME, 'caption', 1], + [:T_TEXT, 'foo', 1], + [:T_ELEM_END, nil, 1], + [:T_ELEM_NAME, 'col', 1], + [:T_ELEM_END, nil, 1] + ] + end end end