Fix some bugs with the click outside directive
This commit is contained in:
parent
66883ed6d0
commit
74234b45c3
|
|
@ -25,7 +25,7 @@ describe('Project Page', () => {
|
||||||
firstName: 'Rachel',
|
firstName: 'Rachel',
|
||||||
lastName: 'Green',
|
lastName: 'Green',
|
||||||
id: 'VXNlck5vZGU6NQ==',
|
id: 'VXNlck5vZGU6NQ==',
|
||||||
avatarUrl: ''
|
avatarUrl: '',
|
||||||
},
|
},
|
||||||
entriesCount: 2,
|
entriesCount: 2,
|
||||||
},
|
},
|
||||||
|
|
@ -60,9 +60,9 @@ describe('Project Page', () => {
|
||||||
AddProjectEntry: variables => ({
|
AddProjectEntry: variables => ({
|
||||||
addProjectEntry: {
|
addProjectEntry: {
|
||||||
projectEntry: Object.assign({}, variables.input.projectEntry, {
|
projectEntry: Object.assign({}, variables.input.projectEntry, {
|
||||||
created: createdLater
|
created: createdLater,
|
||||||
}),
|
}),
|
||||||
errors: null
|
errors: null,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
UpdateProjectEntry: variables => ({
|
UpdateProjectEntry: variables => ({
|
||||||
|
|
@ -96,6 +96,14 @@ describe('Project Page', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('uses the menu', () => {
|
||||||
|
cy.visit('/portfolio/groot');
|
||||||
|
cy.getByDataCy('project-actions').click();
|
||||||
|
cy.getByDataCy('delete-project').should('exist');
|
||||||
|
cy.getByDataCy('edit-project').should('exist');
|
||||||
|
cy.getByDataCy('share-project').should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
describe('Project Entry', () => {
|
describe('Project Entry', () => {
|
||||||
it('should create a new project entry', () => {
|
it('should create a new project entry', () => {
|
||||||
cy.visit('/portfolio');
|
cy.visit('/portfolio');
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<a
|
<a
|
||||||
class="more-options__more-link"
|
class="more-options__more-link"
|
||||||
data-cy="more-options-link"
|
data-cy="more-options-link"
|
||||||
@click="showMenu = !showMenu">
|
@click.stop="showMenu = !showMenu">
|
||||||
<ellipses class="more-options__ellipses"/>
|
<ellipses class="more-options__ellipses"/>
|
||||||
</a>
|
</a>
|
||||||
<widget-popover
|
<widget-popover
|
||||||
|
|
|
||||||
|
|
@ -4,21 +4,33 @@
|
||||||
data-cy="project-actions">
|
data-cy="project-actions">
|
||||||
<a
|
<a
|
||||||
class="project-actions__more-link"
|
class="project-actions__more-link"
|
||||||
@click="toggleMenu">
|
@click.stop="toggleMenu">
|
||||||
<ellipses/>
|
<ellipses/>
|
||||||
</a>
|
</a>
|
||||||
<widget-popover
|
<widget-popover
|
||||||
class="project-actions__popover"
|
class="project-actions__popover"
|
||||||
v-if="showMenu"
|
v-if="showMenu"
|
||||||
@hide-me="showMenu = false">
|
@hide-me="showMenu = false">
|
||||||
<li class="popover-links__link"><a @click="deleteProject(id)">Projekt löschen</a></li>
|
<li class="popover-links__link">
|
||||||
<li class="popover-links__link"><a @click="editProject(id)">Projekt bearbeiten</a></li>
|
<a
|
||||||
|
data-cy="delete-project"
|
||||||
|
@click="deleteProject(id)">Projekt löschen</a>
|
||||||
|
</li>
|
||||||
|
<li class="popover-links__link">
|
||||||
|
<a
|
||||||
|
data-cy="edit-project"
|
||||||
|
@click="editProject(id)">Projekt bearbeiten</a>
|
||||||
|
</li>
|
||||||
<li
|
<li
|
||||||
class="popover-links__link"
|
class="popover-links__link"
|
||||||
v-if="!final"><a @click="updateShareState(id, true)">Projekt teilen</a></li>
|
v-if="!final"><a
|
||||||
|
data-cy="share-project"
|
||||||
|
@click="updateShareState(id, true)">Projekt teilen</a></li>
|
||||||
<li
|
<li
|
||||||
class="popover-links__link"
|
class="popover-links__link"
|
||||||
v-if="final"><a @click="updateShareState(id, false)">Projekt nicht mehr teilen</a>
|
v-if="final"><a
|
||||||
|
data-cy="unshare-project"
|
||||||
|
@click="updateShareState(id, false)">Projekt nicht mehr teilen</a>
|
||||||
</li>
|
</li>
|
||||||
</widget-popover>
|
</widget-popover>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -39,12 +51,12 @@
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
Ellipses,
|
Ellipses,
|
||||||
WidgetPopover
|
WidgetPopover,
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showMenu: false
|
showMenu: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -60,8 +72,8 @@
|
||||||
mutation: DELETE_PROJECT_MUTATION,
|
mutation: DELETE_PROJECT_MUTATION,
|
||||||
variables: {
|
variables: {
|
||||||
input: {
|
input: {
|
||||||
id
|
id,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
update(store, {data: {deleteProject: {success}}}) {
|
update(store, {data: {deleteProject: {success}}}) {
|
||||||
if (success) {
|
if (success) {
|
||||||
|
|
@ -72,7 +84,7 @@
|
||||||
store.writeQuery({query: PROJECTS_QUERY, data});
|
store.writeQuery({query: PROJECTS_QUERY, data});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$router.push('/portfolio');
|
this.$router.push('/portfolio');
|
||||||
});
|
});
|
||||||
|
|
@ -84,14 +96,14 @@
|
||||||
variables: {
|
variables: {
|
||||||
input: {
|
input: {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
shared: state
|
shared: state,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
update(store, {data: {updateProjectSharedState: {shared, errors}}}) {
|
update(store, {data: {updateProjectSharedState: {shared, errors}}}) {
|
||||||
if (!errors) {
|
if (!errors) {
|
||||||
const query = PROJECT_QUERY;
|
const query = PROJECT_QUERY;
|
||||||
const variables = {
|
const variables = {
|
||||||
id: project.id
|
id: project.id,
|
||||||
};
|
};
|
||||||
const data = store.readQuery({query, variables});
|
const data = store.readQuery({query, variables});
|
||||||
|
|
||||||
|
|
@ -100,10 +112,10 @@
|
||||||
store.writeQuery({query, variables, data});
|
store.writeQuery({query, variables, data});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue