Built motion from commit fd239ea.|0.0.31
[motion.git] / public / bower_components / lodash / test / index.html
1 <!doctype html>
2 <html lang="en">
3   <head>
4     <meta charset="utf-8">
5     <title>lodash Test Suite</title>
6     <link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
7     <style>
8       #exports, #module {
9         display: none;
10       }
11     </style>
12   </head>
13   <body>
14     <script>
15       // Avoid reporting tests to Sauce Labs when script errors occur.
16       if (location.port == '9001') {
17         window.onerror = function(message) {
18           if (window.QUnit) {
19             QUnit.config.done.length = 0;
20           }
21           global_test_results = { 'message': message };
22         };
23       }
24     </script>
25     <script src="../node_modules/lodash/index.js"></script>
26     <script>var lodashStable = _.noConflict();</script>
27     <script src="../node_modules/qunitjs/qunit/qunit.js"></script>
28     <script src="../node_modules/qunit-extras/qunit-extras.js"></script>
29     <script src="../node_modules/platform/platform.js"></script>
30     <script src="./asset/test-ui.js"></script>
31     <div id="qunit"></div>
32     <div id="exports"></div>
33     <div id="module"></div>
34     <script>
35       function setProperty(object, key, value) {
36         try {
37           Object.defineProperty(object, key, {
38             'configurable': true,
39             'enumerable': false,
40             'writable': true,
41             'value': value
42           });
43         } catch (e) {
44           object[key] = value;
45         }
46         return object;
47       }
48
49       function addBizarroMethods() {
50         var funcProto = Function.prototype,
51             objectProto = Object.prototype;
52
53         var hasOwnProperty = objectProto.hasOwnProperty,
54             fnToString = funcProto.toString,
55             nativeString = fnToString.call(objectProto.toString),
56             noop = function() {},
57             propertyIsEnumerable = objectProto.propertyIsEnumerable,
58             reToString = /toString/g;
59
60         function constant(value) {
61           return function() {
62             return value;
63           };
64         }
65
66         function createToString(funcName) {
67           return constant(nativeString.replace(reToString, funcName));
68         }
69
70         // Allow bypassing native checks.
71         setProperty(funcProto, 'toString', (function() {
72           function wrapper() {
73             setProperty(funcProto, 'toString', fnToString);
74             var result = hasOwnProperty.call(this, 'toString') ? this.toString() : fnToString.call(this);
75             setProperty(funcProto, 'toString', wrapper);
76             return result;
77           }
78           return wrapper;
79         }()));
80
81         // Add prototype extensions.
82         funcProto._method = noop;
83
84         // Set bad shims.
85         setProperty(objectProto, '_propertyIsEnumerable', propertyIsEnumerable);
86         setProperty(objectProto, 'propertyIsEnumerable', function(key) {
87           return !(key == 'valueOf' && this && this.valueOf === 1) && _propertyIsEnumerable.call(this, key);
88         });
89
90         setProperty(window, '_Map', window.Map);
91         if (_Map) {
92           setProperty(window, 'Map', (function(Map) {
93             var count = 0;
94             return function() {
95               if (count++) {
96                 return new Map;
97               }
98               var result = {};
99               setProperty(window, 'Map', Map);
100               return result;
101             };
102           }(_Map)));
103
104           setProperty(Map, 'toString', createToString('Map'));
105         }
106         setProperty(Object, '_create', Object.create);
107         setProperty(Object, 'create', noop);
108
109         setProperty(Object, '_getOwnPropertySymbols', Object.getOwnPropertySymbols);
110         setProperty(Object, 'getOwnPropertySymbols', undefined);
111
112         setProperty(window, '_Set', window.Set);
113         setProperty(window, 'Set', noop);
114
115         setProperty(window, '_Symbol', window.Symbol);
116         setProperty(window, 'Symbol', undefined);
117
118         setProperty(window, '_WeakMap', window.WeakMap);
119         setProperty(window, 'WeakMap', noop);
120
121         // Fake `WinRTError`.
122         setProperty(window, 'WinRTError', Error);
123
124         // Fake free variable `global`.
125         setProperty(window, 'exports', window);
126         setProperty(window, 'global', window);
127         setProperty(window, 'module', {});
128       }
129
130       function removeBizarroMethods() {
131         var funcProto = Function.prototype,
132             objectProto = Object.prototype;
133
134         if (Object._create) {
135           Object.create = Object._create;
136         } else {
137           delete Object.create;
138         }
139         if (Object._getOwnPropertySymbols) {
140           Object.getOwnPropertySymbols = Object._getOwnPropertySymbols;
141         } else {
142           delete Object.getOwnPropertySymbols;
143         }
144         if (_Map) {
145           Map = _Map;
146         } else {
147           setProperty(window, 'Map', undefined);
148         }
149         if (_Set) {
150           Set = _Set;
151         } else {
152           setProperty(window, 'Set', undefined);
153         }
154         if (_Symbol) {
155           Symbol = _Symbol;
156         }
157         if (_WeakMap) {
158           WeakMap = _WeakMap;
159         } else {
160           setProperty(window, 'WeakMap', undefined);
161         }
162         setProperty(objectProto, 'propertyIsEnumerable', objectProto._propertyIsEnumerable);
163
164         setProperty(window, '_Map', undefined);
165         setProperty(window, '_Set', undefined);
166         setProperty(window, '_Symbol', undefined);
167         setProperty(window, '_WeakMap', undefined);
168
169         setProperty(window, 'WinRTError', undefined);
170
171         setProperty(window, 'exports', document.getElementById('exports'));
172         setProperty(window, 'global', undefined);
173         setProperty(window, 'module', document.getElementById('module'));
174
175         delete funcProto._method;
176         delete objectProto._propertyIsEnumerable;
177         delete Object._create;
178         delete Object._getOwnPropertySymbols;
179       }
180
181       // Load lodash to expose it to the bad extensions/shims.
182       if (!ui.isModularize) {
183         addBizarroMethods();
184         document.write('<script src="' + ui.buildPath + '"><\/script>');
185       }
186     </script>
187     <script>
188       // Store lodash to test for bad extensions/shims.
189       if (!ui.isModularize) {
190         var lodashBizarro = window._;
191         window._ = undefined;
192         removeBizarroMethods();
193       }
194       // Load test scripts.
195       document.write((ui.isForeign || ui.urlParams.loader == 'none')
196         ? '<script src="' + ui.buildPath + '"><\/script><script src="test.js"><\/script>'
197         : '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
198       );
199     </script>
200     <script>
201       var lodashModule,
202           shimmedModule,
203           underscoreModule;
204
205       (function() {
206         if (window.curl) {
207           curl.config({ 'apiName': 'require' });
208         }
209         if (ui.isForeign || !window.require) {
210           return;
211         }
212         var reBasename = /[\w.-]+$/,
213             basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
214             modulePath = ui.buildPath.replace(/\.js$/, ''),
215             moduleMain = modulePath.match(reBasename)[0],
216             locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
217             shimmedLocationPath = './abc/../' + locationPath,
218             underscoreLocationPath = './xyz/../' + locationPath,
219             uid = +new Date;
220
221         function getConfig() {
222           var result = {
223             'baseUrl': './',
224             'urlArgs': 't=' + uid++,
225             'waitSeconds': 0,
226             'paths': {},
227             'packages': [{
228               'name': 'test',
229               'location': basePath + 'test',
230               'main': 'test',
231               'config': {
232                 // Work around no global being exported.
233                 'exports': 'QUnit',
234                 'loader': 'curl/loader/legacy'
235               }
236             }],
237             'shim': {
238               'shimmed': {
239                 'exports': '_'
240               }
241             }
242           };
243
244           if (ui.isModularize) {
245             result.packages.push({
246               'name': 'lodash',
247               'location': locationPath,
248               'main': moduleMain
249             }, {
250               'name': 'shimmed',
251               'location': shimmedLocationPath,
252               'main': moduleMain
253             }, {
254               'name': 'underscore',
255               'location': underscoreLocationPath,
256               'main': moduleMain
257             });
258           } else {
259             result.paths.lodash = modulePath;
260             result.paths.shimmed = shimmedLocationPath + '/' + moduleMain;
261             result.paths.underscore = underscoreLocationPath + '/' + moduleMain;
262           }
263           return result;
264         }
265
266         function loadTests() {
267           require(getConfig(), ['test'], function() {
268             QUnit.start();
269           });
270         }
271
272         function loadModulesAndTests() {
273           require(getConfig(), ['lodash', 'shimmed', 'underscore'], function(lodash, shimmed, underscore) {
274             lodashModule = lodash;
275             lodashModule.moduleName = 'lodash';
276
277             if (shimmed) {
278               shimmedModule = shimmed.result(shimmed, 'noConflict') || shimmed;
279               shimmedModule.moduleName = 'shimmed';
280             }
281             if (underscore) {
282               underscoreModule = underscore.result(underscore, 'noConflict') || underscore;
283               underscoreModule.moduleName = 'underscore';
284             }
285             if (ui.isModularize) {
286               window._ = lodash;
287             }
288             if (ui.isModularize) {
289               require(getConfig(), [
290                 'lodash/internal/baseEach',
291                 'lodash/internal/isIndex',
292                 'lodash/internal/isIterateeCall'
293               ], function(baseEach, isIndex, isIterateeCall) {
294                 lodash._baseEach = baseEach;
295                 lodash._isIndex = isIndex;
296                 lodash._isIterateeCall = isIterateeCall;
297                 loadTests();
298               });
299             } else {
300               loadTests();
301             }
302           });
303         }
304
305         QUnit.config.autostart = false;
306
307         if (window.requirejs) {
308           addBizarroMethods();
309           require(getConfig(), ['lodash'], function(lodash) {
310             lodashBizarro = lodash.result(lodash, 'noConflict') || lodash;
311             delete requirejs.s.contexts._;
312
313             removeBizarroMethods();
314             loadModulesAndTests();
315           });
316         } else {
317           loadModulesAndTests();
318         }
319       }());
320
321       // Set a more readable browser name.
322       window.onload = function() {
323         var timeoutId = setInterval(function() {
324           var ua = document.getElementById('qunit-userAgent');
325           if (ua) {
326             ua.innerHTML = platform;
327             clearInterval(timeoutId);
328           }
329         }, 16);
330       };
331     </script>
332   </body>
333 </html>