Fix sidebar bug
This commit is contained in:
parent
91a1dd0bdb
commit
66883ed6d0
|
|
@ -0,0 +1,27 @@
|
||||||
|
import {getMinimalMe} from '../../support/helpers';
|
||||||
|
|
||||||
|
describe('Sidebar', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.setup();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should open sidebar and stay open', () => {
|
||||||
|
const operations = {
|
||||||
|
MeQuery: getMinimalMe({}),
|
||||||
|
ProjectsQuery: {
|
||||||
|
projects: []
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
cy.mockGraphqlOps({
|
||||||
|
operations
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.visit('/portfolio');
|
||||||
|
cy.getByDataCy('sidebar').should('not.exist');
|
||||||
|
cy.getByDataCy('user-widget-avatar').click();
|
||||||
|
cy.getByDataCy('sidebar').should('exist');
|
||||||
|
cy.getByDataCy('close-profile-sidebar-link').click();
|
||||||
|
cy.getByDataCy('sidebar').should('not.exist');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
class="block-actions"
|
class="block-actions"
|
||||||
v-if="canEditContentBlock && editModule">
|
v-if="canEditContentBlock && editModule">
|
||||||
<user-widget
|
<user-widget
|
||||||
:show-menu="false"
|
|
||||||
v-bind="me"
|
v-bind="me"
|
||||||
class="block-actions__user-widget content-block__user-widget"/>
|
class="block-actions__user-widget content-block__user-widget"/>
|
||||||
<more-options-widget>
|
<more-options-widget>
|
||||||
|
|
|
||||||
|
|
@ -3,20 +3,22 @@
|
||||||
<a
|
<a
|
||||||
class="header-bar__sidebar-link"
|
class="header-bar__sidebar-link"
|
||||||
data-cy="open-sidebar-link"
|
data-cy="open-sidebar-link"
|
||||||
@click="openSidebar('navigation')">
|
@click.stop="openSidebar('navigation')">
|
||||||
<hamburger class="header-bar__sidebar-icon"/>
|
<hamburger class="header-bar__sidebar-icon"/>
|
||||||
</a>
|
</a>
|
||||||
<content-navigation class="header-bar__content-navigation"/>
|
<content-navigation class="header-bar__content-navigation"/>
|
||||||
<div class="user-header">
|
<div class="user-header">
|
||||||
<a
|
<a
|
||||||
class="user-header__sidebar-link"
|
class="user-header__sidebar-link" >
|
||||||
@click="openSidebar('profile')">
|
<current-class
|
||||||
<current-class class="user-header__current-class"/>
|
class="user-header__current-class"
|
||||||
|
@click.native.stop="openSidebar('profile')"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<user-widget
|
<user-widget
|
||||||
v-bind="me"
|
v-bind="me"
|
||||||
data-cy="header-user-widget"/>
|
data-cy="header-user-widget"
|
||||||
|
@click.native.stop="openSidebar('profile')"/>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -39,14 +41,13 @@
|
||||||
UserWidget,
|
UserWidget,
|
||||||
Logo,
|
Logo,
|
||||||
CurrentClass,
|
CurrentClass,
|
||||||
Hamburger
|
Hamburger,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import "@/styles/_variables.scss";
|
@import "~styles/helpers";
|
||||||
@import "@/styles/_mixins.scss";
|
|
||||||
|
|
||||||
.header-bar {
|
.header-bar {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,9 @@
|
||||||
<logo/>
|
<logo/>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
||||||
<user-widget v-bind="me"/>
|
<user-widget
|
||||||
|
v-bind="me"
|
||||||
|
@click.native.stop="openSidebar('profile')"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -20,27 +22,27 @@
|
||||||
import UserWidget from '@/components/UserWidget';
|
import UserWidget from '@/components/UserWidget';
|
||||||
|
|
||||||
import me from '@/mixins/me';
|
import me from '@/mixins/me';
|
||||||
|
import openSidebar from '@/mixins/open-sidebar';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [me],
|
mixins: [me, openSidebar],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
Logo,
|
Logo,
|
||||||
Hamburger,
|
Hamburger,
|
||||||
UserWidget
|
UserWidget,
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
showMobileNavigation() {
|
showMobileNavigation() {
|
||||||
this.$store.dispatch('showMobileNavigation', true);
|
this.$store.dispatch('showMobileNavigation', true);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import "@/styles/_variables.scss";
|
@import "~styles/helpers";
|
||||||
@import "@/styles/_mixins.scss";
|
|
||||||
|
|
||||||
.mobile-header {
|
.mobile-header {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
|
||||||
|
|
@ -4,43 +4,25 @@
|
||||||
class="user-widget">
|
class="user-widget">
|
||||||
<div
|
<div
|
||||||
class="user-widget__avatar"
|
class="user-widget__avatar"
|
||||||
data-cy="user-widget-avatar"
|
data-cy="user-widget-avatar">
|
||||||
@click="openSidebar('profile')">
|
|
||||||
<avatar
|
<avatar
|
||||||
:avatar-url="avatarUrl"
|
:avatar-url="avatarUrl"
|
||||||
:icon-highlighted="isProfile"/>
|
:icon-highlighted="isProfile"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Avatar from '@/components/profile/Avatar';
|
import Avatar from '@/components/profile/Avatar';
|
||||||
import openSidebar from '@/mixins/open-sidebar';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
// todo: clean up unneeded props
|
|
||||||
props: {
|
props: {
|
||||||
firstName: {
|
|
||||||
type: String
|
|
||||||
},
|
|
||||||
lastName: {
|
|
||||||
type: String
|
|
||||||
},
|
|
||||||
avatarUrl: {
|
avatarUrl: {
|
||||||
type: String
|
type: String
|
||||||
},
|
|
||||||
mobile: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
showMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [openSidebar],
|
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
Avatar
|
Avatar
|
||||||
},
|
},
|
||||||
|
|
@ -53,8 +35,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import "@/styles/_variables.scss";
|
@import "~styles/helpers";
|
||||||
@import "@/styles/_mixins.scss";
|
|
||||||
|
|
||||||
.user-widget {
|
.user-widget {
|
||||||
color: $color-silver-dark;
|
color: $color-silver-dark;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@
|
||||||
class="block-actions"
|
class="block-actions"
|
||||||
v-if="editModule && canEdit">
|
v-if="editModule && canEdit">
|
||||||
<user-widget
|
<user-widget
|
||||||
:show-menu="false"
|
|
||||||
v-bind="me"
|
v-bind="me"
|
||||||
class="block-actions__user-widget objective__user-widget"/>
|
class="block-actions__user-widget objective__user-widget"/>
|
||||||
<more-options-widget>
|
<more-options-widget>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
<div
|
<div
|
||||||
v-click-outside="close"
|
v-click-outside="close"
|
||||||
class="profile-sidebar"
|
class="profile-sidebar"
|
||||||
|
data-cy="sidebar"
|
||||||
v-if="sidebar.profile">
|
v-if="sidebar.profile">
|
||||||
<a
|
<a
|
||||||
class="profile-sidebar__close-link"
|
class="profile-sidebar__close-link"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue