From efc38278656f665b30c79f262435b0750a2f2b5a Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Wed, 3 Sep 2014 09:26:12 +0200 Subject: [PATCH] Extended the inline JS lexer spec. --- spec/oga/xml/lexer/inline_javascript_spec.rb | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/spec/oga/xml/lexer/inline_javascript_spec.rb b/spec/oga/xml/lexer/inline_javascript_spec.rb index 0aedbf5..418c2a0 100644 --- a/spec/oga/xml/lexer/inline_javascript_spec.rb +++ b/spec/oga/xml/lexer/inline_javascript_spec.rb @@ -34,5 +34,29 @@ describe Oga::XML::Lexer do [:T_ELEM_END, nil, 1] ] end + + example 'lex inline Javascript containing a processing instruction' do + lex("").should == [ + [:T_ELEM_START, nil, 1], + [:T_ELEM_NAME, 'script', 1], + [:T_TEXT, @javascript, 1], + [:T_PROC_INS_START, nil, 1], + [:T_PROC_INS_NAME, 'foo', 1], + [:T_PROC_INS_END, nil, 1], + [:T_ELEM_END, nil, 1] + ] + end + + example 'lex inline Javascript containing another element' do + lex("").should == [ + [:T_ELEM_START, nil, 1], + [:T_ELEM_NAME, 'script', 1], + [:T_TEXT, @javascript, 1], + [:T_ELEM_START, nil, 1], + [:T_ELEM_NAME, 'p', 1], + [:T_ELEM_END, nil, 1], + [:T_ELEM_END, nil, 1] + ] + end end end