From 29daac2becdc5b82ee4eb462343b79d8cd39a2ed Mon Sep 17 00:00:00 2001 From: Aziz Punjani Date: Tue, 8 Dec 2015 08:46:38 -0600 Subject: [PATCH 1/2] Fixed lint issues + added test --- README.md | 2 +- .../sl/synchronous/global-libaries-test.js | 20 +++---------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index c1481e6..a5a67bb 100755 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ There are several utility functions provided in the */test-support/helpers/sl/ut internally by the helpers themselves, can be imported as needed for use. These include: * convertToArray() - convertStringToArray() +* convertStringToArray() * convertObjectKeysToArray() * doArraysIntersect() diff --git a/tests/unit/helpers/sl/synchronous/global-libaries-test.js b/tests/unit/helpers/sl/synchronous/global-libaries-test.js index 998c300..2b4d721 100644 --- a/tests/unit/helpers/sl/synchronous/global-libaries-test.js +++ b/tests/unit/helpers/sl/synchronous/global-libaries-test.js @@ -46,7 +46,7 @@ test( 'triggerEvents triggers respective events', function( assert ) { globalLibraries.triggerEvents( component ); - Object.keys( events ).forEach(( eventName ) => { + Object.keys( events ).forEach( ( eventName ) => { const spy = events[ eventName ]; assert.ok( spy.called, @@ -67,24 +67,10 @@ test( 'called() returns true when $ is referenced', function( assert ) { globalLibraries.restoreSpies(); }); -test( 'called() returns true when jQuery is referenced', function( assert ) { +test( 'called() returns false when global libraries are not referenced', function( assert ) { globalLibraries.setupSpies(); - window.jQuery(); - - assert.ok( - globalLibraries.called() - ); - - globalLibraries.restoreSpies(); -}); - -test( 'called() returns true when Ember.$ is referenced', function( assert ) { - globalLibraries.setupSpies(); - - Ember.$(); - - assert.ok( + assert.notOk( globalLibraries.called() ); From ff53328314eb61b11e9e09bb819ee9f58bfec255 Mon Sep 17 00:00:00 2001 From: Aziz Punjani Date: Tue, 8 Dec 2015 08:51:03 -0600 Subject: [PATCH 2/2] Added deleted tests back --- .../sl/synchronous/global-libaries-test.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/unit/helpers/sl/synchronous/global-libaries-test.js b/tests/unit/helpers/sl/synchronous/global-libaries-test.js index 2b4d721..b7d1d66 100644 --- a/tests/unit/helpers/sl/synchronous/global-libaries-test.js +++ b/tests/unit/helpers/sl/synchronous/global-libaries-test.js @@ -67,6 +67,30 @@ test( 'called() returns true when $ is referenced', function( assert ) { globalLibraries.restoreSpies(); }); +test( 'called() returns true when jQuery is referenced', function( assert ) { + globalLibraries.setupSpies(); + + window.jQuery(); + + assert.ok( + globalLibraries.called() + ); + + globalLibraries.restoreSpies(); +}); + +test( 'called() returns true when Ember.$ is referenced', function( assert ) { + globalLibraries.setupSpies(); + + Ember.$(); + + assert.ok( + globalLibraries.called() + ); + + globalLibraries.restoreSpies(); +}); + test( 'called() returns false when global libraries are not referenced', function( assert ) { globalLibraries.setupSpies();