Skip to content

Commit

Permalink
body click closes size panel
Browse files Browse the repository at this point in the history
  • Loading branch information
e2tha-e committed Feb 1, 2020
1 parent 9e51396 commit 3e9b5d8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/ui/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

/**
Expand Down
9 changes: 9 additions & 0 deletions test/e2e/pattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,15 @@ menu anchor.</p>
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);
Expand Down
5 changes: 5 additions & 0 deletions test/unit/ui-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});

Expand Down

0 comments on commit 3e9b5d8

Please sign in to comment.