1<!doctype html>
2<html lang="en">
3  <head>
4    <meta charset="utf-8">
5    <title>Backbone Test Suite</title>
6    <link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
7  </head>
8  <body>
9    <script>
10      // Avoid reporting tests to Sauce Labs when script errors occur.
11      if (location.port == '9001') {
12        window.onerror = function(message) {
13          if (window.QUnit) {
14            QUnit.config.done.length = 0;
15          }
16          global_test_results = { 'message': message };
17        };
18      }
19    </script>
20    <script src="../node_modules/qunitjs/qunit/qunit.js"></script>
21    <script src="../node_modules/qunit-extras/qunit-extras.js"></script>
22    <script src="../vendor/json-js/json2.js"></script>
23    <script src="../node_modules/platform/platform.js"></script>
24    <script src="./asset/test-ui.js"></script>
25    <script src="../lodash.js"></script>
26    <script>
27      QUnit.config.asyncRetries = 10;
28      QUnit.config.hidepassed = true;
29
30      var mixinPrereqs = (function() {
31        var aliasToReal = {
32          'indexBy': 'keyBy',
33          'invoke': 'invokeMap'
34        };
35
36        var keyMap = {
37          'rest': 'tail'
38        };
39
40        var lodash = _.noConflict();
41
42        return function(_) {
43          lodash(_)
44            .defaultsDeep({ 'templateSettings': lodash.templateSettings })
45            .mixin(lodash.pick(lodash, lodash.difference([
46              'countBy',
47              'debounce',
48              'difference',
49              'find',
50              'findIndex',
51              'findLastIndex',
52              'groupBy',
53              'includes',
54              'invert',
55              'invokeMap',
56              'keyBy',
57              'omit',
58              'partition',
59              'reduceRight',
60              'reject',
61              'sample',
62              'without'
63            ], lodash.functions(_))))
64            .value();
65
66          lodash.forOwn(keyMap, function(realName, otherName) {
67            _[otherName] = lodash[realName];
68            _.prototype[otherName] = lodash.prototype[realName];
69          });
70          lodash.forOwn(aliasToReal, function(realName, alias) {
71            _[alias] = _[realName];
72            _.prototype[alias] = _.prototype[realName];
73          });
74          return _;
75        };
76      }());
77
78      // Load prerequisite scripts.
79      document.write(ui.urlParams.loader == 'none'
80        ? '<script src="' + ui.buildPath + '"><\/script>'
81        : '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
82      );
83    </script>
84    <script>
85      if (ui.urlParams.loader == 'none') {
86        mixinPrereqs(_);
87        document.write([
88          '<script src="../node_modules/jquery/dist/jquery.js"><\/script>',
89          '<script src="../vendor/backbone/backbone.js"><\/script>',
90          '<script src="../vendor/backbone/test/setup/dom-setup.js"><\/script>',
91          '<script src="../vendor/backbone/test/setup/environment.js"><\/script>',
92          '<script src="../vendor/backbone/test/noconflict.js"><\/script>',
93          '<script src="../vendor/backbone/test/events.js"><\/script>',
94          '<script src="../vendor/backbone/test/model.js"><\/script>',
95          '<script src="../vendor/backbone/test/collection.js"><\/script>',
96          '<script src="../vendor/backbone/test/router.js"><\/script>',
97          '<script src="../vendor/backbone/test/view.js"><\/script>',
98          '<script src="../vendor/backbone/test/sync.js"><\/script>'
99        ].join('\n'));
100      }
101    </script>
102    <script>
103      (function() {
104        if (window.curl) {
105          curl.config({ 'apiName': 'require' });
106        }
107        if (!window.require) {
108          return;
109        }
110        var reBasename = /[\w.-]+$/,
111            basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
112            modulePath = ui.buildPath.replace(/\.js$/, ''),
113            locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
114            moduleMain = modulePath.match(reBasename)[0],
115            uid = +new Date;
116
117        function getConfig() {
118          var result = {
119            'baseUrl': './',
120            'urlArgs': 't=' + uid++,
121            'waitSeconds': 0,
122            'paths': {
123              'backbone': '../vendor/backbone/backbone',
124              'jquery': '../node_modules/jquery/dist/jquery'
125            },
126            'packages': [{
127              'name': 'test',
128              'location': '../vendor/backbone/test',
129              'config': {
130                // Work around no global being exported.
131                'exports': 'QUnit',
132                'loader': 'curl/loader/legacy'
133              }
134            }]
135          };
136
137          if (ui.isModularize) {
138            result.packages.push({
139              'name': 'underscore',
140              'location': locationPath,
141              'main': moduleMain
142            });
143          } else {
144            result.paths.underscore = modulePath;
145          }
146          return result;
147        }
148
149        QUnit.config.autostart = false;
150
151        require(getConfig(), ['underscore'], function(lodash) {
152          _ = mixinPrereqs(lodash);
153          require(getConfig(), ['backbone'], function() {
154            require(getConfig(), [
155              'test/setup/dom-setup',
156              'test/setup/environment',
157              'test/noconflict',
158              'test/events',
159              'test/model',
160              'test/collection',
161              'test/router',
162              'test/view',
163              'test/sync'
164            ], QUnit.start);
165          });
166        });
167      }());
168    </script>
169  </body>
170</html>
171