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