ember-source 1.11.1 → 1.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/dist/ember-runtime.js +3638 -5353
- data/dist/ember-template-compiler.js +8861 -217
- data/dist/ember-testing.js +241 -408
- data/dist/ember-tests.js +23240 -27049
- data/dist/ember-tests.prod.js +23852 -35867
- data/dist/ember.debug.cjs.js +8193 -9923
- data/dist/ember.debug.js +8193 -9924
- data/dist/ember.js +8193 -9924
- data/dist/ember.min.js +14 -15
- data/dist/ember.prod.js +7774 -9179
- metadata +5 -6
data/dist/ember-testing.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
|
|
6
6
|
* @license Licensed under MIT license
|
|
7
7
|
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
|
|
8
|
-
* @version 1.11.
|
|
8
|
+
* @version 1.11.3
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
(function() {
|
|
@@ -109,12 +109,20 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
|
|
|
109
109
|
|
|
110
110
|
exports._warnIfUsingStrippedFeatureFlags = _warnIfUsingStrippedFeatureFlags;
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
/**
|
|
113
|
+
Will call `Ember.warn()` if ENABLE_ALL_FEATURES, ENABLE_OPTIONAL_FEATURES, or
|
|
114
|
+
any specific FEATURES flag is truthy.
|
|
113
115
|
|
|
114
|
-
|
|
116
|
+
This method is called automatically in debug canary builds.
|
|
117
|
+
|
|
118
|
+
@private
|
|
119
|
+
@method _warnIfUsingStrippedFeatureFlags
|
|
120
|
+
@return {void}
|
|
121
|
+
*/
|
|
122
|
+
Ember['default'].assert = function (desc, test) {
|
|
115
123
|
var throwAssertion;
|
|
116
124
|
|
|
117
|
-
if (Ember['default'].typeOf(test) ===
|
|
125
|
+
if (Ember['default'].typeOf(test) === "function") {
|
|
118
126
|
throwAssertion = !test();
|
|
119
127
|
} else {
|
|
120
128
|
throwAssertion = !test;
|
|
@@ -125,7 +133,6 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
|
|
|
125
133
|
}
|
|
126
134
|
};
|
|
127
135
|
|
|
128
|
-
|
|
129
136
|
/**
|
|
130
137
|
Display a warning with the provided message. Ember build tools will
|
|
131
138
|
remove any calls to `Ember.warn()` when doing a production build.
|
|
@@ -135,10 +142,10 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
|
|
|
135
142
|
@param {Boolean} test An optional boolean. If falsy, the warning
|
|
136
143
|
will be displayed.
|
|
137
144
|
*/
|
|
138
|
-
Ember['default'].warn = function(message, test) {
|
|
145
|
+
Ember['default'].warn = function (message, test) {
|
|
139
146
|
if (!test) {
|
|
140
|
-
Logger['default'].warn("WARNING: "+message);
|
|
141
|
-
if (
|
|
147
|
+
Logger['default'].warn("WARNING: " + message);
|
|
148
|
+
if ("trace" in Logger['default']) {
|
|
142
149
|
Logger['default'].trace();
|
|
143
150
|
}
|
|
144
151
|
}
|
|
@@ -155,8 +162,8 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
|
|
|
155
162
|
@method debug
|
|
156
163
|
@param {String} message A debug message to display.
|
|
157
164
|
*/
|
|
158
|
-
Ember['default'].debug = function(message) {
|
|
159
|
-
Logger['default'].debug("DEBUG: "+message);
|
|
165
|
+
Ember['default'].debug = function (message) {
|
|
166
|
+
Logger['default'].debug("DEBUG: " + message);
|
|
160
167
|
};
|
|
161
168
|
|
|
162
169
|
/**
|
|
@@ -171,56 +178,59 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
|
|
|
171
178
|
@param {Object} options An optional object that can be used to pass
|
|
172
179
|
in a `url` to the transition guide on the emberjs.com website.
|
|
173
180
|
*/
|
|
174
|
-
Ember['default'].deprecate = function(message, test, options) {
|
|
181
|
+
Ember['default'].deprecate = function (message, test, options) {
|
|
175
182
|
var noDeprecation;
|
|
176
183
|
|
|
177
|
-
if (typeof test ===
|
|
184
|
+
if (typeof test === "function") {
|
|
178
185
|
noDeprecation = test();
|
|
179
186
|
} else {
|
|
180
187
|
noDeprecation = test;
|
|
181
188
|
}
|
|
182
189
|
|
|
183
|
-
if (noDeprecation) {
|
|
190
|
+
if (noDeprecation) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
184
193
|
|
|
185
|
-
if (Ember['default'].ENV.RAISE_ON_DEPRECATION) {
|
|
194
|
+
if (Ember['default'].ENV.RAISE_ON_DEPRECATION) {
|
|
195
|
+
throw new EmberError['default'](message);
|
|
196
|
+
}
|
|
186
197
|
|
|
187
198
|
var error;
|
|
188
199
|
|
|
189
200
|
// When using new Error, we can't do the arguments check for Chrome. Alternatives are welcome
|
|
190
|
-
try {
|
|
201
|
+
try {
|
|
202
|
+
__fail__.fail();
|
|
203
|
+
} catch (e) {
|
|
204
|
+
error = e;
|
|
205
|
+
}
|
|
191
206
|
|
|
192
207
|
if (arguments.length === 3) {
|
|
193
|
-
Ember['default'].assert(
|
|
208
|
+
Ember['default'].assert("options argument to Ember.deprecate should be an object", options && typeof options === "object");
|
|
194
209
|
if (options.url) {
|
|
195
|
-
message +=
|
|
210
|
+
message += " See " + options.url + " for more details.";
|
|
196
211
|
}
|
|
197
212
|
}
|
|
198
213
|
|
|
199
214
|
if (Ember['default'].LOG_STACKTRACE_ON_DEPRECATION && error.stack) {
|
|
200
215
|
var stack;
|
|
201
|
-
var stackStr =
|
|
216
|
+
var stackStr = "";
|
|
202
217
|
|
|
203
|
-
if (error[
|
|
218
|
+
if (error["arguments"]) {
|
|
204
219
|
// Chrome
|
|
205
|
-
stack = error.stack.replace(/^\s+at\s+/gm,
|
|
206
|
-
replace(/^([^\(]+?)([\n$])/gm, '{anonymous}($1)$2').
|
|
207
|
-
replace(/^Object.<anonymous>\s*\(([^\)]+)\)/gm, '{anonymous}($1)').split('\n');
|
|
220
|
+
stack = error.stack.replace(/^\s+at\s+/gm, "").replace(/^([^\(]+?)([\n$])/gm, "{anonymous}($1)$2").replace(/^Object.<anonymous>\s*\(([^\)]+)\)/gm, "{anonymous}($1)").split("\n");
|
|
208
221
|
stack.shift();
|
|
209
222
|
} else {
|
|
210
223
|
// Firefox
|
|
211
|
-
stack = error.stack.replace(/(?:\n@:0)?\s+$/m,
|
|
212
|
-
replace(/^\(/gm, '{anonymous}(').split('\n');
|
|
224
|
+
stack = error.stack.replace(/(?:\n@:0)?\s+$/m, "").replace(/^\(/gm, "{anonymous}(").split("\n");
|
|
213
225
|
}
|
|
214
226
|
|
|
215
227
|
stackStr = "\n " + stack.slice(2).join("\n ");
|
|
216
228
|
message = message + stackStr;
|
|
217
229
|
}
|
|
218
230
|
|
|
219
|
-
Logger['default'].warn("DEPRECATION: "+message);
|
|
231
|
+
Logger['default'].warn("DEPRECATION: " + message);
|
|
220
232
|
};
|
|
221
233
|
|
|
222
|
-
|
|
223
|
-
|
|
224
234
|
/**
|
|
225
235
|
Alias an old, deprecated method with its new counterpart.
|
|
226
236
|
|
|
@@ -239,14 +249,13 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
|
|
|
239
249
|
@param {Function} func The new function called to replace its deprecated counterpart.
|
|
240
250
|
@return {Function} a new function that wrapped the original function with a deprecation warning
|
|
241
251
|
*/
|
|
242
|
-
Ember['default'].deprecateFunc = function(message, func) {
|
|
243
|
-
return function() {
|
|
252
|
+
Ember['default'].deprecateFunc = function (message, func) {
|
|
253
|
+
return function () {
|
|
244
254
|
Ember['default'].deprecate(message);
|
|
245
255
|
return func.apply(this, arguments);
|
|
246
256
|
};
|
|
247
257
|
};
|
|
248
258
|
|
|
249
|
-
|
|
250
259
|
/**
|
|
251
260
|
Run a function meant for debugging. Ember build tools will remove any calls to
|
|
252
261
|
`Ember.runInDebug()` when doing a production build.
|
|
@@ -265,28 +274,17 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
|
|
|
265
274
|
@param {Function} func The function to be executed.
|
|
266
275
|
@since 1.5.0
|
|
267
276
|
*/
|
|
268
|
-
Ember['default'].runInDebug = function(func) {
|
|
277
|
+
Ember['default'].runInDebug = function (func) {
|
|
269
278
|
func();
|
|
270
279
|
};
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
Will call `Ember.warn()` if ENABLE_ALL_FEATURES, ENABLE_OPTIONAL_FEATURES, or
|
|
274
|
-
any specific FEATURES flag is truthy.
|
|
275
|
-
|
|
276
|
-
This method is called automatically in debug canary builds.
|
|
277
|
-
|
|
278
|
-
@private
|
|
279
|
-
@method _warnIfUsingStrippedFeatureFlags
|
|
280
|
-
@return {void}
|
|
281
|
-
*/
|
|
282
280
|
function _warnIfUsingStrippedFeatureFlags(FEATURES, featuresWereStripped) {
|
|
283
281
|
if (featuresWereStripped) {
|
|
284
|
-
Ember['default'].warn(
|
|
285
|
-
Ember['default'].warn(
|
|
282
|
+
Ember['default'].warn("Ember.ENV.ENABLE_ALL_FEATURES is only available in canary builds.", !Ember['default'].ENV.ENABLE_ALL_FEATURES);
|
|
283
|
+
Ember['default'].warn("Ember.ENV.ENABLE_OPTIONAL_FEATURES is only available in canary builds.", !Ember['default'].ENV.ENABLE_OPTIONAL_FEATURES);
|
|
286
284
|
|
|
287
285
|
for (var key in FEATURES) {
|
|
288
|
-
if (FEATURES.hasOwnProperty(key) && key !==
|
|
289
|
-
Ember['default'].warn(
|
|
286
|
+
if (FEATURES.hasOwnProperty(key) && key !== "isEnabled") {
|
|
287
|
+
Ember['default'].warn("FEATURE[\"" + key + "\"] is set as enabled, but FEATURE flags are only available in canary builds.", !FEATURES[key]);
|
|
290
288
|
}
|
|
291
289
|
}
|
|
292
290
|
}
|
|
@@ -294,29 +292,29 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
|
|
|
294
292
|
|
|
295
293
|
if (!Ember['default'].testing) {
|
|
296
294
|
// Complain if they're using FEATURE flags in builds other than canary
|
|
297
|
-
Ember['default'].FEATURES[
|
|
295
|
+
Ember['default'].FEATURES["features-stripped-test"] = true;
|
|
298
296
|
var featuresWereStripped = true;
|
|
299
297
|
|
|
300
298
|
|
|
301
|
-
delete Ember['default'].FEATURES[
|
|
299
|
+
delete Ember['default'].FEATURES["features-stripped-test"];
|
|
302
300
|
_warnIfUsingStrippedFeatureFlags(Ember['default'].ENV.FEATURES, featuresWereStripped);
|
|
303
301
|
|
|
304
302
|
// Inform the developer about the Ember Inspector if not installed.
|
|
305
|
-
var isFirefox = typeof InstallTrigger !==
|
|
303
|
+
var isFirefox = typeof InstallTrigger !== "undefined";
|
|
306
304
|
var isChrome = environment['default'].isChrome;
|
|
307
305
|
|
|
308
|
-
if (typeof window !==
|
|
309
|
-
window.addEventListener("load", function() {
|
|
306
|
+
if (typeof window !== "undefined" && (isFirefox || isChrome) && window.addEventListener) {
|
|
307
|
+
window.addEventListener("load", function () {
|
|
310
308
|
if (document.documentElement && document.documentElement.dataset && !document.documentElement.dataset.emberExtension) {
|
|
311
309
|
var downloadURL;
|
|
312
310
|
|
|
313
311
|
if (isChrome) {
|
|
314
|
-
downloadURL =
|
|
312
|
+
downloadURL = "https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi";
|
|
315
313
|
} else if (isFirefox) {
|
|
316
|
-
downloadURL =
|
|
314
|
+
downloadURL = "https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/";
|
|
317
315
|
}
|
|
318
316
|
|
|
319
|
-
Ember['default'].debug(
|
|
317
|
+
Ember['default'].debug("For more advanced debugging, install the Ember Inspector from " + downloadURL);
|
|
320
318
|
}
|
|
321
319
|
}, false);
|
|
322
320
|
}
|
|
@@ -332,7 +330,7 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/error', 'embe
|
|
|
332
330
|
*/
|
|
333
331
|
var runningNonEmberDebugJS = false;
|
|
334
332
|
if (runningNonEmberDebugJS) {
|
|
335
|
-
Ember['default'].warn(
|
|
333
|
+
Ember['default'].warn("Please use `ember.debug.js` instead of `ember.js` for development and debugging.");
|
|
336
334
|
}
|
|
337
335
|
|
|
338
336
|
exports.runningNonEmberDebugJS = runningNonEmberDebugJS;
|
|
@@ -352,7 +350,9 @@ enifed('ember-testing/adapters/adapter', ['exports', 'ember-runtime/system/objec
|
|
|
352
350
|
|
|
353
351
|
'use strict';
|
|
354
352
|
|
|
355
|
-
function K() {
|
|
353
|
+
function K() {
|
|
354
|
+
return this;
|
|
355
|
+
}
|
|
356
356
|
|
|
357
357
|
/**
|
|
358
358
|
@module ember
|
|
@@ -369,19 +369,16 @@ enifed('ember-testing/adapters/adapter', ['exports', 'ember-runtime/system/objec
|
|
|
369
369
|
var Adapter = EmberObject['default'].extend({
|
|
370
370
|
/**
|
|
371
371
|
This callback will be called whenever an async operation is about to start.
|
|
372
|
-
|
|
373
|
-
Override this to call your framework's methods that handle async
|
|
372
|
+
Override this to call your framework's methods that handle async
|
|
374
373
|
operations.
|
|
375
|
-
|
|
376
|
-
@public
|
|
374
|
+
@public
|
|
377
375
|
@method asyncStart
|
|
378
376
|
*/
|
|
379
377
|
asyncStart: K,
|
|
380
378
|
|
|
381
379
|
/**
|
|
382
380
|
This callback will be called whenever an async operation has completed.
|
|
383
|
-
|
|
384
|
-
@public
|
|
381
|
+
@public
|
|
385
382
|
@method asyncEnd
|
|
386
383
|
*/
|
|
387
384
|
asyncEnd: K,
|
|
@@ -390,20 +387,17 @@ enifed('ember-testing/adapters/adapter', ['exports', 'ember-runtime/system/objec
|
|
|
390
387
|
Override this method with your testing framework's false assertion.
|
|
391
388
|
This function is called whenever an exception occurs causing the testing
|
|
392
389
|
promise to fail.
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
```javascript
|
|
390
|
+
QUnit example:
|
|
391
|
+
```javascript
|
|
397
392
|
exception: function(error) {
|
|
398
393
|
ok(false, error);
|
|
399
394
|
};
|
|
400
395
|
```
|
|
401
|
-
|
|
402
|
-
@public
|
|
396
|
+
@public
|
|
403
397
|
@method exception
|
|
404
398
|
@param {String} error The exception to be raised.
|
|
405
399
|
*/
|
|
406
|
-
exception: function(error) {
|
|
400
|
+
exception: function (error) {
|
|
407
401
|
throw error;
|
|
408
402
|
}
|
|
409
403
|
});
|
|
@@ -416,13 +410,13 @@ enifed('ember-testing/adapters/qunit', ['exports', 'ember-testing/adapters/adapt
|
|
|
416
410
|
'use strict';
|
|
417
411
|
|
|
418
412
|
exports['default'] = Adapter['default'].extend({
|
|
419
|
-
asyncStart: function() {
|
|
413
|
+
asyncStart: function () {
|
|
420
414
|
QUnit.stop();
|
|
421
415
|
},
|
|
422
|
-
asyncEnd: function() {
|
|
416
|
+
asyncEnd: function () {
|
|
423
417
|
QUnit.start();
|
|
424
418
|
},
|
|
425
|
-
exception: function(error) {
|
|
419
|
+
exception: function (error) {
|
|
426
420
|
ok(false, utils.inspect(error));
|
|
427
421
|
}
|
|
428
422
|
});
|
|
@@ -436,40 +430,40 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
436
430
|
var asyncHelper = Test['default'].registerAsyncHelper;
|
|
437
431
|
|
|
438
432
|
function currentRouteName(app) {
|
|
439
|
-
var appController = app.__container__.lookup(
|
|
433
|
+
var appController = app.__container__.lookup("controller:application");
|
|
440
434
|
|
|
441
|
-
return property_get.get(appController,
|
|
435
|
+
return property_get.get(appController, "currentRouteName");
|
|
442
436
|
}
|
|
443
437
|
|
|
444
438
|
function currentPath(app) {
|
|
445
|
-
var appController = app.__container__.lookup(
|
|
439
|
+
var appController = app.__container__.lookup("controller:application");
|
|
446
440
|
|
|
447
|
-
return property_get.get(appController,
|
|
441
|
+
return property_get.get(appController, "currentPath");
|
|
448
442
|
}
|
|
449
443
|
|
|
450
444
|
function currentURL(app) {
|
|
451
|
-
var router = app.__container__.lookup(
|
|
445
|
+
var router = app.__container__.lookup("router:main");
|
|
452
446
|
|
|
453
|
-
return property_get.get(router,
|
|
447
|
+
return property_get.get(router, "location").getURL();
|
|
454
448
|
}
|
|
455
449
|
|
|
456
450
|
function pauseTest() {
|
|
457
451
|
Test['default'].adapter.asyncStart();
|
|
458
|
-
return new Ember['default'].RSVP.Promise(function() {
|
|
452
|
+
return new Ember['default'].RSVP.Promise(function () {}, "TestAdapter paused promise");
|
|
459
453
|
}
|
|
460
454
|
|
|
461
455
|
function focus(el) {
|
|
462
|
-
if (el && el.is(
|
|
463
|
-
var type = el.prop(
|
|
464
|
-
if (type !==
|
|
465
|
-
run['default'](el, function() {
|
|
456
|
+
if (el && el.is(":input, [contenteditable=true]")) {
|
|
457
|
+
var type = el.prop("type");
|
|
458
|
+
if (type !== "checkbox" && type !== "radio" && type !== "hidden") {
|
|
459
|
+
run['default'](el, function () {
|
|
466
460
|
// Firefox does not trigger the `focusin` event if the window
|
|
467
461
|
// does not have focus. If the document doesn't have focus just
|
|
468
462
|
// use trigger('focusin') instead.
|
|
469
463
|
if (!document.hasFocus || document.hasFocus()) {
|
|
470
464
|
this.focus();
|
|
471
465
|
} else {
|
|
472
|
-
this.trigger(
|
|
466
|
+
this.trigger("focusin");
|
|
473
467
|
}
|
|
474
468
|
});
|
|
475
469
|
}
|
|
@@ -477,15 +471,15 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
477
471
|
}
|
|
478
472
|
|
|
479
473
|
function visit(app, url) {
|
|
480
|
-
var router = app.__container__.lookup(
|
|
474
|
+
var router = app.__container__.lookup("router:main");
|
|
481
475
|
router.location.setURL(url);
|
|
482
476
|
|
|
483
477
|
if (app._readinessDeferrals > 0) {
|
|
484
|
-
router[
|
|
485
|
-
run['default'](app,
|
|
486
|
-
delete router[
|
|
478
|
+
router["initialURL"] = url;
|
|
479
|
+
run['default'](app, "advanceReadiness");
|
|
480
|
+
delete router["initialURL"];
|
|
487
481
|
} else {
|
|
488
|
-
run['default'](app.__deprecatedInstance__,
|
|
482
|
+
run['default'](app.__deprecatedInstance__, "handleURL", url);
|
|
489
483
|
}
|
|
490
484
|
|
|
491
485
|
return app.testHelpers.wait();
|
|
@@ -493,24 +487,23 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
493
487
|
|
|
494
488
|
function click(app, selector, context) {
|
|
495
489
|
var $el = app.testHelpers.findWithAssert(selector, context);
|
|
496
|
-
run['default']($el,
|
|
490
|
+
run['default']($el, "mousedown");
|
|
497
491
|
|
|
498
492
|
focus($el);
|
|
499
493
|
|
|
500
|
-
run['default']($el,
|
|
501
|
-
run['default']($el,
|
|
494
|
+
run['default']($el, "mouseup");
|
|
495
|
+
run['default']($el, "click");
|
|
502
496
|
|
|
503
497
|
return app.testHelpers.wait();
|
|
504
498
|
}
|
|
505
499
|
|
|
506
500
|
function check(app, selector, context) {
|
|
507
501
|
var $el = app.testHelpers.findWithAssert(selector, context);
|
|
508
|
-
var type = $el.prop(
|
|
502
|
+
var type = $el.prop("type");
|
|
509
503
|
|
|
510
|
-
Ember['default'].assert(
|
|
511
|
-
'\', the input must be a checkbox', type === 'checkbox');
|
|
504
|
+
Ember['default'].assert("To check '" + selector + "', the input must be a checkbox", type === "checkbox");
|
|
512
505
|
|
|
513
|
-
if (!$el.prop(
|
|
506
|
+
if (!$el.prop("checked")) {
|
|
514
507
|
app.testHelpers.click(selector, context);
|
|
515
508
|
}
|
|
516
509
|
|
|
@@ -519,12 +512,11 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
519
512
|
|
|
520
513
|
function uncheck(app, selector, context) {
|
|
521
514
|
var $el = app.testHelpers.findWithAssert(selector, context);
|
|
522
|
-
var type = $el.prop(
|
|
515
|
+
var type = $el.prop("type");
|
|
523
516
|
|
|
524
|
-
Ember['default'].assert(
|
|
525
|
-
'\', the input must be a checkbox', type === 'checkbox');
|
|
517
|
+
Ember['default'].assert("To uncheck '" + selector + "', the input must be a checkbox", type === "checkbox");
|
|
526
518
|
|
|
527
|
-
if ($el.prop(
|
|
519
|
+
if ($el.prop("checked")) {
|
|
528
520
|
app.testHelpers.click(selector, context);
|
|
529
521
|
}
|
|
530
522
|
|
|
@@ -543,12 +535,14 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
543
535
|
options = {};
|
|
544
536
|
} else if (arity === 4) {
|
|
545
537
|
// context and options are optional, so this is
|
|
546
|
-
if (typeof typeOrOptions === "object") {
|
|
538
|
+
if (typeof typeOrOptions === "object") {
|
|
539
|
+
// either
|
|
547
540
|
// app, selector, type, options
|
|
548
541
|
context = null;
|
|
549
542
|
type = contextOrType;
|
|
550
543
|
options = typeOrOptions;
|
|
551
|
-
} else {
|
|
544
|
+
} else {
|
|
545
|
+
// or
|
|
552
546
|
// app, selector, context, type
|
|
553
547
|
context = contextOrType;
|
|
554
548
|
type = typeOrOptions;
|
|
@@ -564,7 +558,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
564
558
|
|
|
565
559
|
var event = jQuery['default'].Event(type, options);
|
|
566
560
|
|
|
567
|
-
run['default']($el,
|
|
561
|
+
run['default']($el, "trigger", event);
|
|
568
562
|
|
|
569
563
|
return app.testHelpers.wait();
|
|
570
564
|
}
|
|
@@ -572,7 +566,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
572
566
|
function keyEvent(app, selector, contextOrType, typeOrKeyCode, keyCode) {
|
|
573
567
|
var context, type;
|
|
574
568
|
|
|
575
|
-
if (typeof keyCode ===
|
|
569
|
+
if (typeof keyCode === "undefined") {
|
|
576
570
|
context = null;
|
|
577
571
|
keyCode = typeOrKeyCode;
|
|
578
572
|
type = contextOrType;
|
|
@@ -586,14 +580,14 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
586
580
|
|
|
587
581
|
function fillIn(app, selector, contextOrText, text) {
|
|
588
582
|
var $el, context;
|
|
589
|
-
if (typeof text ===
|
|
583
|
+
if (typeof text === "undefined") {
|
|
590
584
|
text = contextOrText;
|
|
591
585
|
} else {
|
|
592
586
|
context = contextOrText;
|
|
593
587
|
}
|
|
594
588
|
$el = app.testHelpers.findWithAssert(selector, context);
|
|
595
589
|
focus($el);
|
|
596
|
-
run['default'](function() {
|
|
590
|
+
run['default'](function () {
|
|
597
591
|
$el.val(text).change();
|
|
598
592
|
});
|
|
599
593
|
return app.testHelpers.wait();
|
|
@@ -609,7 +603,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
609
603
|
|
|
610
604
|
function find(app, selector, context) {
|
|
611
605
|
var $el;
|
|
612
|
-
context = context || property_get.get(app,
|
|
606
|
+
context = context || property_get.get(app, "rootElement");
|
|
613
607
|
$el = app.$(selector, context);
|
|
614
608
|
|
|
615
609
|
return $el;
|
|
@@ -620,21 +614,27 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
620
614
|
}
|
|
621
615
|
|
|
622
616
|
function wait(app, value) {
|
|
623
|
-
return new RSVP['default'].Promise(function(resolve) {
|
|
617
|
+
return new RSVP['default'].Promise(function (resolve) {
|
|
624
618
|
// Every 10ms, poll for the async thing to have finished
|
|
625
|
-
var watcher = setInterval(function() {
|
|
626
|
-
var router = app.__container__.lookup(
|
|
619
|
+
var watcher = setInterval(function () {
|
|
620
|
+
var router = app.__container__.lookup("router:main");
|
|
627
621
|
|
|
628
622
|
// 1. If the router is loading, keep polling
|
|
629
623
|
var routerIsLoading = router.router && !!router.router.activeTransition;
|
|
630
|
-
if (routerIsLoading) {
|
|
624
|
+
if (routerIsLoading) {
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
631
627
|
|
|
632
628
|
// 2. If there are pending Ajax requests, keep polling
|
|
633
|
-
if (Test['default'].pendingAjaxRequests) {
|
|
629
|
+
if (Test['default'].pendingAjaxRequests) {
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
634
632
|
|
|
635
633
|
// 3. If there are scheduled timers or we are inside of a run loop, keep polling
|
|
636
|
-
if (run['default'].hasScheduledTimers() || run['default'].currentRunLoop) {
|
|
637
|
-
|
|
634
|
+
if (run['default'].hasScheduledTimers() || run['default'].currentRunLoop) {
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
if (Test['default'].waiters && Test['default'].waiters.any(function (waiter) {
|
|
638
638
|
var context = waiter[0];
|
|
639
639
|
var callback = waiter[1];
|
|
640
640
|
return !callback.call(context);
|
|
@@ -648,10 +648,8 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
648
648
|
run['default'](null, resolve, value);
|
|
649
649
|
}, 10);
|
|
650
650
|
});
|
|
651
|
-
|
|
652
651
|
}
|
|
653
652
|
|
|
654
|
-
|
|
655
653
|
/**
|
|
656
654
|
* Loads a route, sets up any controllers, and renders any templates associated
|
|
657
655
|
* with the route as though a real user had triggered the route change while
|
|
@@ -669,7 +667,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
669
667
|
* @param {String} url the name of the route
|
|
670
668
|
* @return {RSVP.Promise}
|
|
671
669
|
*/
|
|
672
|
-
asyncHelper(
|
|
670
|
+
asyncHelper("visit", visit);
|
|
673
671
|
|
|
674
672
|
/**
|
|
675
673
|
* Clicks an element and triggers any actions triggered by the element's `click`
|
|
@@ -687,7 +685,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
687
685
|
* @param {String} selector jQuery selector for finding element on the DOM
|
|
688
686
|
* @return {RSVP.Promise}
|
|
689
687
|
*/
|
|
690
|
-
asyncHelper(
|
|
688
|
+
asyncHelper("click", click);
|
|
691
689
|
|
|
692
690
|
/**
|
|
693
691
|
* Simulates a key event, e.g. `keypress`, `keydown`, `keyup` with the desired keyCode
|
|
@@ -707,7 +705,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
707
705
|
* @return {RSVP.Promise}
|
|
708
706
|
* @since 1.5.0
|
|
709
707
|
*/
|
|
710
|
-
asyncHelper(
|
|
708
|
+
asyncHelper("keyEvent", keyEvent);
|
|
711
709
|
|
|
712
710
|
/**
|
|
713
711
|
* Fills in an input element with some text.
|
|
@@ -726,7 +724,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
726
724
|
* @param {String} text text to place inside the input element
|
|
727
725
|
* @return {RSVP.Promise}
|
|
728
726
|
*/
|
|
729
|
-
asyncHelper(
|
|
727
|
+
asyncHelper("fillIn", fillIn);
|
|
730
728
|
|
|
731
729
|
/**
|
|
732
730
|
* Finds an element in the context of the app's container element. A simple alias
|
|
@@ -742,7 +740,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
742
740
|
* @param {String} selector jQuery string selector for element lookup
|
|
743
741
|
* @return {Object} jQuery object representing the results of the query
|
|
744
742
|
*/
|
|
745
|
-
helper(
|
|
743
|
+
helper("find", find);
|
|
746
744
|
|
|
747
745
|
/**
|
|
748
746
|
* Like `find`, but throws an error if the element selector returns no results.
|
|
@@ -759,7 +757,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
759
757
|
* @return {Object} jQuery object representing the results of the query
|
|
760
758
|
* @throws {Error} throws error if jQuery object returned has a length of 0
|
|
761
759
|
*/
|
|
762
|
-
helper(
|
|
760
|
+
helper("findWithAssert", findWithAssert);
|
|
763
761
|
|
|
764
762
|
/**
|
|
765
763
|
Causes the run loop to process any pending events. This is used to ensure that
|
|
@@ -784,9 +782,8 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
784
782
|
@param {Object} value The value to be returned.
|
|
785
783
|
@return {RSVP.Promise}
|
|
786
784
|
*/
|
|
787
|
-
asyncHelper(
|
|
788
|
-
asyncHelper(
|
|
789
|
-
|
|
785
|
+
asyncHelper("wait", wait);
|
|
786
|
+
asyncHelper("andThen", andThen);
|
|
790
787
|
|
|
791
788
|
/**
|
|
792
789
|
Returns the currently active route name.
|
|
@@ -805,7 +802,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
805
802
|
@return {Object} The name of the currently active route.
|
|
806
803
|
@since 1.5.0
|
|
807
804
|
*/
|
|
808
|
-
helper(
|
|
805
|
+
helper("currentRouteName", currentRouteName);
|
|
809
806
|
|
|
810
807
|
/**
|
|
811
808
|
Returns the current path.
|
|
@@ -824,7 +821,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
824
821
|
@return {Object} The currently active path.
|
|
825
822
|
@since 1.5.0
|
|
826
823
|
*/
|
|
827
|
-
helper(
|
|
824
|
+
helper("currentPath", currentPath);
|
|
828
825
|
|
|
829
826
|
/**
|
|
830
827
|
Returns the current URL.
|
|
@@ -843,7 +840,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
843
840
|
@return {Object} The currently active URL.
|
|
844
841
|
@since 1.5.0
|
|
845
842
|
*/
|
|
846
|
-
helper(
|
|
843
|
+
helper("currentURL", currentURL);
|
|
847
844
|
|
|
848
845
|
/**
|
|
849
846
|
Pauses the current test - this is useful for debugging while testing or for test-driving.
|
|
@@ -862,7 +859,7 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
862
859
|
@method pauseTest
|
|
863
860
|
@return {Object} A promise that will never resolve
|
|
864
861
|
*/
|
|
865
|
-
helper(
|
|
862
|
+
helper("pauseTest", pauseTest);
|
|
866
863
|
|
|
867
864
|
/**
|
|
868
865
|
Triggers the given DOM event on the element identified by the provided selector.
|
|
@@ -888,21 +885,21 @@ enifed('ember-testing/helpers', ['ember-metal/core', 'ember-metal/property_get',
|
|
|
888
885
|
@return {RSVP.Promise}
|
|
889
886
|
@since 1.5.0
|
|
890
887
|
*/
|
|
891
|
-
asyncHelper(
|
|
888
|
+
asyncHelper("triggerEvent", triggerEvent);
|
|
892
889
|
|
|
893
890
|
});
|
|
894
891
|
enifed('ember-testing/initializers', ['ember-runtime/system/lazy_load'], function (lazy_load) {
|
|
895
892
|
|
|
896
893
|
'use strict';
|
|
897
894
|
|
|
898
|
-
var name =
|
|
895
|
+
var name = "deferReadiness in `testing` mode";
|
|
899
896
|
|
|
900
|
-
lazy_load.onLoad(
|
|
897
|
+
lazy_load.onLoad("Ember.Application", function (Application) {
|
|
901
898
|
if (!Application.initializers[name]) {
|
|
902
899
|
Application.initializer({
|
|
903
900
|
name: name,
|
|
904
901
|
|
|
905
|
-
initialize: function(registry, application) {
|
|
902
|
+
initialize: function (registry, application) {
|
|
906
903
|
if (application.testing) {
|
|
907
904
|
application.deferReadiness();
|
|
908
905
|
}
|
|
@@ -916,6 +913,20 @@ enifed('ember-testing/setup_for_testing', ['exports', 'ember-metal/core', 'ember
|
|
|
916
913
|
|
|
917
914
|
'use strict';
|
|
918
915
|
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
Sets Ember up for testing. This is useful to perform
|
|
920
|
+
basic setup steps in order to unit test.
|
|
921
|
+
|
|
922
|
+
Use `App.setupForTesting` to perform integration tests (full
|
|
923
|
+
application testing).
|
|
924
|
+
|
|
925
|
+
@method setupForTesting
|
|
926
|
+
@namespace Ember
|
|
927
|
+
@since 1.5.0
|
|
928
|
+
*/
|
|
929
|
+
exports['default'] = setupForTesting;
|
|
919
930
|
var Test, requests;
|
|
920
931
|
|
|
921
932
|
function incrementAjaxPendingRequests(_, xhr) {
|
|
@@ -924,27 +935,17 @@ enifed('ember-testing/setup_for_testing', ['exports', 'ember-metal/core', 'ember
|
|
|
924
935
|
}
|
|
925
936
|
|
|
926
937
|
function decrementAjaxPendingRequests(_, xhr) {
|
|
927
|
-
for (var i=0;i<requests.length;i++) {
|
|
938
|
+
for (var i = 0; i < requests.length; i++) {
|
|
928
939
|
if (xhr === requests[i]) {
|
|
929
940
|
requests.splice(i, 1);
|
|
930
941
|
}
|
|
931
942
|
}
|
|
932
943
|
Test.pendingAjaxRequests = requests.length;
|
|
933
944
|
}
|
|
934
|
-
|
|
935
|
-
/**
|
|
936
|
-
Sets Ember up for testing. This is useful to perform
|
|
937
|
-
basic setup steps in order to unit test.
|
|
938
|
-
|
|
939
|
-
Use `App.setupForTesting` to perform integration tests (full
|
|
940
|
-
application testing).
|
|
941
|
-
|
|
942
|
-
@method setupForTesting
|
|
943
|
-
@namespace Ember
|
|
944
|
-
@since 1.5.0
|
|
945
|
-
*/
|
|
946
945
|
function setupForTesting() {
|
|
947
|
-
if (!Test) {
|
|
946
|
+
if (!Test) {
|
|
947
|
+
Test = requireModule("ember-testing/test")["default"];
|
|
948
|
+
}
|
|
948
949
|
|
|
949
950
|
Ember['default'].testing = true;
|
|
950
951
|
|
|
@@ -956,12 +957,11 @@ enifed('ember-testing/setup_for_testing', ['exports', 'ember-metal/core', 'ember
|
|
|
956
957
|
requests = [];
|
|
957
958
|
Test.pendingAjaxRequests = requests.length;
|
|
958
959
|
|
|
959
|
-
jQuery['default'](document).off(
|
|
960
|
-
jQuery['default'](document).off(
|
|
961
|
-
jQuery['default'](document).on(
|
|
962
|
-
jQuery['default'](document).on(
|
|
960
|
+
jQuery['default'](document).off("ajaxSend", incrementAjaxPendingRequests);
|
|
961
|
+
jQuery['default'](document).off("ajaxComplete", decrementAjaxPendingRequests);
|
|
962
|
+
jQuery['default'](document).on("ajaxSend", incrementAjaxPendingRequests);
|
|
963
|
+
jQuery['default'](document).on("ajaxComplete", decrementAjaxPendingRequests);
|
|
963
964
|
}
|
|
964
|
-
exports['default'] = setupForTesting;
|
|
965
965
|
|
|
966
966
|
});
|
|
967
967
|
enifed('ember-testing/support', ['ember-metal/core', 'ember-views/system/jquery', 'ember-metal/environment'], function (Ember, jQuery, environment) {
|
|
@@ -979,29 +979,23 @@ enifed('ember-testing/support', ['ember-metal/core', 'ember-views/system/jquery'
|
|
|
979
979
|
@method testCheckboxClick
|
|
980
980
|
*/
|
|
981
981
|
function testCheckboxClick(handler) {
|
|
982
|
-
$(
|
|
983
|
-
.css({ position: 'absolute', left: '-1000px', top: '-1000px' })
|
|
984
|
-
.appendTo('body')
|
|
985
|
-
.on('click', handler)
|
|
986
|
-
.trigger('click')
|
|
987
|
-
.remove();
|
|
982
|
+
$("<input type=\"checkbox\">").css({ position: "absolute", left: "-1000px", top: "-1000px" }).appendTo("body").on("click", handler).trigger("click").remove();
|
|
988
983
|
}
|
|
989
984
|
|
|
990
985
|
if (environment['default'].hasDOM) {
|
|
991
|
-
$(function() {
|
|
986
|
+
$(function () {
|
|
992
987
|
/*
|
|
993
988
|
Determine whether a checkbox checked using jQuery's "click" method will have
|
|
994
989
|
the correct value for its checked property.
|
|
995
|
-
|
|
996
|
-
If we determine that the current jQuery version exhibits this behavior,
|
|
990
|
+
If we determine that the current jQuery version exhibits this behavior,
|
|
997
991
|
patch it to work correctly as in the commit for the actual fix:
|
|
998
992
|
https://github.com/jquery/jquery/commit/1fb2f92.
|
|
999
993
|
*/
|
|
1000
|
-
testCheckboxClick(function() {
|
|
994
|
+
testCheckboxClick(function () {
|
|
1001
995
|
if (!this.checked && !$.event.special.click) {
|
|
1002
996
|
$.event.special.click = {
|
|
1003
997
|
// For checkbox, fire native event so checked state will be right
|
|
1004
|
-
trigger: function() {
|
|
998
|
+
trigger: function () {
|
|
1005
999
|
if ($.nodeName(this, "input") && this.type === "checkbox" && this.click) {
|
|
1006
1000
|
this.click();
|
|
1007
1001
|
return false;
|
|
@@ -1012,7 +1006,7 @@ enifed('ember-testing/support', ['ember-metal/core', 'ember-views/system/jquery'
|
|
|
1012
1006
|
});
|
|
1013
1007
|
|
|
1014
1008
|
// Try again to verify that the patch took effect or blow up.
|
|
1015
|
-
testCheckboxClick(function() {
|
|
1009
|
+
testCheckboxClick(function () {
|
|
1016
1010
|
Ember['default'].warn("clicked checkboxes should be checked! the jQuery patch didn't work", this.checked);
|
|
1017
1011
|
});
|
|
1018
1012
|
});
|
|
@@ -1041,8 +1035,7 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1041
1035
|
var Test = {
|
|
1042
1036
|
/**
|
|
1043
1037
|
Hash containing all known test helpers.
|
|
1044
|
-
|
|
1045
|
-
@property _helpers
|
|
1038
|
+
@property _helpers
|
|
1046
1039
|
@private
|
|
1047
1040
|
@since 1.7.0
|
|
1048
1041
|
*/
|
|
@@ -1051,34 +1044,28 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1051
1044
|
/**
|
|
1052
1045
|
`registerHelper` is used to register a test helper that will be injected
|
|
1053
1046
|
when `App.injectTestHelpers` is called.
|
|
1054
|
-
|
|
1055
|
-
The helper method will always be called with the current Application as
|
|
1047
|
+
The helper method will always be called with the current Application as
|
|
1056
1048
|
the first parameter.
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
```javascript
|
|
1049
|
+
For example:
|
|
1050
|
+
```javascript
|
|
1061
1051
|
Ember.Test.registerHelper('boot', function(app) {
|
|
1062
1052
|
Ember.run(app, app.advanceReadiness);
|
|
1063
1053
|
});
|
|
1064
1054
|
```
|
|
1065
|
-
|
|
1066
|
-
This helper can later be called without arguments because it will be
|
|
1055
|
+
This helper can later be called without arguments because it will be
|
|
1067
1056
|
called with `app` as the first parameter.
|
|
1068
|
-
|
|
1069
|
-
```javascript
|
|
1057
|
+
```javascript
|
|
1070
1058
|
App = Ember.Application.create();
|
|
1071
1059
|
App.injectTestHelpers();
|
|
1072
1060
|
boot();
|
|
1073
1061
|
```
|
|
1074
|
-
|
|
1075
|
-
@public
|
|
1062
|
+
@public
|
|
1076
1063
|
@method registerHelper
|
|
1077
1064
|
@param {String} name The name of the helper method to add.
|
|
1078
1065
|
@param {Function} helperMethod
|
|
1079
1066
|
@param options {Object}
|
|
1080
1067
|
*/
|
|
1081
|
-
registerHelper: function(name, helperMethod) {
|
|
1068
|
+
registerHelper: function (name, helperMethod) {
|
|
1082
1069
|
helpers[name] = {
|
|
1083
1070
|
method: helperMethod,
|
|
1084
1071
|
meta: { wait: false }
|
|
@@ -1088,44 +1075,35 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1088
1075
|
/**
|
|
1089
1076
|
`registerAsyncHelper` is used to register an async test helper that will be injected
|
|
1090
1077
|
when `App.injectTestHelpers` is called.
|
|
1091
|
-
|
|
1092
|
-
The helper method will always be called with the current Application as
|
|
1078
|
+
The helper method will always be called with the current Application as
|
|
1093
1079
|
the first parameter.
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
```javascript
|
|
1080
|
+
For example:
|
|
1081
|
+
```javascript
|
|
1098
1082
|
Ember.Test.registerAsyncHelper('boot', function(app) {
|
|
1099
1083
|
Ember.run(app, app.advanceReadiness);
|
|
1100
1084
|
});
|
|
1101
1085
|
```
|
|
1102
|
-
|
|
1103
|
-
The advantage of an async helper is that it will not run
|
|
1086
|
+
The advantage of an async helper is that it will not run
|
|
1104
1087
|
until the last async helper has completed. All async helpers
|
|
1105
1088
|
after it will wait for it complete before running.
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
For example:
|
|
1109
|
-
|
|
1110
|
-
```javascript
|
|
1089
|
+
For example:
|
|
1090
|
+
```javascript
|
|
1111
1091
|
Ember.Test.registerAsyncHelper('deletePost', function(app, postId) {
|
|
1112
1092
|
click('.delete-' + postId);
|
|
1113
1093
|
});
|
|
1114
|
-
|
|
1115
|
-
// ... in your test
|
|
1094
|
+
// ... in your test
|
|
1116
1095
|
visit('/post/2');
|
|
1117
1096
|
deletePost(2);
|
|
1118
1097
|
visit('/post/3');
|
|
1119
1098
|
deletePost(3);
|
|
1120
1099
|
```
|
|
1121
|
-
|
|
1122
|
-
@public
|
|
1100
|
+
@public
|
|
1123
1101
|
@method registerAsyncHelper
|
|
1124
1102
|
@param {String} name The name of the helper method to add.
|
|
1125
1103
|
@param {Function} helperMethod
|
|
1126
1104
|
@since 1.2.0
|
|
1127
1105
|
*/
|
|
1128
|
-
registerAsyncHelper: function(name, helperMethod) {
|
|
1106
|
+
registerAsyncHelper: function (name, helperMethod) {
|
|
1129
1107
|
helpers[name] = {
|
|
1130
1108
|
method: helperMethod,
|
|
1131
1109
|
meta: { wait: true }
|
|
@@ -1134,18 +1112,15 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1134
1112
|
|
|
1135
1113
|
/**
|
|
1136
1114
|
Remove a previously added helper method.
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
```javascript
|
|
1115
|
+
Example:
|
|
1116
|
+
```javascript
|
|
1141
1117
|
Ember.Test.unregisterHelper('wait');
|
|
1142
1118
|
```
|
|
1143
|
-
|
|
1144
|
-
@public
|
|
1119
|
+
@public
|
|
1145
1120
|
@method unregisterHelper
|
|
1146
1121
|
@param {String} name The helper to remove.
|
|
1147
1122
|
*/
|
|
1148
|
-
unregisterHelper: function(name) {
|
|
1123
|
+
unregisterHelper: function (name) {
|
|
1149
1124
|
delete helpers[name];
|
|
1150
1125
|
delete Test.Promise.prototype[name];
|
|
1151
1126
|
},
|
|
@@ -1153,28 +1128,23 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1153
1128
|
/**
|
|
1154
1129
|
Used to register callbacks to be fired whenever `App.injectTestHelpers`
|
|
1155
1130
|
is called.
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
Example:
|
|
1160
|
-
|
|
1161
|
-
```javascript
|
|
1131
|
+
The callback will receive the current application as an argument.
|
|
1132
|
+
Example:
|
|
1133
|
+
```javascript
|
|
1162
1134
|
Ember.Test.onInjectHelpers(function() {
|
|
1163
1135
|
Ember.$(document).ajaxSend(function() {
|
|
1164
1136
|
Test.pendingAjaxRequests++;
|
|
1165
1137
|
});
|
|
1166
|
-
|
|
1167
|
-
Ember.$(document).ajaxComplete(function() {
|
|
1138
|
+
Ember.$(document).ajaxComplete(function() {
|
|
1168
1139
|
Test.pendingAjaxRequests--;
|
|
1169
1140
|
});
|
|
1170
1141
|
});
|
|
1171
1142
|
```
|
|
1172
|
-
|
|
1173
|
-
@public
|
|
1143
|
+
@public
|
|
1174
1144
|
@method onInjectHelpers
|
|
1175
1145
|
@param {Function} callback The function to be called.
|
|
1176
1146
|
*/
|
|
1177
|
-
onInjectHelpers: function(callback) {
|
|
1147
|
+
onInjectHelpers: function (callback) {
|
|
1178
1148
|
injectHelpersCallbacks.push(callback);
|
|
1179
1149
|
},
|
|
1180
1150
|
|
|
@@ -1182,32 +1152,25 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1182
1152
|
This returns a thenable tailored for testing. It catches failed
|
|
1183
1153
|
`onSuccess` callbacks and invokes the `Ember.Test.adapter.exception`
|
|
1184
1154
|
callback in the last chained then.
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
@public
|
|
1155
|
+
This method should be returned by async helpers such as `wait`.
|
|
1156
|
+
@public
|
|
1189
1157
|
@method promise
|
|
1190
1158
|
@param {Function} resolver The function used to resolve the promise.
|
|
1191
1159
|
*/
|
|
1192
|
-
promise: function(resolver) {
|
|
1160
|
+
promise: function (resolver) {
|
|
1193
1161
|
return new Test.Promise(resolver);
|
|
1194
1162
|
},
|
|
1195
1163
|
|
|
1196
1164
|
/**
|
|
1197
1165
|
Used to allow ember-testing to communicate with a specific testing
|
|
1198
1166
|
framework.
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
Example:
|
|
1203
|
-
|
|
1204
|
-
```javascript
|
|
1167
|
+
You can manually set it before calling `App.setupForTesting()`.
|
|
1168
|
+
Example:
|
|
1169
|
+
```javascript
|
|
1205
1170
|
Ember.Test.adapter = MyCustomAdapter.create()
|
|
1206
1171
|
```
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
@public
|
|
1172
|
+
If you do not set it, ember-testing will default to `Ember.Test.QUnitAdapter`.
|
|
1173
|
+
@public
|
|
1211
1174
|
@property adapter
|
|
1212
1175
|
@type {Class} The adapter to be used.
|
|
1213
1176
|
@default Ember.Test.QUnitAdapter
|
|
@@ -1218,14 +1181,13 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1218
1181
|
Replacement for `Ember.RSVP.resolve`
|
|
1219
1182
|
The only difference is this uses
|
|
1220
1183
|
an instance of `Ember.Test.Promise`
|
|
1221
|
-
|
|
1222
|
-
@public
|
|
1184
|
+
@public
|
|
1223
1185
|
@method resolve
|
|
1224
1186
|
@param {Mixed} The value to resolve
|
|
1225
1187
|
@since 1.2.0
|
|
1226
1188
|
*/
|
|
1227
|
-
resolve: function(val) {
|
|
1228
|
-
return Test.promise(function(resolve) {
|
|
1189
|
+
resolve: function (val) {
|
|
1190
|
+
return Test.promise(function (resolve) {
|
|
1229
1191
|
return resolve(val);
|
|
1230
1192
|
});
|
|
1231
1193
|
},
|
|
@@ -1234,30 +1196,25 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1234
1196
|
This allows ember-testing to play nicely with other asynchronous
|
|
1235
1197
|
events, such as an application that is waiting for a CSS3
|
|
1236
1198
|
transition or an IndexDB transaction.
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
```javascript
|
|
1199
|
+
For example:
|
|
1200
|
+
```javascript
|
|
1241
1201
|
Ember.Test.registerWaiter(function() {
|
|
1242
1202
|
return myPendingTransactions() == 0;
|
|
1243
1203
|
});
|
|
1244
1204
|
```
|
|
1245
1205
|
The `context` argument allows you to optionally specify the `this`
|
|
1246
1206
|
with which your callback will be invoked.
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
```javascript
|
|
1207
|
+
For example:
|
|
1208
|
+
```javascript
|
|
1251
1209
|
Ember.Test.registerWaiter(MyDB, MyDB.hasPendingTransactions);
|
|
1252
1210
|
```
|
|
1253
|
-
|
|
1254
|
-
@public
|
|
1211
|
+
@public
|
|
1255
1212
|
@method registerWaiter
|
|
1256
1213
|
@param {Object} context (optional)
|
|
1257
1214
|
@param {Function} callback
|
|
1258
1215
|
@since 1.2.0
|
|
1259
1216
|
*/
|
|
1260
|
-
registerWaiter: function(context, callback) {
|
|
1217
|
+
registerWaiter: function (context, callback) {
|
|
1261
1218
|
if (arguments.length === 1) {
|
|
1262
1219
|
callback = context;
|
|
1263
1220
|
context = null;
|
|
@@ -1270,20 +1227,21 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1270
1227
|
/**
|
|
1271
1228
|
`unregisterWaiter` is used to unregister a callback that was
|
|
1272
1229
|
registered with `registerWaiter`.
|
|
1273
|
-
|
|
1274
|
-
@public
|
|
1230
|
+
@public
|
|
1275
1231
|
@method unregisterWaiter
|
|
1276
1232
|
@param {Object} context (optional)
|
|
1277
1233
|
@param {Function} callback
|
|
1278
1234
|
@since 1.2.0
|
|
1279
1235
|
*/
|
|
1280
|
-
unregisterWaiter: function(context, callback) {
|
|
1281
|
-
if (!this.waiters) {
|
|
1236
|
+
unregisterWaiter: function (context, callback) {
|
|
1237
|
+
if (!this.waiters) {
|
|
1238
|
+
return;
|
|
1239
|
+
}
|
|
1282
1240
|
if (arguments.length === 1) {
|
|
1283
1241
|
callback = context;
|
|
1284
1242
|
context = null;
|
|
1285
1243
|
}
|
|
1286
|
-
this.waiters = Ember['default'].A(this.waiters.filter(function(elt) {
|
|
1244
|
+
this.waiters = Ember['default'].A(this.waiters.filter(function (elt) {
|
|
1287
1245
|
return !(elt[0] === context && elt[1] === callback);
|
|
1288
1246
|
}));
|
|
1289
1247
|
}
|
|
@@ -1293,7 +1251,7 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1293
1251
|
var fn = helpers[name].method;
|
|
1294
1252
|
var meta = helpers[name].meta;
|
|
1295
1253
|
|
|
1296
|
-
return function() {
|
|
1254
|
+
return function () {
|
|
1297
1255
|
var args = slice.call(arguments);
|
|
1298
1256
|
var lastPromise;
|
|
1299
1257
|
|
|
@@ -1306,7 +1264,7 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1306
1264
|
return fn.apply(app, args);
|
|
1307
1265
|
}
|
|
1308
1266
|
|
|
1309
|
-
lastPromise = run(function() {
|
|
1267
|
+
lastPromise = run(function () {
|
|
1310
1268
|
return Test.resolve(Test.lastPromise);
|
|
1311
1269
|
});
|
|
1312
1270
|
|
|
@@ -1315,9 +1273,9 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1315
1273
|
// asynchronous here, because fn may not be invoked before we
|
|
1316
1274
|
// return.
|
|
1317
1275
|
Test.adapter.asyncStart();
|
|
1318
|
-
return lastPromise.then(function() {
|
|
1276
|
+
return lastPromise.then(function () {
|
|
1319
1277
|
return fn.apply(app, args);
|
|
1320
|
-
})["finally"](function() {
|
|
1278
|
+
})["finally"](function () {
|
|
1321
1279
|
Test.adapter.asyncEnd();
|
|
1322
1280
|
});
|
|
1323
1281
|
};
|
|
@@ -1337,8 +1295,7 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1337
1295
|
are created once you call `injectTestHelpers` on your `Ember.Application`
|
|
1338
1296
|
instance. The included helpers are also available on the `window` object by
|
|
1339
1297
|
default, but can be used from this object on the individual application also.
|
|
1340
|
-
|
|
1341
|
-
@property testHelpers
|
|
1298
|
+
@property testHelpers
|
|
1342
1299
|
@type {Object}
|
|
1343
1300
|
@default {}
|
|
1344
1301
|
*/
|
|
@@ -1347,11 +1304,9 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1347
1304
|
/**
|
|
1348
1305
|
This property will contain the original methods that were registered
|
|
1349
1306
|
on the `helperContainer` before `injectTestHelpers` is called.
|
|
1350
|
-
|
|
1351
|
-
When `removeTestHelpers` is called, these methods are restored to the
|
|
1307
|
+
When `removeTestHelpers` is called, these methods are restored to the
|
|
1352
1308
|
`helperContainer`.
|
|
1353
|
-
|
|
1354
|
-
@property originalMethods
|
|
1309
|
+
@property originalMethods
|
|
1355
1310
|
@type {Object}
|
|
1356
1311
|
@default {}
|
|
1357
1312
|
@private
|
|
@@ -1359,13 +1314,11 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1359
1314
|
*/
|
|
1360
1315
|
originalMethods: {},
|
|
1361
1316
|
|
|
1362
|
-
|
|
1363
1317
|
/**
|
|
1364
1318
|
This property indicates whether or not this application is currently in
|
|
1365
1319
|
testing mode. This is set when `setupForTesting` is called on the current
|
|
1366
1320
|
application.
|
|
1367
|
-
|
|
1368
|
-
@property testing
|
|
1321
|
+
@property testing
|
|
1369
1322
|
@type {Boolean}
|
|
1370
1323
|
@default false
|
|
1371
1324
|
@since 1.3.0
|
|
@@ -1378,30 +1331,26 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1378
1331
|
location to 'none', so that the window's location will not be modified
|
|
1379
1332
|
(preventing both accidental leaking of state between tests and interference
|
|
1380
1333
|
with your testing framework).
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
```
|
|
1334
|
+
Example:
|
|
1335
|
+
```
|
|
1385
1336
|
App.setupForTesting();
|
|
1386
1337
|
```
|
|
1387
|
-
|
|
1388
|
-
@method setupForTesting
|
|
1338
|
+
@method setupForTesting
|
|
1389
1339
|
*/
|
|
1390
|
-
setupForTesting: function() {
|
|
1340
|
+
setupForTesting: function () {
|
|
1391
1341
|
setupForTesting['default']();
|
|
1392
1342
|
|
|
1393
1343
|
this.testing = true;
|
|
1394
1344
|
|
|
1395
1345
|
this.Router.reopen({
|
|
1396
|
-
location:
|
|
1346
|
+
location: "none"
|
|
1397
1347
|
});
|
|
1398
1348
|
},
|
|
1399
1349
|
|
|
1400
1350
|
/**
|
|
1401
1351
|
This will be used as the container to inject the test helpers into. By
|
|
1402
1352
|
default the helpers are injected into `window`.
|
|
1403
|
-
|
|
1404
|
-
@property helperContainer
|
|
1353
|
+
@property helperContainer
|
|
1405
1354
|
@type {Object} The object to be used for test helpers.
|
|
1406
1355
|
@default window
|
|
1407
1356
|
@since 1.2.0
|
|
@@ -1414,18 +1363,15 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1414
1363
|
to `window`. If a function of the same name has already been defined it will be cached
|
|
1415
1364
|
(so that it can be reset if the helper is removed with `unregisterHelper` or
|
|
1416
1365
|
`removeTestHelpers`).
|
|
1417
|
-
|
|
1418
|
-
Any callbacks registered with `onInjectHelpers` will be called once the
|
|
1366
|
+
Any callbacks registered with `onInjectHelpers` will be called once the
|
|
1419
1367
|
helpers have been injected.
|
|
1420
|
-
|
|
1421
|
-
Example:
|
|
1368
|
+
Example:
|
|
1422
1369
|
```
|
|
1423
1370
|
App.injectTestHelpers();
|
|
1424
1371
|
```
|
|
1425
|
-
|
|
1426
|
-
@method injectTestHelpers
|
|
1372
|
+
@method injectTestHelpers
|
|
1427
1373
|
*/
|
|
1428
|
-
injectTestHelpers: function(helperContainer) {
|
|
1374
|
+
injectTestHelpers: function (helperContainer) {
|
|
1429
1375
|
if (helperContainer) {
|
|
1430
1376
|
this.helperContainer = helperContainer;
|
|
1431
1377
|
} else {
|
|
@@ -1447,18 +1393,17 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1447
1393
|
/**
|
|
1448
1394
|
This removes all helpers that have been registered, and resets and functions
|
|
1449
1395
|
that were overridden by the helpers.
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
```javascript
|
|
1396
|
+
Example:
|
|
1397
|
+
```javascript
|
|
1454
1398
|
App.removeTestHelpers();
|
|
1455
1399
|
```
|
|
1456
|
-
|
|
1457
|
-
@public
|
|
1400
|
+
@public
|
|
1458
1401
|
@method removeTestHelpers
|
|
1459
1402
|
*/
|
|
1460
|
-
removeTestHelpers: function() {
|
|
1461
|
-
if (!this.helperContainer) {
|
|
1403
|
+
removeTestHelpers: function () {
|
|
1404
|
+
if (!this.helperContainer) {
|
|
1405
|
+
return;
|
|
1406
|
+
}
|
|
1462
1407
|
|
|
1463
1408
|
for (var name in helpers) {
|
|
1464
1409
|
this.helperContainer[name] = this.originalMethods[name];
|
|
@@ -1472,19 +1417,19 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1472
1417
|
// But still here for backwards compatibility
|
|
1473
1418
|
// of helper chaining
|
|
1474
1419
|
function protoWrap(proto, name, callback, isAsync) {
|
|
1475
|
-
proto[name] = function() {
|
|
1420
|
+
proto[name] = function () {
|
|
1476
1421
|
var args = arguments;
|
|
1477
1422
|
if (isAsync) {
|
|
1478
1423
|
return callback.apply(this, args);
|
|
1479
1424
|
} else {
|
|
1480
|
-
return this.then(function() {
|
|
1425
|
+
return this.then(function () {
|
|
1481
1426
|
return callback.apply(this, args);
|
|
1482
1427
|
});
|
|
1483
1428
|
}
|
|
1484
1429
|
};
|
|
1485
1430
|
}
|
|
1486
1431
|
|
|
1487
|
-
Test.Promise = function() {
|
|
1432
|
+
Test.Promise = function () {
|
|
1488
1433
|
RSVP['default'].Promise.apply(this, arguments);
|
|
1489
1434
|
Test.lastPromise = this;
|
|
1490
1435
|
};
|
|
@@ -1496,8 +1441,8 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1496
1441
|
// Patch `then` to isolate async methods
|
|
1497
1442
|
// specifically `Ember.Test.lastPromise`
|
|
1498
1443
|
var originalThen = RSVP['default'].Promise.prototype.then;
|
|
1499
|
-
Test.Promise.prototype.then = function(onSuccess, onFailure) {
|
|
1500
|
-
return originalThen.call(this, function(val) {
|
|
1444
|
+
Test.Promise.prototype.then = function (onSuccess, onFailure) {
|
|
1445
|
+
return originalThen.call(this, function (val) {
|
|
1501
1446
|
return isolate(onSuccess, val);
|
|
1502
1447
|
}, onFailure);
|
|
1503
1448
|
};
|
|
@@ -1522,11 +1467,11 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1522
1467
|
// If the method returned a promise
|
|
1523
1468
|
// return that promise. If not,
|
|
1524
1469
|
// return the last async helper's promise
|
|
1525
|
-
if (
|
|
1470
|
+
if (value && value instanceof Test.Promise || !lastPromise) {
|
|
1526
1471
|
return value;
|
|
1527
1472
|
} else {
|
|
1528
|
-
return run(function() {
|
|
1529
|
-
return Test.resolve(lastPromise).then(function() {
|
|
1473
|
+
return run(function () {
|
|
1474
|
+
return Test.resolve(lastPromise).then(function () {
|
|
1530
1475
|
return value;
|
|
1531
1476
|
});
|
|
1532
1477
|
});
|
|
@@ -1536,118 +1481,6 @@ enifed('ember-testing/test', ['exports', 'ember-metal/core', 'ember-metal/run_lo
|
|
|
1536
1481
|
exports['default'] = Test;
|
|
1537
1482
|
|
|
1538
1483
|
});
|
|
1539
|
-
enifed("htmlbars-test-helpers",
|
|
1540
|
-
["exports"],
|
|
1541
|
-
function(__exports__) {
|
|
1542
|
-
"use strict";
|
|
1543
|
-
function equalInnerHTML(fragment, html) {
|
|
1544
|
-
var actualHTML = normalizeInnerHTML(fragment.innerHTML);
|
|
1545
|
-
QUnit.push(actualHTML === html, actualHTML, html);
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
__exports__.equalInnerHTML = equalInnerHTML;function equalHTML(node, html) {
|
|
1549
|
-
var fragment;
|
|
1550
|
-
if (!node.nodeType && node.length) {
|
|
1551
|
-
fragment = document.createDocumentFragment();
|
|
1552
|
-
while (node[0]) {
|
|
1553
|
-
fragment.appendChild(node[0]);
|
|
1554
|
-
}
|
|
1555
|
-
} else {
|
|
1556
|
-
fragment = node;
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1559
|
-
var div = document.createElement("div");
|
|
1560
|
-
div.appendChild(fragment.cloneNode(true));
|
|
1561
|
-
|
|
1562
|
-
equalInnerHTML(div, html);
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1565
|
-
__exports__.equalHTML = equalHTML;// detect weird IE8 html strings
|
|
1566
|
-
var ie8InnerHTMLTestElement = document.createElement('div');
|
|
1567
|
-
ie8InnerHTMLTestElement.setAttribute('id', 'womp');
|
|
1568
|
-
var ie8InnerHTML = (ie8InnerHTMLTestElement.outerHTML.indexOf('id=womp') > -1);
|
|
1569
|
-
|
|
1570
|
-
// detect side-effects of cloning svg elements in IE9-11
|
|
1571
|
-
var ieSVGInnerHTML = (function () {
|
|
1572
|
-
if (!document.createElementNS) {
|
|
1573
|
-
return false;
|
|
1574
|
-
}
|
|
1575
|
-
var div = document.createElement('div');
|
|
1576
|
-
var node = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
1577
|
-
div.appendChild(node);
|
|
1578
|
-
var clone = div.cloneNode(true);
|
|
1579
|
-
return clone.innerHTML === '<svg xmlns="http://www.w3.org/2000/svg" />';
|
|
1580
|
-
})();
|
|
1581
|
-
|
|
1582
|
-
function normalizeInnerHTML(actualHTML) {
|
|
1583
|
-
if (ie8InnerHTML) {
|
|
1584
|
-
// drop newlines in IE8
|
|
1585
|
-
actualHTML = actualHTML.replace(/\r\n/gm, '');
|
|
1586
|
-
// downcase ALLCAPS tags in IE8
|
|
1587
|
-
actualHTML = actualHTML.replace(/<\/?[A-Z\-]+/gi, function(tag){
|
|
1588
|
-
return tag.toLowerCase();
|
|
1589
|
-
});
|
|
1590
|
-
// quote ids in IE8
|
|
1591
|
-
actualHTML = actualHTML.replace(/id=([^ >]+)/gi, function(match, id){
|
|
1592
|
-
return 'id="'+id+'"';
|
|
1593
|
-
});
|
|
1594
|
-
// IE8 adds ':' to some tags
|
|
1595
|
-
// <keygen> becomes <:keygen>
|
|
1596
|
-
actualHTML = actualHTML.replace(/<(\/?):([^ >]+)/gi, function(match, slash, tag){
|
|
1597
|
-
return '<'+slash+tag;
|
|
1598
|
-
});
|
|
1599
|
-
|
|
1600
|
-
// Normalize the style attribute
|
|
1601
|
-
actualHTML = actualHTML.replace(/style="(.+?)"/gi, function(match, val){
|
|
1602
|
-
return 'style="'+val.toLowerCase()+';"';
|
|
1603
|
-
});
|
|
1604
|
-
|
|
1605
|
-
}
|
|
1606
|
-
if (ieSVGInnerHTML) {
|
|
1607
|
-
// Replace `<svg xmlns="http://www.w3.org/2000/svg" height="50%" />` with `<svg height="50%"></svg>`, etc.
|
|
1608
|
-
// drop namespace attribute
|
|
1609
|
-
actualHTML = actualHTML.replace(/ xmlns="[^"]+"/, '');
|
|
1610
|
-
// replace self-closing elements
|
|
1611
|
-
actualHTML = actualHTML.replace(/<([^ >]+) [^\/>]*\/>/gi, function(tag, tagName) {
|
|
1612
|
-
return tag.slice(0, tag.length - 3) + '></' + tagName + '>';
|
|
1613
|
-
});
|
|
1614
|
-
}
|
|
1615
|
-
|
|
1616
|
-
return actualHTML;
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
__exports__.normalizeInnerHTML = normalizeInnerHTML;// detect weird IE8 checked element string
|
|
1620
|
-
var checkedInput = document.createElement('input');
|
|
1621
|
-
checkedInput.setAttribute('checked', 'checked');
|
|
1622
|
-
var checkedInputString = checkedInput.outerHTML;
|
|
1623
|
-
function isCheckedInputHTML(element) {
|
|
1624
|
-
equal(element.outerHTML, checkedInputString);
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1627
|
-
__exports__.isCheckedInputHTML = isCheckedInputHTML;// check which property has the node's text content
|
|
1628
|
-
var textProperty = document.createElement('div').textContent === undefined ? 'innerText' : 'textContent';
|
|
1629
|
-
function getTextContent(el) {
|
|
1630
|
-
// textNode
|
|
1631
|
-
if (el.nodeType === 3) {
|
|
1632
|
-
return el.nodeValue;
|
|
1633
|
-
} else {
|
|
1634
|
-
return el[textProperty];
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
|
-
|
|
1638
|
-
__exports__.getTextContent = getTextContent;// IE8 does not have Object.create, so use a polyfill if needed.
|
|
1639
|
-
// Polyfill based on Mozilla's (MDN)
|
|
1640
|
-
function createObject(obj) {
|
|
1641
|
-
if (typeof Object.create === 'function') {
|
|
1642
|
-
return Object.create(obj);
|
|
1643
|
-
} else {
|
|
1644
|
-
var Temp = function() {};
|
|
1645
|
-
Temp.prototype = obj;
|
|
1646
|
-
return new Temp();
|
|
1647
|
-
}
|
|
1648
|
-
}
|
|
1649
|
-
__exports__.createObject = createObject;
|
|
1650
|
-
});
|
|
1651
1484
|
requireModule("ember-testing");
|
|
1652
1485
|
|
|
1653
1486
|
})();
|