Added remaining HTML closing specs
This commit is contained in:
parent
2f182a65fe
commit
dc2e31e35b
|
@ -0,0 +1,27 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Oga::XML::Lexer do
|
||||
describe 'using HTML <option> elements' do
|
||||
it 'lexes two unclosed <option> elements following each other as separate elements' do
|
||||
lex_html('<option>foo<option>bar').should == [
|
||||
[:T_ELEM_NAME, 'option', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_NAME, 'option', 1],
|
||||
[:T_TEXT, 'bar', 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
|
||||
it 'lexes an unclosed <option> followed by a <optgroup> as separate elements' do
|
||||
lex_html('<option>foo<optgroup>bar').should == [
|
||||
[:T_ELEM_NAME, 'option', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_NAME, 'optgroup', 1],
|
||||
[:T_TEXT, 'bar', 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,27 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Oga::XML::Lexer do
|
||||
describe 'using HTML <p> elements' do
|
||||
it 'lexes two unclosed <p> elements following each other as separate elements' do
|
||||
lex_html('<p>foo<p>bar').should == [
|
||||
[:T_ELEM_NAME, 'p', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_NAME, 'p', 1],
|
||||
[:T_TEXT, 'bar', 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
|
||||
it 'lexes an unclosed <p> followed by a <address> as separate elements' do
|
||||
lex_html('<p>foo<address>bar').should == [
|
||||
[:T_ELEM_NAME, 'p', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_NAME, 'address', 1],
|
||||
[:T_TEXT, 'bar', 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,27 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Oga::XML::Lexer do
|
||||
describe 'using HTML <rb> elements' do
|
||||
it 'lexes two unclosed <rb> elements following each other as separate elements' do
|
||||
lex_html('<rb>foo<rb>bar').should == [
|
||||
[:T_ELEM_NAME, 'rb', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_NAME, 'rb', 1],
|
||||
[:T_TEXT, 'bar', 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
|
||||
it 'lexes an unclosed <rb> followed by a <rt> as separate elements' do
|
||||
lex_html('<rb>foo<rt>bar').should == [
|
||||
[:T_ELEM_NAME, 'rb', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_NAME, 'rt', 1],
|
||||
[:T_TEXT, 'bar', 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,27 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Oga::XML::Lexer do
|
||||
describe 'using HTML <rp> elements' do
|
||||
it 'lexes two unclosed <rp> elements following each other as separate elements' do
|
||||
lex_html('<rp>foo<rp>bar').should == [
|
||||
[:T_ELEM_NAME, 'rp', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_NAME, 'rp', 1],
|
||||
[:T_TEXT, 'bar', 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
|
||||
it 'lexes an unclosed <rp> followed by a <rb> as separate elements' do
|
||||
lex_html('<rp>foo<rb>bar').should == [
|
||||
[:T_ELEM_NAME, 'rp', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_NAME, 'rb', 1],
|
||||
[:T_TEXT, 'bar', 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,27 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Oga::XML::Lexer do
|
||||
describe 'using HTML <rt> elements' do
|
||||
it 'lexes two unclosed <rt> elements following each other as separate elements' do
|
||||
lex_html('<rt>foo<rt>bar').should == [
|
||||
[:T_ELEM_NAME, 'rt', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_NAME, 'rt', 1],
|
||||
[:T_TEXT, 'bar', 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
|
||||
it 'lexes an unclosed <rt> followed by a <rtc> as separate elements' do
|
||||
lex_html('<rt>foo<rtc>bar').should == [
|
||||
[:T_ELEM_NAME, 'rt', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_NAME, 'rtc', 1],
|
||||
[:T_TEXT, 'bar', 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,27 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Oga::XML::Lexer do
|
||||
describe 'using HTML <rt> elements' do
|
||||
it 'lexes two unclosed <rtc> elements following each other as separate elements' do
|
||||
lex_html('<rtc>foo<rtc>bar').should == [
|
||||
[:T_ELEM_NAME, 'rtc', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_NAME, 'rtc', 1],
|
||||
[:T_TEXT, 'bar', 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
|
||||
it 'lexes an unclosed <rtc> followed by a <rb> as separate elements' do
|
||||
lex_html('<rtc>foo<rb>bar').should == [
|
||||
[:T_ELEM_NAME, 'rtc', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_NAME, 'rb', 1],
|
||||
[:T_TEXT, 'bar', 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,37 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Oga::XML::Lexer do
|
||||
describe 'using HTML <tbody> elements' do
|
||||
it 'lexes two unclosed <tbody> elements following each other as separate elements' do
|
||||
lex_html('<tbody>foo<tbody>bar').should == [
|
||||
[:T_ELEM_NAME, 'tbody', 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 <tbody> followed by a <tfoot> as separate elements' do
|
||||
lex_html('<tbody>foo<tfoot>bar').should == [
|
||||
[:T_ELEM_NAME, 'tbody', 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 a <tr> following an unclosed <tbody> as a child element' do
|
||||
lex_html('<tbody><tr>foo').should == [
|
||||
[:T_ELEM_NAME, 'tbody', 1],
|
||||
[:T_ELEM_NAME, 'tr', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,37 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Oga::XML::Lexer do
|
||||
describe 'using HTML <td> elements' do
|
||||
it 'lexes two unclosed <td> elements following each other as separate elements' do
|
||||
lex_html('<td>foo<td>bar').should == [
|
||||
[:T_ELEM_NAME, 'td', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_NAME, 'td', 1],
|
||||
[:T_TEXT, 'bar', 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
|
||||
it 'lexes an unclosed <td> followed by a <thead> as separate elements' do
|
||||
lex_html('<td>foo<thead>bar').should == [
|
||||
[:T_ELEM_NAME, 'td', 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 a <p> followed an unclosed <td> as a child element' do
|
||||
lex_html('<td><p>foo').should == [
|
||||
[:T_ELEM_NAME, 'td', 1],
|
||||
[:T_ELEM_NAME, 'p', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,37 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Oga::XML::Lexer do
|
||||
describe 'using HTML <tfoot> elements' do
|
||||
it 'lexes two unclosed <tfoot> elements following each other as separate elements' do
|
||||
lex_html('<tfoot>foo<tfoot>bar').should == [
|
||||
[:T_ELEM_NAME, 'tfoot', 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 <tfoot> followed by a <tbody> as separate elements' do
|
||||
lex_html('<tfoot>foo<tbody>bar').should == [
|
||||
[:T_ELEM_NAME, 'tfoot', 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 a <tr> following an unclosed <tfoot> as a child element' do
|
||||
lex_html('<tfoot><tr>foo').should == [
|
||||
[:T_ELEM_NAME, 'tfoot', 1],
|
||||
[:T_ELEM_NAME, 'tr', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,37 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Oga::XML::Lexer do
|
||||
describe 'using HTML <th> elements' do
|
||||
it 'lexes two unclosed <th> elements following each other as separate elements' do
|
||||
lex_html('<th>foo<th>bar').should == [
|
||||
[:T_ELEM_NAME, 'th', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_NAME, 'th', 1],
|
||||
[:T_TEXT, 'bar', 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
|
||||
it 'lexes an unclosed <th> followed by a <thead> as separate elements' do
|
||||
lex_html('<th>foo<thead>bar').should == [
|
||||
[:T_ELEM_NAME, 'th', 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 a <p> followed an unclosed <th> as a child element' do
|
||||
lex_html('<th><p>foo').should == [
|
||||
[:T_ELEM_NAME, 'th', 1],
|
||||
[:T_ELEM_NAME, 'p', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,37 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Oga::XML::Lexer do
|
||||
describe 'using HTML <thead> elements' do
|
||||
it 'lexes two unclosed <thead> elements following each other as separate elements' do
|
||||
lex_html('<thead>foo<thead>bar').should == [
|
||||
[:T_ELEM_NAME, 'thead', 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 <thead> followed by a <tbody> as separate elements' do
|
||||
lex_html('<thead>foo<tbody>bar').should == [
|
||||
[:T_ELEM_NAME, 'thead', 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 a <tr> following an unclosed <thead> as a child element' do
|
||||
lex_html('<thead><tr>foo').should == [
|
||||
[:T_ELEM_NAME, 'thead', 1],
|
||||
[:T_ELEM_NAME, 'tr', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,36 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Oga::XML::Lexer do
|
||||
describe 'using HTML <tr> elements' do
|
||||
it 'lexes two unclosed <tr> elements following each other as separate elements' do
|
||||
lex_html('<tr>foo<tr>bar').should == [
|
||||
[:T_ELEM_NAME, 'tr', 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 a <td> followed an unclosed <tr> as a child element' do
|
||||
lex_html('<tr><td>foo').should == [
|
||||
[:T_ELEM_NAME, 'tr', 1],
|
||||
[:T_ELEM_NAME, 'td', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
|
||||
it 'lexes a <th> followed an unclosed <tr> as a child element' do
|
||||
lex_html('<tr><th>foo').should == [
|
||||
[:T_ELEM_NAME, 'tr', 1],
|
||||
[:T_ELEM_NAME, 'th', 1],
|
||||
[:T_TEXT, 'foo', 1],
|
||||
[:T_ELEM_END, nil, 1],
|
||||
[:T_ELEM_END, nil, 1]
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue