diff --git a/src/mergely.js b/src/mergely.js index 9242ce8..323e7a2 100644 --- a/src/mergely.js +++ b/src/mergely.js @@ -691,9 +691,6 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, { this.element.append(jQuery('
')); this.element.append(jQuery('')); var rmargin = jQuery(''); - if (!this.settings.sidebar) { - this.element.find('.mergely-margin').css({display: 'none'}); - } if (this.settings.rhs_margin == 'left') { this.element.append(rmargin); } @@ -701,6 +698,9 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, { if (this.settings.rhs_margin != 'left') { this.element.append(rmargin); } + if (!this.settings.sidebar) { + this.element.find('.mergely-margin').css({display: 'none'}); + } if (['lgpl-separate-notice', 'gpl-separate-notice', 'mpl-separate-notice', 'commercial'].indexOf(this.settings.license) < 0) { const _lic = { 'lgpl': 'GNU LGPL v3.0', diff --git a/tests/mergely.spec.js b/tests/mergely.spec.js index 6c67293..18f58a0 100644 --- a/tests/mergely.spec.js +++ b/tests/mergely.spec.js @@ -42,7 +42,7 @@ describe('mergely', function () { }); }); - it.only('initializes with static arguments for lhs/rhs text', function (done) { + it('initializes with static arguments for lhs/rhs text', function (done) { $(document).ready(() => { const editor = init({ height: 100, @@ -70,5 +70,27 @@ describe('mergely', function () { }); }); + it('initializes with no sidebar', function (done) { + $(document).ready(() => { + const editor = init({ + height: 100, + license: 'lgpl-separate-notice', + sidebar: false + }); + expect(editor).to.exist; + expect(editor.mergely).to.exist; + const children = editor.children(); + expect(children.length).to.equal(6); + expect($(children[0]).attr('id')).to.equal('mergely-splash'); + expect($(children[1]).attr('class')).to.equal('mergely-margin'); + expect($(children[1]).css('display')).to.equal('none'); + expect($(children[2]).attr('class')).to.equal('mergely-column'); + expect($(children[3]).attr('class')).to.equal('mergely-canvas'); + expect($(children[4]).attr('class')).to.equal('mergely-column'); + expect($(children[5]).attr('class')).to.equal('mergely-margin'); + expect($(children[5]).css('display')).to.equal('none'); + done(); + }); + }); }); });