Sha256: ee7efbe787c7db133da97a4fa40d7a3af161a918b9d5d9c88f8338c5d5ecf81c

Contents?: true

Size: 1.18 KB

Versions: 6

Compression:

Stored size: 1.18 KB

Contents

var jsdom = require('jsdom'),
    doc   = jsdom.jsdom('<html><body></body></html>');
    
global.document = doc;
global.window = doc.createWindow();

global.ENV = global.ENV || process.env;
global.ENV['SILENCED'] = '1';

/* TODO remove this when node-canvas supports webgl */
var canvas = document._elementBuilders.canvas;
document._elementBuilders.canvas = function(document, tagName) {
  var element = canvas.call(this, document, tagName);
  var getContext = element.getContext;
  
  element.getContext = function(name) {
    if (name == "webgl" || name == "experimental-webgl") {
      return require("./node/mocks/webgl.js").context();
    } else {
      return getContext.call(this, name);
    }
  };
  
  element.width = element.height = 100;
  
  return element;
};

// mock navigator
global.navigator = {
  userAgent: 'firefox'
};

global.Image = global.Image || function() {
  var src;
  
  this.__defineGetter__("src", function() {
    return src;
  });
  
  this.__defineSetter__("src", function(s) {
    src = s;
    if (this.onload) this.onload();
    return src;
  });
};

global.Jax = require("../../tmp/jax.js").Jax;

require("./helpers/jax_spec_environment_helper.js");
setupJaxSpecContext();

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jax-2.0.5 spec/javascripts/node_helper.js
jax-2.0.4 spec/javascripts/node_helper.js
jax-2.0.3 spec/javascripts/node_helper.js
jax-2.0.2 spec/javascripts/node_helper.js
jax-2.0.1 spec/javascripts/node_helper.js
jax-2.0.0 spec/javascripts/node_helper.js