summaryrefslogtreecommitdiff
path: root/web-ui/test/test-main.js
blob: fc82e49fdc1fd53e57db996a22ade51b3a896990 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
'use strict';

var tests = Object.keys(window.__karma__.files).filter(function (file) {
  return (/\.spec\.js$/.test(file));
});

requirejs.config({

  baseUrl: '/base',

  paths: {
    'page': 'app/js/page',
    'js': 'app/js',
    'lib': 'app/js/lib',
    'hbs': 'app/js/generated/hbs',
    'flight': 'app/bower_components/flight',
    'views': 'app/js/views',
    'helpers': 'app/js/helpers',
    'tags': 'app/js/tags',
    'mail_list': 'app/js/mail_list',
    'mail_list_actions': 'app/js/mail_list_actions',
    'user_alerts': 'app/js/user_alerts',
    'mail_view': 'app/js/mail_view',
    'dispatchers': 'app/js/dispatchers',
    'mixins': 'app/js/mixins',
    'services': 'app/js/services',
    'search': 'app/js/search',
    'monkey_patching': 'app/js/monkey_patching',
    'i18next': 'app/bower_components/i18next/i18next.amd',
    'quoted-printable': 'app/bower_components/quoted-printable',
    'test': 'test',
    'features': 'test/features'
  },


  deps: tests,

  callback: function () {
    require(['page/events','test/test_data', 'views/i18n', 'monkey_patching/array', 'views/recipientListFormatter'], function (events, testData, i18n, mp, recipientListFormatter) {
      window['Pixelated'] = window['Pixelated'] || {};
      window['Pixelated'].events = events;
      window['Pixelated'].testData = testData;
      window['Pixelated'].mockBloodhound = function() {
        window.Bloodhound = function() {};
        window.Bloodhound.prototype.initialize = function() {};
        window.Bloodhound.prototype.ttAdapter = function() {};
        window.Bloodhound.prototype.clear = function() {};
        window.Bloodhound.prototype.clearPrefetchCache = function() {};
        window.Bloodhound.prototype.clearRemoteCache = function() {};
        $.fn.typeahead = function() {};
      };

      i18n.init('/base/app/');
      // start test run, once Require.js is done
      window.__karma__.start();
    });
  }
});