<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 *SVN*
 
+* Add JavaScriptTest namespace wrapper
+
 * Added test for JavaScript test runner
 
 * Issue headers that prevent caching, #6218 [voidlock]</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -2,221 +2,225 @@
 require 'thread'
 require 'webrick'
 
-class Browser
-  def supported?; true; end
-  def setup ; end
-  def open(url) ; end
-  def teardown ; end
-
-  def host
-    require 'rbconfig'
-    Config::CONFIG['host']
-  end
+class JavaScriptTest
   
-  def macos?
-    host.include?('darwin')
-  end
+  class Browser
+    def supported?; true; end
+    def setup ; end
+    def open(url) ; end
+    def teardown ; end
   
-  def windows?
-    host.include?('mswin')
+    def host
+      require 'rbconfig'
+      Config::CONFIG['host']
+    end
+    
+    def macos?
+      host.include?('darwin')
+    end
+    
+    def windows?
+      host.include?('mswin')
+    end
+    
+    def linux?
+      host.include?('linux')
+    end
+    
+    def applescript(script)
+      raise &quot;Can't run AppleScript on #{host}&quot; unless macos?
+      system &quot;osascript -e '#{script}' 2&gt;&amp;1 &gt;/dev/null&quot;
+    end
   end
   
-  def linux?
-    host.include?('linux')
-  end
+  class FirefoxBrowser &lt; Browser
+    def initialize(path='c:\Program Files\Mozilla Firefox\firefox.exe')
+      @path = path
+    end
   
-  def applescript(script)
-    raise &quot;Can't run AppleScript on #{host}&quot; unless macos?
-    system &quot;osascript -e '#{script}' 2&gt;&amp;1 &gt;/dev/null&quot;
-  end
-end
-
-class FirefoxBrowser &lt; Browser
-  def initialize(path='c:\Program Files\Mozilla Firefox\firefox.exe')
-    @path = path
-  end
-
-  def visit(url)
-    applescript('tell application &quot;Firefox&quot; to Get URL &quot;' + url + '&quot;') if macos? 
-    system(&quot;#{@path} #{url}&quot;) if windows? 
-    system(&quot;firefox #{url}&quot;) if linux?
-  end
-
-  def to_s
-    &quot;Firefox&quot;
-  end
-end
-
-class SafariBrowser &lt; Browser
-  def supported?
-    macos?
-  end
+    def visit(url)
+      applescript('tell application &quot;Firefox&quot; to Get URL &quot;' + url + '&quot;') if macos? 
+      system(&quot;#{@path} #{url}&quot;) if windows? 
+      system(&quot;firefox #{url}&quot;) if linux?
+    end
   
-  def setup
-    applescript('tell application &quot;Safari&quot; to make new document')
+    def to_s
+      &quot;Firefox&quot;
+    end
   end
   
-  def visit(url)
-    applescript('tell application &quot;Safari&quot; to set URL of front document to &quot;' + url + '&quot;')
-  end
-
-  def teardown
-    #applescript('tell application &quot;Safari&quot; to close front document')
-  end
-
-  def to_s
-    &quot;Safari&quot;
-  end
-end
-
-class IEBrowser &lt; Browser
-  def initialize(path='C:\Program Files\Internet Explorer\IEXPLORE.EXE')
-    @path = path
-  end
+  class SafariBrowser &lt; Browser
+    def supported?
+      macos?
+    end
+    
+    def setup
+      applescript('tell application &quot;Safari&quot; to make new document')
+    end
+    
+    def visit(url)
+      applescript('tell application &quot;Safari&quot; to set URL of front document to &quot;' + url + '&quot;')
+    end
   
-  def setup
-    if windows?
-      puts %{
-        MAJOR ANNOYANCE on Windows.
-        You have to shut down the Internet Explorer manually after each test
-        for the script to proceed.
-        Any suggestions on fixing this is GREATLY appreaciated!
-        Thank you for your understanding.
-      }
+    def teardown
+      #applescript('tell application &quot;Safari&quot; to close front document')
     end
-  end
-
-  def supported?
-    windows?
-  end
   
-  def visit(url)
-    system(&quot;#{@path} #{url}&quot;) if windows? 
-  end
-
-  def to_s
-    &quot;Internet Explorer&quot;
-  end
-end
-
-class KonquerorBrowser &lt; Browser
-  def supported?
-    linux?
+    def to_s
+      &quot;Safari&quot;
+    end
   end
   
-  def visit(url)
-    system(&quot;kfmclient openURL #{url}&quot;)
-  end
+  class IEBrowser &lt; Browser
+    def initialize(path='C:\Program Files\Internet Explorer\IEXPLORE.EXE')
+      @path = path
+    end
+    
+    def setup
+      if windows?
+        puts %{
+          MAJOR ANNOYANCE on Windows.
+          You have to shut down the Internet Explorer manually after each test
+          for the script to proceed.
+          Any suggestions on fixing this is GREATLY appreaciated!
+          Thank you for your understanding.
+        }
+      end
+    end
   
-  def to_s
-    &quot;Konqueror&quot;
-  end
-end
-
-# shut up, webrick :-)
-class ::WEBrick::HTTPServer
-  def access_log(config, req, res)
-    # nop
+    def supported?
+      windows?
+    end
+    
+    def visit(url)
+      system(&quot;#{@path} #{url}&quot;) if windows? 
+    end
+  
+    def to_s
+      &quot;Internet Explorer&quot;
+    end
   end
-end
-class ::WEBrick::BasicLog
-  def log(level, data)
-    # nop
+  
+  class KonquerorBrowser &lt; Browser
+    def supported?
+      linux?
+    end
+    
+    def visit(url)
+      system(&quot;kfmclient openURL #{url}&quot;)
+    end
+    
+    def to_s
+      &quot;Konqueror&quot;
+    end
   end
-end
-
-class NonCachingFileHandler &lt; WEBrick::HTTPServlet::FileHandler
-  def do_GET(req, res)
-    super
-    res['etag'] = nil
-    res['last-modified'] = Time.now + 1000
-    res['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0&quot;'
-    res['Pragma'] = 'no-cache'
-    res['Expires'] = Time.now - 1000
+  
+  # shut up, webrick :-)
+  class ::WEBrick::HTTPServer
+    def access_log(config, req, res)
+      # nop
+    end
   end
-end
-
-class JavaScriptTestrunner
-
-  def initialize(name=:test)
-    @name = name
-    @tests = []
-    @browsers = []
-    @result = true
-
-    @queue = Queue.new
-
-    result = []
-
-    @server = WEBrick::HTTPServer.new(:Port =&gt; 4711) # TODO: make port configurable
-    @server.mount_proc(&quot;/results&quot;) do |req, res|
-      @queue.push(req.query['result'])
-      res.body = &quot;OK&quot;
+  class ::WEBrick::BasicLog
+    def log(level, data)
+      # nop
     end
-    yield self if block_given?
-    
-    define
   end
   
-  def successful?
-    @result
+  class NonCachingFileHandler &lt; WEBrick::HTTPServlet::FileHandler
+    def do_GET(req, res)
+      super
+      res['etag'] = nil
+      res['last-modified'] = Time.now + 1000
+      res['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0&quot;'
+      res['Pragma'] = 'no-cache'
+      res['Expires'] = Time.now - 1000
+    end
   end
-
-  def define
-    trap(&quot;INT&quot;) { @server.shutdown }
-    t = Thread.new { @server.start }
+  
+  class Runner
+  
+    def initialize(name=:test)
+      @name = name
+      @tests = []
+      @browsers = []
+      @result = true
+  
+      @queue = Queue.new
+  
+      result = []
+  
+      @server = WEBrick::HTTPServer.new(:Port =&gt; 4711) # TODO: make port configurable
+      @server.mount_proc(&quot;/results&quot;) do |req, res|
+        @queue.push(req.query['result'])
+        res.body = &quot;OK&quot;
+      end
+      yield self if block_given?
+      
+      define
+    end
     
-    # run all combinations of browsers and tests
-    @browsers.each do |browser|
-      if browser.supported?
-        browser.setup
-        @tests.each do |test|
-          browser.visit(&quot;http://localhost:4711#{test}?resultsURL=http://localhost:4711/results&amp;t=&quot; + (&quot;%.6f&quot; % Time.now.to_f))
-          result = @queue.pop
-          puts &quot;#{test} on #{browser}: #{result}&quot;
-          @result = false unless result == 'SUCCESS'
+    def successful?
+      @result
+    end
+  
+    def define
+      trap(&quot;INT&quot;) { @server.shutdown }
+      t = Thread.new { @server.start }
+      
+      # run all combinations of browsers and tests
+      @browsers.each do |browser|
+        if browser.supported?
+          browser.setup
+          @tests.each do |test|
+            browser.visit(&quot;http://localhost:4711#{test}?resultsURL=http://localhost:4711/results&amp;t=&quot; + (&quot;%.6f&quot; % Time.now.to_f))
+            result = @queue.pop
+            puts &quot;#{test} on #{browser}: #{result}&quot;
+            @result = false unless result == 'SUCCESS'
+          end
+          browser.teardown
+        else
+          puts &quot;Skipping #{browser}, not supported on this OS&quot;
         end
         browser.teardown
-      else
-        puts &quot;Skipping #{browser}, not supported on this OS&quot;
       end
-      browser.teardown
+      
+      @server.shutdown
+      t.join
     end
-    
-    @server.shutdown
-    t.join
-  end
-
-  def mount(path, dir=nil)
-    dir ||= (Dir.pwd + path)
-
-    @server.mount(path, NonCachingFileHandler, dir)
-  end
-
-  # test should be specified as a url
-  def run(test)
-    url = &quot;/test/javascript/#{test}_test.html&quot;
-    unless File.exists?(RAILS_ROOT+url)
-      raise &quot;Missing test file #{url} for #{test}&quot;
+  
+    def mount(path, dir=nil)
+      dir ||= (Dir.pwd + path)
+  
+      @server.mount(path, NonCachingFileHandler, dir)
     end
-    @tests &lt;&lt; url
-  end
-
-  def browser(browser)
-    browser =
-      case(browser)
-        when :firefox
-          FirefoxBrowser.new
-        when :safari
-          SafariBrowser.new
-        when :ie
-          IEBrowser.new
-        when :konqueror
-          KonquerorBrowser.new
-        else
-          browser
+  
+    # test should be specified as a url
+    def run(test)
+      url = &quot;/test/javascript/#{test}_test.html&quot;
+      unless File.exists?(RAILS_ROOT+url)
+        raise &quot;Missing test file #{url} for #{test}&quot;
       end
-
-    @browsers&lt;&lt;browser
+      @tests &lt;&lt; url
+    end
+  
+    def browser(browser)
+      browser =
+        case(browser)
+          when :firefox
+            FirefoxBrowser.new
+          when :safari
+            SafariBrowser.new
+          when :ie
+            IEBrowser.new
+          when :konqueror
+            KonquerorBrowser.new
+          else
+            browser
+        end
+  
+      @browsers&lt;&lt;browser
+    end
   end
+
 end
\ No newline at end of file</diff>
      <filename>lib/javascript_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 desc &quot;Run tests for JavaScripts&quot;
 task 'test:javascripts' =&gt; :environment do
-  JavaScriptTestrunner.new do |t| 
+  JavaScriptTest::Runner.new do |t| 
     
     t.mount(&quot;/&quot;, RAILS_ROOT)
     t.mount(&quot;/test&quot;, RAILS_ROOT+'/test')</diff>
      <filename>tasks/javascript_test.rake</filename>
    </modified>
    <modified>
      <diff>@@ -6,8 +6,8 @@ RAILS_ROOT = File.dirname(File.expand_path(__FILE__));
 
 class JavascriptTestTest &lt; Test::Unit::TestCase
   
-  def test_javascript_testrunner
-    runner = JavaScriptTestrunner.new do |t| 
+  def test_javascript_test_runner
+    runner = JavaScriptTest::Runner.new do |t| 
       t.mount(&quot;/test&quot;, RAILS_ROOT+'/test')
       t.mount('/test/javascript/assets', RAILS_ROOT+'/../assets')
       t.run('test')</diff>
      <filename>test/javascript_test_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c6e32d33f9253eb796883dcdeddcad529ee1900a</id>
    </parent>
  </parents>
  <author>
    <name>Thomas Fuchs</name>
    <email>thomas@fesch.at</email>
  </author>
  <url>http://github.com/rails/javascript_test/commit/83ace50b9342e2cb216a3aad5b712850deeef8ca</url>
  <id>83ace50b9342e2cb216a3aad5b712850deeef8ca</id>
  <committed-date>2006-09-18T03:33:32-07:00</committed-date>
  <authored-date>2006-09-18T03:33:32-07:00</authored-date>
  <message>Add JavaScriptTest namespace wrapper</message>
  <tree>cf83bf9389e17f915d7880a6afce134b9039a723</tree>
  <committer>
    <name>Thomas Fuchs</name>
    <email>thomas@fesch.at</email>
  </committer>
</commit>
