Skip to content

Commit

Permalink
[FIX] Closing sidebar when room menu is clicked. (#13842)
Browse files Browse the repository at this point in the history
* Don't close sidebar when room menu is clicked.

* Add tests to check if sidebar closes after clicking sidebar item menu

* Update side-nav.page.js

* Fix typo in class name

* Update side-nav.page.js

* Update 08-resolutions.js
  • Loading branch information
Kailash0311 authored and rodrigok committed Apr 6, 2019
1 parent 3adef03 commit 0383c28
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/ui-sidenav/client/sidebarItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Template.sidebarItem.events({
return menu.close();
},
'click .sidebar-item__menu'(e) {
e.stopPropagation(); // to not close the menu
e.preventDefault();

const canLeave = () => {
Expand Down
9 changes: 9 additions & 0 deletions tests/end-to-end/ui/08-resolutions.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ describe('[Resolution]', () => {
mainContent.mainContent.getLocation().should.not.deep.equal({ x:0 });
});

it('it should not close sidebar on pressing the sidebar item menu', () => {
sideNav.firstSidebarItem.moveToObject();
sideNav.firstSidebarItemMenu.waitForVisible(10000);
sideNav.firstSidebarItemMenu.click();
browser.pause(100);
mainContent.mainContent.getLocation().should.not.deep.equal({ x:0 });
sideNav.popoverOverlay.click();
});

it('it should open general channel', () => {
sideNav.openChannel('general');
});
Expand Down
4 changes: 4 additions & 0 deletions tests/pageobjects/side-nav.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class SideNav extends Page {

get sidebarWrap() { return browser.element('.sidebar-wrap'); }

get firstSidebarItem() { return browser.element('.sidebar-item'); }
get firstSidebarItemMenu() { return browser.element('.sidebar-item__menu'); }
get popoverOverlay() { return browser.element('.rc-popover.rc-popover--sidebar-item'); }

// Opens a channel via rooms list
openChannel(channelName) {
browser.waitForVisible(`.sidebar-item__ellipsis=${ channelName }`, 10000);
Expand Down

0 comments on commit 0383c28

Please sign in to comment.