forked from softlayer/sl-ember-test-helpers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
79 additions
and
4 deletions.
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
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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import AjaxHelper from './synchronous/ajax'; | ||
import contains from './synchronous/contains'; | ||
import requires from './synchronous/requires'; | ||
import * as globalLibraries from './synchronous/global-libraries'; | ||
|
||
export { | ||
AjaxHelper, | ||
contains, | ||
requires | ||
}; | ||
requires, | ||
globalLibraries | ||
}; |
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,21 @@ | ||
import Ember from 'ember'; | ||
import sinon from 'sinon'; | ||
|
||
export let called; | ||
export let jqueryAliasSpy; | ||
export let jquerySpy; | ||
export let emberJquery; | ||
|
||
export function setupSpies() { | ||
jqueryAliasSpy = sinon.spy( window, '$' ); | ||
jquerySpy = sinon.spy( window, 'jQuery' ); | ||
emberJquery = sinon.spy( Ember, '$' ); | ||
} | ||
|
||
export function restoreSpies() { | ||
called = jqueryAliasSpy.called || jquerySpy.called || emberJquery.called; | ||
|
||
window.$.restore(); | ||
window.jQuery.restore(); | ||
Ember.$.restore(); | ||
} |
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,23 @@ | ||
import { test } from 'ember-qunit'; | ||
import * as globalLibraries from '../../../../helpers/sl/synchronous/global-libraries'; | ||
|
||
module( 'Unit | Helpers | sl/synchronous/global-libraries' ); | ||
|
||
test( 'it exists', function( assert ) { | ||
assert.ok( | ||
globalLibraries, | ||
'it exists' | ||
); | ||
}); | ||
|
||
test( 'Functions as expected', function( assert ) { | ||
globalLibraries.setupSpies(); | ||
|
||
globalLibraries.restoreSpies(); | ||
|
||
assert.equal( | ||
globalLibraries.called, | ||
false, | ||
'There are no references to Ember.$, $ or jQuery' | ||
); | ||
}); |