From 07617a9c472c2b612a03016e71792f4a4c63d9d1 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 2 Sep 2014 22:50:36 +0200 Subject: [PATCH] Failing spec for lexing inline Javascript. --- spec/oga/xml/lexer/inline_javascript_spec.rb | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 spec/oga/xml/lexer/inline_javascript_spec.rb diff --git a/spec/oga/xml/lexer/inline_javascript_spec.rb b/spec/oga/xml/lexer/inline_javascript_spec.rb new file mode 100644 index 0000000..381bdc8 --- /dev/null +++ b/spec/oga/xml/lexer/inline_javascript_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe Oga::XML::Lexer do + context 'lexing inline Javascript' do + before do + @javascript = <<-EOF.strip +(function() +{ + if ( some_number < 10 ) + { + console.log('Hello'); + } +})(); + EOF + end + + example 'lex inline Javascript' do + lex("").should == [ + [:T_ELEM_START, nil, 1], + [:T_ELEM_NAME, 'script', 1], + [:T_TEXT, "\n#{@javascript}\n", 1], + [:T_ELEM_END, nil, 9] + ] + end + end +end