From 3e9b5d87287ed0cc39ba29607ae31c5aa42eaec8 Mon Sep 17 00:00:00 2001 From: e2tha-e Date: Sat, 1 Feb 2020 15:13:01 -0500 Subject: [PATCH] body click closes size panel --- scripts/ui/functions.js | 1 + test/e2e/pattern.js | 9 +++++++++ test/unit/ui-functions.js | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/scripts/ui/functions.js b/scripts/ui/functions.js index 4f6400b..7558df0 100644 --- a/scripts/ui/functions.js +++ b/scripts/ui/functions.js @@ -31,6 +31,7 @@ export default function (fepperUiInst, root) { this.$orgs['#sg-nav-target'].dispatchAction('removeClass', 'active'); this.$orgs['.sg-acc-handle'].dispatchAction('removeClass', 'active'); this.$orgs['.sg-acc-panel'].dispatchAction('removeClass', 'active'); + this.$orgs['.sg-size'].dispatchAction('removeClass', 'active'); } /** diff --git a/test/e2e/pattern.js b/test/e2e/pattern.js index 23da86f..5590bb9 100644 --- a/test/e2e/pattern.js +++ b/test/e2e/pattern.js @@ -441,6 +441,15 @@ menu anchor.

expect($('.sg-nav-elements').$('.sg-acc-panel').getAttribute('class')).to.not.have.string('active'); }); + it('bodyClick closes size panel', function () { + $('#sg-form-label').click(); + expect($('#sg-form-label').getAttribute('class')).to.have.string('active'); + browser.switchToFrame($('#sg-viewport')); + $('body').click(); + browser.switchToParentFrame(); + expect($('#sg-form-label').getAttribute('class')).to.not.have.string('active'); + }); + it('pattern anchor clicks switch the pattern in the iframe', function () { $('.sg-nav-compounds').$('.sg-acc-handle').click(); browser.pause(100); diff --git a/test/unit/ui-functions.js b/test/unit/ui-functions.js index 33ea759..d3b4041 100644 --- a/test/unit/ui-functions.js +++ b/test/unit/ui-functions.js @@ -16,24 +16,29 @@ describe('uiFns', function () { $orgs['#sg-nav-target'].dispatchAction('addClass', 'active'); $orgs['.sg-acc-handle'].dispatchAction('addClass', 'active'); $orgs['.sg-acc-panel'].dispatchAction('addClass', 'active'); + $orgs['.sg-size'].dispatchAction('addClass', 'active'); const sgNavTargetStateBefore = $orgs['#sg-nav-target'].getState(); const sgAccHandleStateBefore = $orgs['.sg-acc-handle'].getState(); const sgAccPanelStateBefore = $orgs['.sg-acc-panel'].getState(); + const sgSizeStateBefore = $orgs['.sg-size'].getState(); uiFns.closeAllPanels(); const sgNavTargetStateAfter = $orgs['#sg-nav-target'].getState(); const sgAccHandleStateAfter = $orgs['.sg-acc-handle'].getState(); const sgAccPanelStateAfter = $orgs['.sg-acc-panel'].getState(); + const sgSizeStateAfter = $orgs['.sg-size'].getState(); expect(sgNavTargetStateBefore.classArray).to.include('active'); expect(sgAccHandleStateBefore.classArray).to.include('active'); expect(sgAccPanelStateBefore.classArray).to.include('active'); + expect(sgSizeStateBefore.classArray).to.include('active'); expect(sgNavTargetStateAfter.classArray).to.not.include('active'); expect(sgAccHandleStateAfter.classArray).to.not.include('active'); expect(sgAccPanelStateAfter.classArray).to.not.include('active'); + expect(sgSizeStateAfter.classArray).to.not.include('active'); }); });