Added HTML head closing specs

This commit is contained in:
Yorick Peterse 2015-05-18 00:32:19 +02:00
parent 2a1c5646f3
commit 5a74571536
1 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,37 @@
require 'spec_helper'
describe Oga::XML::Lexer do
describe 'using HTML <head> elements' do
it 'lexes an unclosed <head> followed by a <head> as separate elements' do
lex_html('<head>foo<head>bar').should == [
[:T_ELEM_NAME, 'head', 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 <head> followed by a <body> as separate elements' do
lex_html('<head>foo<body>bar').should == [
[:T_ELEM_NAME, 'head', 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 <title> followed an unclosed <head> as a child element' do
lex_html('<head><title>foo</title>').should == [
[:T_ELEM_NAME, 'head', 1],
[:T_ELEM_NAME, 'title', 1],
[:T_TEXT, 'foo', 1],
[:T_ELEM_END, nil, 1],
[:T_ELEM_END, nil, 1]
]
end
end
end