Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17479 from bobisjan/restore-window-performance-fa…
…llback-in-fastboot Restore fallback for `window.performance` in FastBoot
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
var path = require('path'); | ||
var distPath = path.join(__dirname, '../../dist'); | ||
var emberPath = path.join(distPath, 'ember.debug'); | ||
|
||
QUnit.module('instrumentation', function(hooks) { | ||
hooks.afterEach(function() { | ||
delete global.Ember; | ||
delete require.cache[emberPath + '.js']; | ||
}); | ||
|
||
QUnit.test('it works in FastBoot environment', function(assert) { | ||
var _originalWindow = global.window; | ||
|
||
global.window = {}; // mock window without `performance` property | ||
var Ember = require(emberPath); | ||
|
||
var result = Ember.instrument('render', {}, function() { | ||
return 'hello'; | ||
}); | ||
|
||
assert.equal(result, 'hello', 'called block'); | ||
|
||
global.window = _originalWindow; | ||
}); | ||
}); |