diff --git a/spec/oga/xml/lexer/inline_javascript_spec.rb b/spec/oga/xml/lexer/inline_javascript_spec.rb
index 381bdc8..8a510e8 100644
--- a/spec/oga/xml/lexer/inline_javascript_spec.rb
+++ b/spec/oga/xml/lexer/inline_javascript_spec.rb
@@ -3,23 +3,25 @@ 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
+ @javascript = 'if ( number < 10 ) { }'
end
example 'lex inline Javascript' do
- lex("").should == [
+ lex("").should == [
[:T_ELEM_START, nil, 1],
[:T_ELEM_NAME, 'script', 1],
- [:T_TEXT, "\n#{@javascript}\n", 1],
- [:T_ELEM_END, nil, 9]
+ [:T_TEXT, @javascript, 1],
+ [:T_ELEM_END, nil, 1]
+ ]
+ end
+
+ example 'lex inline Javascript containing an XML comment' do
+ lex("").should == [
+ [:T_ELEM_START, nil, 1],
+ [:T_ELEM_NAME, 'script', 1],
+ [:T_TEXT, @javascript, 1],
+ [:T_ELEM_END, nil, 1],
+ [:T_COMMENT, 'foo', 1]
]
end
end