Sha256: ede80c365bc15e0d77fe335cd7ba2cdb2c6fcbc023a545e7ea61d8e9225e9fa3

Contents?: true

Size: 889 Bytes

Versions: 15

Compression:

Stored size: 889 Bytes

Contents

# encoding: UTF-8

require 'v8'
require 'spontaneous/rack'

module JavascriptTestBase

  def spontaneous_index
    V8::Context.new
  end

  def page
    config = mock()
    config.stubs(:reload_classes).returns(false)
    Spontaneous.stubs(:config).returns(config)
    page = V8::Context.new
    page.load(File.expand_path('../javascript/env.js', __FILE__))
    page.eval("window.console = {'log': function(){ print.apply(window, arguments)}, 'dir': function() {}};")
    page.eval("Spontaneous = {};")
    %w(JQUERY COMPATIBILITY EDITING_JS).each do |const|
      Spontaneous::Rack::Assets::JavaScript.const_get(const).each do |script|
        page.load(javascript_dir / "#{script}.js") unless ["load", "init"].include?(script)
      end
    end
    page.eval("jQuery.noConflict();")
    page
  end

  def javascript_dir
    File.expand_path("../../application/js", __FILE__)
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta10 test/test_javascript.rb
spontaneous-0.2.0.beta9 test/test_javascript.rb
spontaneous-0.2.0.beta8 test/test_javascript.rb
spontaneous-0.2.0.beta7 test/test_javascript.rb
spontaneous-0.2.0.beta6 test/test_javascript.rb
spontaneous-0.2.0.beta5 test/test_javascript.rb
spontaneous-0.2.0.beta4 test/test_javascript.rb
spontaneous-0.2.0.beta3 test/test_javascript.rb
spontaneous-0.2.0.beta2 test/test_javascript.rb
spontaneous-0.2.0.beta1 test/test_javascript.rb
spontaneous-0.2.0.alpha7 test/test_javascript.rb
spontaneous-0.2.0.alpha6 test/test_javascript.rb
spontaneous-0.2.0.alpha5 test/test_javascript.rb
spontaneous-0.2.0.alpha4 test/test_javascript.rb
spontaneous-0.2.0.alpha3 test/test_javascript.rb