var requirejs = require('requirejs');
var jsdom = require('jsdom');
var jasmine = require('jasmine-node');

requirejs.config({
  nodeRequire: require,
  baseUrl: __dirname + '/../static/js/',
  
  paths: {
    jquery: 'extern/jquery/jquery',
    jqueryresize: 'extern/jquery/jquery.ba-resize',
    underscore: 'extern/underscore/underscore',
    backbone: 'extern/backbone/backbone',
    bootstrap: 'extern/bootstrap/bootstrap',
    crossfilter: 'extern/d3/d3.v2',
    d3: 'extern/crossfilter/crossfilter',
    dc: 'extern/dc/dc'
  },
  shim: {
      'jquery': {
          exports: '$'
      },
      'jqueryresize': {
          deps: ['jquery']
      },
      'underscore': {
          exports: '_'
      },
      'backbone': {
          deps: ['underscore', 'jquery'],
          exports: 'Backbone'
      },
      'bootstrap': {
        deps: ['jquery']
      },
      'd3': {
        exports: 'd3'
      },
      'crossfilter': {
        exports: 'crossfilter'
      },
      'dc': {
        deps: ['jquery', 'd3', 'crossfilter'],
        exports: 'dc'
      }
  }
});

// hackity hack hack McHackerson
var initialize = function () {
  global.document = jsdom.jsdom("<html><body><div id='test'></div></body></html>", jsdom.level(1, "core"));
  global.window = jsdom.jsdom().createWindow();
};

module.exports = {requirejs: requirejs, initialize: initialize};
@@ -283,24 +283,89 @@
 ba-resize',%0A
+    jquerydebounce: 'extern/jquery/jquery.ba-throttle-debounce',%0A
     undersco
@@ -709,24 +709,86 @@
 '%5D%0A      %7D,%0A
+      'jquerydebounce': %7B%0A          deps: %5B'jquery'%5D%0A      %7D,%0A
       'under
@@ -1481,8 +1481,9 @@
 ialize%7D;
+%0A

add jquerydebounce to test shim