From f51bf2358e4a7532330de7a110d68daf4e3b5327 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 22 Nov 2016 14:28:10 -0500 Subject: [PATCH] FIX: Error finding `$fields.position` during tests --- .../javascripts/discourse/components/composer-body.js.es6 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/components/composer-body.js.es6 b/app/assets/javascripts/discourse/components/composer-body.js.es6 index 8ec0a388f32..8c8ddf6e097 100644 --- a/app/assets/javascripts/discourse/components/composer-body.js.es6 +++ b/app/assets/javascripts/discourse/components/composer-body.js.es6 @@ -35,9 +35,11 @@ export default Ember.Component.extend({ // Figure out the size of the fields const $fields = this.$('.composer-fields'); - const fieldPos = $fields.position(); - if (fieldPos) { - this.$('.wmd-controls').css('top', $fields.height() + fieldPos.top + 5); + if ($fields) { + const fieldPos = $fields.position(); + if (fieldPos) { + this.$('.wmd-controls').css('top', $fields.height() + fieldPos.top + 5); + } } // get the submit panel height