Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMark Goldsmith <mark.goldsmith@rtspecialty.com>2020-02-19 08:51:03 -0500
committerMark Goldsmith <mark.goldsmith@rtspecialty.com>2020-02-19 08:52:53 -0500
commit1e76291ada7040a0fdd9f96979e26f782b82bf2d (patch)
tree5d91854aa95bab66e4dc5c09caee8ae8452f3d8b /test
parente9ded067b1f60311db97d405298a2663304a3fc0 (diff)
downloadliza-1e76291ada7040a0fdd9f96979e26f782b82bf2d.tar.gz
liza-1e76291ada7040a0fdd9f96979e26f782b82bf2d.tar.bz2
liza-1e76291ada7040a0fdd9f96979e26f782b82bf2d.zip
[DEV-7060] Set document in constructor of ElementStyler
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 );