deno.land / x / lodash@4.17.19 / test / asset / test-ui.js

نووسراو ببینە
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
;(function(window) { 'use strict';
/** The base path of the lodash builds. */ var basePath = '../';
/** The lodash build to load. */ var build = (build = /build=([^&]+)/.exec(location.search)) && decodeURIComponent(build[1]);
/** The module loader to use. */ var loader = (loader = /loader=([^&]+)/.exec(location.search)) && decodeURIComponent(loader[1]);
/** The `ui` object. */ var ui = {};
/*--------------------------------------------------------------------------*/
// Initialize controls. addEventListener('load', function() { function eventHandler(event) { var buildIndex = buildList.selectedIndex, loaderIndex = loaderList.selectedIndex, search = location.search.replace(/^\?|&?(?:build|loader)=[^&]*&?/g, '');
if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; } location.href = location.href.split('?')[0] + '?' + (search ? search + '&' : '') + 'build=' + (buildIndex < 0 ? build : buildList[buildIndex].value) + '&' + 'loader=' + (loaderIndex < 0 ? loader : loaderList[loaderIndex].value); }
function init() { var toolbar = document.getElementById('qunit-testrunner-toolbar'); if (!toolbar) { setTimeout(init, 15); return; } toolbar.insertBefore(span2, toolbar.lastChild); toolbar.insertBefore(span1, span2);
buildList.selectedIndex = (function() { switch (build) { case 'lodash': return 1; case 'lodash-core-dev': return 2; case 'lodash-core': return 3; case 'lodash-dev': case null: return 0; } return -1; }());
loaderList.selectedIndex = (function() { switch (loader) { case 'curl': return 1; case 'dojo': return 2; case 'requirejs': return 3; case 'none': case null: return 0; } return -1; }());
buildList.addEventListener('change', eventHandler); loaderList.addEventListener('change', eventHandler); }
var span1 = document.createElement('span'); span1.innerHTML = '<label for="qunit-build">Build: </label>' + '<select id="qunit-build">' + '<option value="lodash-dev">lodash (development)</option>' + '<option value="lodash">lodash (production)</option>' + '<option value="lodash-core-dev">lodash-core (development)</option>' + '<option value="lodash-core">lodash-core (production)</option>' + '</select>';
var span2 = document.createElement('span'); span2.innerHTML = '<label for="qunit-loader">Loader: </label>' + '<select id="qunit-loader">' + '<option value="none">None</option>' + '<option value="curl">Curl</option>' + '<option value="dojo">Dojo</option>' + '<option value="requirejs">RequireJS</option>' + '</select>';
span1.style.cssText = span2.style.cssText = 'display:inline-block;float:right;line-height:2.1em;margin-left:1em;margin-top:0;';
span1.firstChild.style.cssText = span2.firstChild.style.cssText = 'display:inline-block;margin-right:.5em;';
var buildList = span1.lastChild, loaderList = span2.lastChild;
setTimeout(function() { ui.timing.loadEventEnd = +new Date; }, 1);
init(); });
// The lodash build file path. ui.buildPath = (function() { var result; switch (build) { case 'lodash': result = 'dist/lodash.min.js'; break; case 'lodash-core-dev': result = 'dist/lodash.core.js'; break; case 'lodash-core': result = 'dist/lodash.core.min.js'; break; case null: build = 'lodash-dev'; case 'lodash-dev': result = 'lodash.js'; break; default: return build; } return basePath + result; }());
// The module loader file path. ui.loaderPath = (function() { var result; switch (loader) { case 'curl': result = 'node_modules/curl-amd/dist/curl-kitchen-sink/curl.js'; break; case 'dojo': result = 'node_modules/dojo/dojo.js'; break; case 'requirejs': result = 'node_modules/requirejs/require.js'; break; case null: loader = 'none'; return ''; default: return loader; } return basePath + result; }());
// Used to indicate testing a core build. ui.isCore = /\bcore(\.min)?\.js\b/.test(ui.buildPath);
// Used to indicate testing a foreign file. ui.isForeign = RegExp('^(\\w+:)?//').test(build);
// Used to indicate testing a modularized build. ui.isModularize = /\b(?:amd|commonjs|es|node|npm|(index|main)\.js)\b/.test([location.pathname, location.search]);
// Used to indicate testing in Sauce Labs' automated test cloud. ui.isSauceLabs = location.port == '9001';
// Used to indicate that lodash is in strict mode. ui.isStrict = /\bes\b/.test([location.pathname, location.search]);
ui.urlParams = { 'build': build, 'loader': loader }; ui.timing = { 'loadEventEnd': 0 };
window.ui = ui;
}(this));
lodash

Version Info

Tagged at
3 years ago

External Dependencies

No external dependencies 🎉