From 1c9a6c8b7678d2c85f697bf4fb2223627ea7e242 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 3 Mar 2014 22:13:29 +0100 Subject: [PATCH] Tests for nested tags/text nodes. Well guess what, apparently that did work. That was slightly unexpected. --- spec/oga/lexer/elements_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/oga/lexer/elements_spec.rb b/spec/oga/lexer/elements_spec.rb index 5fa5503..5908a25 100644 --- a/spec/oga/lexer/elements_spec.rb +++ b/spec/oga/lexer/elements_spec.rb @@ -43,5 +43,17 @@ describe Oga::Lexer do [:T_ELEM_CLOSE, 'p', 1, 11] ] end + + example 'lex nested elements and text nodes' do + lex('

Foobarbaz

').should == [ + [:T_ELEM_OPEN, 'p', 1, 1], + [:T_TEXT, 'Foo', 1, 4], + [:T_ELEM_OPEN, 'a', 1, 7], + [:T_TEXT, 'bar', 1, 10], + [:T_ELEM_CLOSE, 'a', 1, 13], + [:T_TEXT, 'baz', 1, 17], + [:T_ELEM_CLOSE, 'p', 1, 20] + ] + end end end