blob: dd3df9fe05e53a2ac4ea0a5e1637153c5331aed0 [file] [log] [blame]
Matteo Scandolo280dcd32016-05-16 09:59:38 -07001<!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.defaultsDeep(_, { 'templateSettings': lodash.templateSettings });
44 lodash.mixin(_, lodash.pick(lodash, lodash.difference([
45 'countBy',
46 'debounce',
47 'difference',
48 'find',
49 'findIndex',
50 'findLastIndex',
51 'groupBy',
52 'includes',
53 'invert',
54 'invokeMap',
55 'keyBy',
56 'omit',
57 'partition',
58 'reduceRight',
59 'reject',
60 'sample',
61 'without'
62 ], lodash.functions(_))));
63
64 lodash.forOwn(keyMap, function(realName, otherName) {
65 _[otherName] = lodash[realName];
66 _.prototype[otherName] = lodash.prototype[realName];
67 });
68
69 lodash.forOwn(aliasToReal, function(realName, alias) {
70 _[alias] = _[realName];
71 _.prototype[alias] = _.prototype[realName];
72 });
73 };
74 }());
75
76 // Load prerequisite scripts.
77 document.write(ui.urlParams.loader == 'none'
78 ? '<script src="' + ui.buildPath + '"><\/script>'
79 : '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
80 );
81 </script>
82 <script>
83 if (ui.urlParams.loader == 'none') {
84 mixinPrereqs(_);
85 document.write([
86 '<script src="../node_modules/jquery/dist/jquery.js"><\/script>',
87 '<script src="../vendor/backbone/backbone.js"><\/script>',
88 '<script src="../vendor/backbone/test/setup/dom-setup.js"><\/script>',
89 '<script src="../vendor/backbone/test/setup/environment.js"><\/script>',
90 '<script src="../vendor/backbone/test/noconflict.js"><\/script>',
91 '<script src="../vendor/backbone/test/events.js"><\/script>',
92 '<script src="../vendor/backbone/test/model.js"><\/script>',
93 '<script src="../vendor/backbone/test/collection.js"><\/script>',
94 '<script src="../vendor/backbone/test/router.js"><\/script>',
95 '<script src="../vendor/backbone/test/view.js"><\/script>',
96 '<script src="../vendor/backbone/test/sync.js"><\/script>'
97 ].join('\n'));
98 }
99 </script>
100 <script>
101 (function() {
102 if (window.curl) {
103 curl.config({ 'apiName': 'require' });
104 }
105 if (!window.require) {
106 return;
107 }
108 var reBasename = /[\w.-]+$/,
109 basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
110 modulePath = ui.buildPath.replace(/\.js$/, ''),
111 locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
112 moduleMain = modulePath.match(reBasename)[0],
113 uid = +new Date;
114
115 function getConfig() {
116 var result = {
117 'baseUrl': './',
118 'urlArgs': 't=' + uid++,
119 'waitSeconds': 0,
120 'paths': {
121 'backbone': '../vendor/backbone/backbone',
122 'jquery': '../node_modules/jquery/dist/jquery'
123 },
124 'packages': [{
125 'name': 'test',
126 'location': '../vendor/backbone/test',
127 'config': {
128 // Work around no global being exported.
129 'exports': 'QUnit',
130 'loader': 'curl/loader/legacy'
131 }
132 }]
133 };
134
135 if (ui.isModularize) {
136 result.packages.push({
137 'name': 'underscore',
138 'location': locationPath,
139 'main': moduleMain
140 });
141 } else {
142 result.paths.underscore = modulePath;
143 }
144 return result;
145 }
146
147 QUnit.config.autostart = false;
148
149 require(getConfig(), ['underscore'], function(lodash) {
150 mixinPrereqs(lodash);
151 require(getConfig(), ['backbone'], function() {
152 require(getConfig(), [
153 'test/setup/dom-setup',
154 'test/setup/environment',
155 'test/noconflict',
156 'test/events',
157 'test/model',
158 'test/collection',
159 'test/router',
160 'test/view',
161 'test/sync'
162 ], function() {
163 QUnit.start();
164 });
165 });
166 });
167 }());
168 </script>
169 </body>
170</html>