Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ui/ElementStylerTest.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/ui/ElementStylerTest.js b/test/ui/ElementStylerTest.js
index e7d16af..30812a8 100644
--- a/test/ui/ElementStylerTest.js
+++ b/test/ui/ElementStylerTest.js
@@ -115,10 +115,15 @@ describe( 'ui.ElementStyler', () =>
{
it( "determines the correct element id for " + name, () =>
{
- // Stub all objects
- $ = sinon.stub();
- jQuery = sinon.stub();
- document = sinon.stub();
+ // Stub document and jQuery calls
+ $ = sinon.stub();
+ jQuery = sinon.stub();
+
+ const document = {
+ getElementById: sinon.stub()
+ };
+
+ jQuery.withArgs( 'body' ).returns( { context: document } );
const sut = Sut( jQuery );
@@ -136,12 +141,11 @@ describe( 'ui.ElementStyler', () =>
html: html,
};
- document.getElementById = sinon.stub();
document.getElementById.returns( node );
sut.getWidgetByName( name, index, null, context );
- const actual_id = document.getElementById.getCall(0).args[0];
+ const actual_id = document.getElementById.getCall( 0 ).args[ 0 ];
expect( actual_id )
.to.equal( expected_id );