Sha256: a04c1e0812bff84e4b080c3ae2e9c54e3b7d1c841716a4ea9fac3ec04e9c05ed

Contents?: true

Size: 1.14 KB

Versions: 13

Compression:

Stored size: 1.14 KB

Contents

var jsApiReporter;

function setupJaxTestEnvironment() {
  var jasmineEnv = jasmine.getEnv();

  jsApiReporter = new jasmine.JsApiReporter();
  var trivialReporter = new jasmine.TrivialReporter();

  jasmineEnv.addReporter(jsApiReporter);
  jasmineEnv.addReporter(trivialReporter);

  jasmineEnv.specFilter = function(spec) {
    return trivialReporter.specFilter(spec);
  };

  setupJaxSpecContext();

  jasmineEnv.execute();
}

function setupJaxSpecContext() {
  /*
    Create a canvas element and add it to the document. 
    There's nothing special about this element.
   */
  var canvas = document.createElement("canvas");
  canvas.setAttribute("width", 600);
  canvas.setAttribute("height", 400);
  canvas.setAttribute("id", "spec-canvas");
  if (canvas.style)
    canvas.style.display = "none";
  document.body.appendChild(canvas);
  
  beforeEach(function() {
    Jax.getGlobal().SPEC_CONTEXT = new Jax.Context(canvas);
  });
  
  afterEach(function() {
    Jax.getGlobal().SPEC_CONTEXT.dispose();
  })
}

if (typeof(global) != 'undefined') {
  global.setupJaxTestEnvironment = setupJaxTestEnvironment;
  global.setupJaxSpecContext = setupJaxSpecContext;
}

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
jax-2.0.12 spec/javascripts/helpers/jax_spec_environment_helper.js
jax-2.0.11 spec/javascripts/helpers/jax_spec_environment_helper.js
jax-2.0.10 spec/javascripts/helpers/jax_spec_environment_helper.js
jax-2.0.9 spec/javascripts/helpers/jax_spec_environment_helper.js
jax-2.0.8 spec/javascripts/helpers/jax_spec_environment_helper.js
jax-2.0.7 spec/javascripts/helpers/jax_spec_environment_helper.js
jax-2.0.6 spec/javascripts/helpers/jax_spec_environment_helper.js
jax-2.0.5 spec/javascripts/helpers/jax_spec_environment_helper.js
jax-2.0.4 spec/javascripts/helpers/jax_spec_environment_helper.js
jax-2.0.3 spec/javascripts/helpers/jax_spec_environment_helper.js
jax-2.0.2 spec/javascripts/helpers/jax_spec_environment_helper.js
jax-2.0.1 spec/javascripts/helpers/jax_spec_environment_helper.js
jax-2.0.0 spec/javascripts/helpers/jax_spec_environment_helper.js