Skip to content

Commit

Permalink
add mynyml's scope test (needs to be integrated)
Browse files Browse the repository at this point in the history
  • Loading branch information
smparkes committed Feb 6, 2010
1 parent 8c858bc commit 78786f1
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/scope.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env ruby
require 'rubygems'
require 'johnson/tracemonkey'
require 'envjs/runtime'

require 'nanotest'
include Nanotest

rt = Johnson::Runtime.new
rt.extend(Envjs::Runtime)

rt.evaluate('window.location = "http://example.com"')
assert { 'Example Web Page' == rt.evaluate('window.document.title') }
assert { 'Example Web Page' == rt.evaluate('this.document.title') }
assert { 'Example Web Page' == rt.evaluate('document.title') }

rt.evaluate('window.location = "http://montrealrb.org"')
assert { 'Montreal.rb' == rt.evaluate('window.document.title') }

# correct
# assert { 'Montreal.rb' == rt.evaluate('this.document.title') }
# buggy
assert { 'Example Web Page' == rt.evaluate('this.document.title') }

assert { 'Example Web Page' == rt.evaluate('document.title') }

0 comments on commit 78786f1

Please sign in to comment.