HTML closing specs for <dd>/<dd> elements

This commit is contained in:
Yorick Peterse 2015-05-19 00:22:04 +02:00
parent 1ba801370f
commit 2f182a65fe
2 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,27 @@
require 'spec_helper'
describe Oga::XML::Lexer do
describe 'using HTML <dt> elements' do
it 'lexes two unclosed <dd> elements following each other as separate elements' do
lex_html('<dd>foo<dd>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 <dd> followed by a <dt> as separate elements' do
lex_html('<dd>foo<dt>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

View File

@ -0,0 +1,27 @@
require 'spec_helper'
describe Oga::XML::Lexer do
describe 'using HTML <dt> elements' do
it 'lexes two unclosed <dt> elements following each other as separate elements' do
lex_html('<dt>foo<dt>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 <dt> followed by a <dd> as separate elements' do
lex_html('<dt>foo<dd>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