diff --git a/backend/src/middleware/notifications/posts-in-groups.spec.ts b/backend/src/middleware/notifications/posts-in-groups.spec.ts index 742685816..a46de2830 100644 --- a/backend/src/middleware/notifications/posts-in-groups.spec.ts +++ b/backend/src/middleware/notifications/posts-in-groups.spec.ts @@ -63,8 +63,8 @@ const notificationQuery = gql` ` const muteGroupMutation = gql` - mutation ($id: ID!) { - muteGroup(id: $id) { + mutation ($groupId: ID!) { + muteGroup(groupId: $groupId) { id isMutedByMe } @@ -72,8 +72,8 @@ const muteGroupMutation = gql` ` const unmuteGroupMutation = gql` - mutation ($id: ID!) { - unmuteGroup(id: $id) { + mutation ($groupId: ID!) { + unmuteGroup(groupId: $groupId) { id isMutedByMe } @@ -281,7 +281,7 @@ describe('notify group members of new posts in group', () => { mutate({ mutation: muteGroupMutation, variables: { - id: 'g-1', + groupId: 'g-1', }, }), ).resolves.toMatchObject({ @@ -340,7 +340,7 @@ describe('notify group members of new posts in group', () => { mutate({ mutation: unmuteGroupMutation, variables: { - id: 'g-1', + groupId: 'g-1', }, }), ).resolves.toMatchObject({ diff --git a/backend/src/schema/resolvers/groups.ts b/backend/src/schema/resolvers/groups.ts index 6a54ce17f..4bf535f35 100644 --- a/backend/src/schema/resolvers/groups.ts +++ b/backend/src/schema/resolvers/groups.ts @@ -369,7 +369,7 @@ export default { } }, muteGroup: async (_parent, params, context, _resolveInfo) => { - const { id: groupId } = params + const { groupId } = params const userId = context.user.id const session = context.driver.session() const writeTxResultPromise = session.writeTransaction(async (transaction) => { @@ -398,7 +398,7 @@ export default { } }, unmuteGroup: async (_parent, params, context, _resolveInfo) => { - const { id: groupId } = params + const { groupId } = params const userId = context.user.id const session = context.driver.session() const writeTxResultPromise = session.writeTransaction(async (transaction) => { diff --git a/backend/src/schema/types/type/Group.gql b/backend/src/schema/types/type/Group.gql index 2e14c8c0a..0d399d287 100644 --- a/backend/src/schema/types/type/Group.gql +++ b/backend/src/schema/types/type/Group.gql @@ -142,6 +142,6 @@ type Mutation { userId: ID! ): User - muteGroup(id: ID!): Group - unmuteGroup(id: ID!): Group + muteGroup(groupId: ID!): Group + unmuteGroup(groupId: ID!): Group } diff --git a/webapp/components/ContentMenu/GroupContentMenu.spec.js b/webapp/components/ContentMenu/GroupContentMenu.spec.js index 49a66aaac..f7336589d 100644 --- a/webapp/components/ContentMenu/GroupContentMenu.spec.js +++ b/webapp/components/ContentMenu/GroupContentMenu.spec.js @@ -1,5 +1,5 @@ -import { mount } from '@vue/test-utils' import GroupContentMenu from './GroupContentMenu.vue' +import { render, screen, fireEvent } from '@testing-library/vue' const localVue = global.localVue @@ -7,36 +7,77 @@ const stubs = { 'router-link': { template: '', }, + 'v-popover': true, } -const propsData = { - usage: 'groupTeaser', - resource: {}, - group: {}, - resourceType: 'group', -} +// Mock Math.random, used in Dropdown +Object.assign(Math, { + random: () => 0, +}) describe('GroupContentMenu', () => { - let wrapper let mocks beforeEach(() => { mocks = { - $t: jest.fn(), + $t: jest.fn((s) => s), } }) - describe('mount', () => { - const Wrapper = () => { - return mount(GroupContentMenu, { propsData, mocks, localVue, stubs }) - } + const Wrapper = (propsData) => { + return render(GroupContentMenu, { propsData, mocks, localVue, stubs }) + } - beforeEach(() => { - wrapper = Wrapper() + it('renders as groupTeaser', () => { + const wrapper = Wrapper({ usage: 'groupTeaser', group: { id: 'groupid' } }) + expect(wrapper.container).toMatchSnapshot() + }) + + it('renders as groupProfile, not muted', () => { + const wrapper = Wrapper({ + usage: 'groupProfile', + group: { isMutedByMe: false, id: 'groupid' }, }) + expect(wrapper.container).toMatchSnapshot() + }) - it('renders', () => { - expect(wrapper.findAll('.group-content-menu')).toHaveLength(1) + it('renders as groupProfile, muted', () => { + const wrapper = Wrapper({ + usage: 'groupProfile', + group: { isMutedByMe: true, id: 'groupid' }, + }) + expect(wrapper.container).toMatchSnapshot() + }) + + it('renders as groupProfile when I am the owner', () => { + const wrapper = Wrapper({ + usage: 'groupProfile', + group: { myRole: 'owner', id: 'groupid' }, + }) + expect(wrapper.container).toMatchSnapshot() + }) + + describe('mute button', () => { + it('emits mute', async () => { + const wrapper = Wrapper({ + usage: 'groupProfile', + group: { isMutedByMe: false, id: 'groupid' }, + }) + const muteButton = screen.getByText('group.contentMenu.muteGroup') + await fireEvent.click(muteButton) + expect(wrapper.emitted().mute).toBeTruthy() + }) + }) + + describe('unmute button', () => { + it('emits unmute', async () => { + const wrapper = Wrapper({ + usage: 'groupProfile', + group: { isMutedByMe: true, id: 'groupid' }, + }) + const muteButton = screen.getByText('group.contentMenu.unmuteGroup') + await fireEvent.click(muteButton) + expect(wrapper.emitted().unmute).toBeTruthy() }) }) }) diff --git a/webapp/components/ContentMenu/GroupContentMenu.vue b/webapp/components/ContentMenu/GroupContentMenu.vue index 1ca1b5b33..e28a855ac 100644 --- a/webapp/components/ContentMenu/GroupContentMenu.vue +++ b/webapp/components/ContentMenu/GroupContentMenu.vue @@ -62,6 +62,27 @@ export default { params: { id: this.group.id, slug: this.group.slug }, }) } + + if (this.usage === 'groupProfile') { + if (this.group.isMutedByMe) { + routes.push({ + label: this.$t('group.contentMenu.unmuteGroup'), + icon: 'volume-up', + callback: () => { + this.$emit('unmute', this.group.id) + }, + }) + } else { + routes.push({ + label: this.$t('group.contentMenu.muteGroup'), + icon: 'volume-off', + callback: () => { + this.$emit('mute', this.group.id) + }, + }) + } + } + if (this.group.myRole === 'owner') { routes.push({ label: this.$t('admin.settings.name'), diff --git a/webapp/components/ContentMenu/__snapshots__/GroupContentMenu.spec.js.snap b/webapp/components/ContentMenu/__snapshots__/GroupContentMenu.spec.js.snap new file mode 100644 index 000000000..0553dfa79 --- /dev/null +++ b/webapp/components/ContentMenu/__snapshots__/GroupContentMenu.spec.js.snap @@ -0,0 +1,321 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GroupContentMenu renders as groupProfile when I am the owner 1`] = ` +
+ + + +
+ +
+
+
+`; + +exports[`GroupContentMenu renders as groupProfile, muted 1`] = ` +
+ + + +
+ +
+
+
+`; + +exports[`GroupContentMenu renders as groupProfile, not muted 1`] = ` +
+ + + +
+ +
+
+
+`; + +exports[`GroupContentMenu renders as groupTeaser 1`] = ` +
+ + + +
+ +
+
+
+`; diff --git a/webapp/graphql/groups.js b/webapp/graphql/groups.js index 6aedc205d..bd17b0484 100644 --- a/webapp/graphql/groups.js +++ b/webapp/graphql/groups.js @@ -177,6 +177,7 @@ export const groupQuery = (i18n) => { descriptionExcerpt groupType actionRadius + isMutedByMe categories { id slug diff --git a/webapp/graphql/settings/MutedGroups.js b/webapp/graphql/settings/MutedGroups.js new file mode 100644 index 000000000..847fac4c4 --- /dev/null +++ b/webapp/graphql/settings/MutedGroups.js @@ -0,0 +1,25 @@ +import gql from 'graphql-tag' + +export const muteGroup = () => { + return gql` + mutation ($groupId: ID!) { + muteGroup(groupId: $groupId) { + id + name + isMutedByMe + } + } + ` +} + +export const unmuteGroup = () => { + return gql` + mutation ($groupId: ID!) { + unmuteGroup(groupId: $groupId) { + id + name + isMutedByMe + } + } + ` +} diff --git a/webapp/locales/de.json b/webapp/locales/de.json index dd2f36115..fb8866005 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -485,6 +485,8 @@ "categoriesTitle": "Themen der Gruppe", "changeMemberRole": "Die Rolle wurde auf „{role}“ geändert!", "contentMenu": { + "muteGroup": "Gruppe stummschalten", + "unmuteGroup": "Gruppe nicht mehr stummschalten", "visitGroupPage": "Gruppe anzeigen" }, "createNewGroup": { @@ -535,6 +537,7 @@ "confirmAddGroupMemberText": "Nutzer „{name}“ zur Gruppe hinzufügen?", "confirmAddGroupMemberTitle": "Bestätigen" }, + "muted": "Gruppe stummgeschaltet", "myGroups": "Meine Gruppen", "name": "Gruppenname", "radius": "Radius", @@ -559,6 +562,8 @@ "hidden": "Geheim — Gruppe (auch der Name) komplett unsichtbar", "public": "Öffentlich — Gruppe und alle Beiträge für registrierte Nutzer sichtbar" }, + "unmute": "Gruppe nicht mehr stummschalten", + "unmuted": "Gruppe nicht mehr stummgeschaltet", "update": "Änderung speichern", "updatedGroup": "Die Gruppendaten wurden geändert!" }, diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 7e5570b89..b4c1125f3 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -485,6 +485,8 @@ "categoriesTitle": "Topics of the group", "changeMemberRole": "The role has been changed to “{role}”!", "contentMenu": { + "muteGroup": "Mute group", + "unmuteGroup": "Unmute group", "visitGroupPage": "Show group" }, "createNewGroup": { @@ -535,6 +537,7 @@ "confirmAddGroupMemberText": "Add user “{name}” to group?", "confirmAddGroupMemberTitle": "Confirm" }, + "muted": "Group muted", "myGroups": "My Groups", "name": "Group name", "radius": "Radius", @@ -559,6 +562,8 @@ "hidden": "Secret — Group (including the name) is completely invisible", "public": "Public — Group and all posts are visible for all registered users" }, + "unmute": "Unmute group", + "unmuted": "Group unmuted", "update": "Save change", "updatedGroup": "The group data has been changed." }, diff --git a/webapp/locales/es.json b/webapp/locales/es.json index a3e5cfcc2..7184a327a 100644 --- a/webapp/locales/es.json +++ b/webapp/locales/es.json @@ -485,6 +485,8 @@ "categoriesTitle": null, "changeMemberRole": null, "contentMenu": { + "muteGroup": "Silenciar grupo", + "unmuteGroup": "Desactivar silencio del grupo", "visitGroupPage": null }, "createNewGroup": { @@ -535,6 +537,7 @@ "confirmAddGroupMemberText": null, "confirmAddGroupMemberTitle": null }, + "muted": "Grupo silenciado", "myGroups": null, "name": null, "radius": null, @@ -559,6 +562,8 @@ "hidden": null, "public": null }, + "unmute": "Desactivar silencio", + "unmuted": "Silencio del grupo desactivado", "update": null, "updatedGroup": null }, diff --git a/webapp/locales/fr.json b/webapp/locales/fr.json index 0153c20a1..851743e63 100644 --- a/webapp/locales/fr.json +++ b/webapp/locales/fr.json @@ -485,6 +485,8 @@ "categoriesTitle": null, "changeMemberRole": null, "contentMenu": { + "muteGroup": null, + "unmuteGroup": null, "visitGroupPage": null }, "createNewGroup": { @@ -535,6 +537,7 @@ "confirmAddGroupMemberText": null, "confirmAddGroupMemberTitle": null }, + "muted": null, "myGroups": null, "name": null, "radius": null, @@ -559,6 +562,8 @@ "hidden": null, "public": null }, + "unmute": null, + "unmuted": null, "update": null, "updatedGroup": null }, diff --git a/webapp/locales/it.json b/webapp/locales/it.json index 586f44839..0c693ca43 100644 --- a/webapp/locales/it.json +++ b/webapp/locales/it.json @@ -485,6 +485,8 @@ "categoriesTitle": null, "changeMemberRole": null, "contentMenu": { + "muteGroup": null, + "unmuteGroup": null, "visitGroupPage": null }, "createNewGroup": { @@ -535,6 +537,7 @@ "confirmAddGroupMemberText": null, "confirmAddGroupMemberTitle": null }, + "muted": null, "myGroups": null, "name": null, "radius": null, @@ -559,6 +562,8 @@ "hidden": null, "public": null }, + "unmute": null, + "unmuted": null, "update": null, "updatedGroup": null }, diff --git a/webapp/locales/nl.json b/webapp/locales/nl.json index 2e183bdcc..433adf8e8 100644 --- a/webapp/locales/nl.json +++ b/webapp/locales/nl.json @@ -485,6 +485,8 @@ "categoriesTitle": null, "changeMemberRole": null, "contentMenu": { + "muteGroup": null, + "unmuteGroup": null, "visitGroupPage": null }, "createNewGroup": { @@ -535,6 +537,7 @@ "confirmAddGroupMemberText": null, "confirmAddGroupMemberTitle": null }, + "muted": null, "myGroups": null, "name": null, "radius": null, @@ -559,6 +562,8 @@ "hidden": null, "public": null }, + "unmute": null, + "unmuted": null, "update": null, "updatedGroup": null }, diff --git a/webapp/locales/pl.json b/webapp/locales/pl.json index 0624842fe..c0ab9d09c 100644 --- a/webapp/locales/pl.json +++ b/webapp/locales/pl.json @@ -485,6 +485,8 @@ "categoriesTitle": null, "changeMemberRole": null, "contentMenu": { + "muteGroup": null, + "unmuteGroup": null, "visitGroupPage": null }, "createNewGroup": { @@ -535,6 +537,7 @@ "confirmAddGroupMemberText": null, "confirmAddGroupMemberTitle": null }, + "muted": null, "myGroups": null, "name": null, "radius": null, @@ -559,6 +562,8 @@ "hidden": null, "public": null }, + "unmute": null, + "unmuted": null, "update": null, "updatedGroup": null }, diff --git a/webapp/locales/pt.json b/webapp/locales/pt.json index 0ab934e23..02f8fb2cc 100644 --- a/webapp/locales/pt.json +++ b/webapp/locales/pt.json @@ -485,6 +485,8 @@ "categoriesTitle": null, "changeMemberRole": null, "contentMenu": { + "muteGroup": null, + "unmuteGroup": null, "visitGroupPage": null }, "createNewGroup": { @@ -535,6 +537,7 @@ "confirmAddGroupMemberText": null, "confirmAddGroupMemberTitle": null }, + "muted": null, "myGroups": null, "name": null, "radius": null, @@ -559,6 +562,8 @@ "hidden": null, "public": null }, + "unmute": null, + "unmuted": null, "update": null, "updatedGroup": null }, diff --git a/webapp/locales/ru.json b/webapp/locales/ru.json index cf0d8ed62..ea0279450 100644 --- a/webapp/locales/ru.json +++ b/webapp/locales/ru.json @@ -485,6 +485,8 @@ "categoriesTitle": null, "changeMemberRole": null, "contentMenu": { + "muteGroup": null, + "unmuteGroup": null, "visitGroupPage": null }, "createNewGroup": { @@ -535,6 +537,7 @@ "confirmAddGroupMemberText": null, "confirmAddGroupMemberTitle": null }, + "muted": null, "myGroups": null, "name": null, "radius": null, @@ -559,6 +562,8 @@ "hidden": null, "public": null }, + "unmute": null, + "unmuted": null, "update": null, "updatedGroup": null }, diff --git a/webapp/pages/groups/_id/__snapshots__/_slug.spec.js.snap b/webapp/pages/groups/_id/__snapshots__/_slug.spec.js.snap new file mode 100644 index 000000000..cb43b8526 --- /dev/null +++ b/webapp/pages/groups/_id/__snapshots__/_slug.spec.js.snap @@ -0,0 +1,7845 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GroupProfileSlug given a puplic group – "yoga-practice" given a closed group – "school-for-citizens" given a current user as group owner – "peter-lustig" renders 1`] = ` +
+
+
+ +
+
+
+
+
+
+
+
+ + SFC + + + + + +
+ +
+
+ +
+
+
+
+
+
+ + + + + +
+
+ +
+
+
+
+ +
+

+ + School For Citizens + +

+ +

+ + &school-for-citizens + +

+ +

+ + + + + Paris + +

+ +

+ + group.foundation + +

+
+ +
+
+ +
+

+ + + + + 0 + + + + +

+

+ + group.membersCount + +

+
+
+
+
+ +
+ + + +
+ +
+ +
+

+ + group.role + +

+ +
+ + + group.roles.owner + + + +
+ +

+ + group.type + +

+ +
+ + + group.types.closed + + + +
+ +

+ + group.actionRadius + +

+ +
+ + + group.actionRadii.national + + + +
+ +
+
+ +
+ +
+

+ + group.categories + +

+ +
+ +
+
+ + + + + + contribution.category.name.children + + + +
+
+
+ + + + + + contribution.category.name.science + + + + +
+
+
+ +
+ +
+

+ + group.goal + +

+ +
+ +
+ + Our children shall receive education for life. + + +
+
+ + +
+ +
+ +

+ + profile.network.title + +

+ +
+
+ + group.membersListTitle + +
+ +
    +
  • +
    +
    + +
    + + PL + + + + + +
    +
    + +
    +
    + + + + @peter-lustig + + + + Peter Lustig + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + JR + + + + + +
    +
    + +
    +
    + + + + @jenny-rostock + + + + Jenny Rostock + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + BDB + + + + + +
    +
    + +
    +
    + + + + @bob-der-baumeister + + + + Bob der Baumeister + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + H + + + + + +
    +
    + +
    +
    + + + + @huey + + + + Huey + + + + + + + +
    + + +
    +
    +
    +
  • +
+ + + + + + +
+
+ +
+
+
+
+

+ + English + +

+

+ Our goal +

+

+ Only those who enjoy learning and do not lose their curiosity can obtain a good education for life and continue to learn with joy throughout their lives. +

+

+ Curiosity +

+

+ For this we need a school that takes up the curiosity of the children, … +

+
+ + + + +
+
+ +
+ + + +
+ +
+
+
+

+ Empty + +
+ + +

+
+
+
+ + +
+ + + + + + + +
+
+
+
+
+
+`; + +exports[`GroupProfileSlug given a puplic group – "yoga-practice" given a closed group – "school-for-citizens" given a current user as none(!) member – "huey" renders 1`] = ` +
+
+
+ +
+
+
+
+ + SFC + + + + + +
+ + + + + +
+

+ + School For Citizens + +

+ +

+ + &school-for-citizens + +

+ +

+ + + + + Paris + +

+ +

+ + group.foundation + +

+
+ + + +
+ + + +
+ +
+ +
+ + +

+ + group.type + +

+ +
+ + + group.types.closed + + + +
+ +

+ + group.actionRadius + +

+ +
+ + + group.actionRadii.national + + + +
+ +
+
+ +
+ +
+

+ + group.categories + +

+ +
+ +
+
+ + + + + + contribution.category.name.children + + + +
+
+
+ + + + + + contribution.category.name.science + + + + +
+
+
+ +
+ +
+

+ + group.goal + +

+ +
+ +
+ + Our children shall receive education for life. + + +
+
+ + +
+ +
+ +

+ + profile.network.title + +

+ +
+

+ group.membersListTitleNotAllowedSeeingGroupMembers +

+ + +
+
+ +
+
+
+
+

+ + English + +

+

+ Our goal +

+

+ Only those who enjoy learning and do not lose their curiosity can obtain a good education for life and continue to learn with joy throughout their lives. +

+

+ Curiosity +

+

+ For this we need a school that takes up the curiosity of the children, … +

+
+ + + + +
+
+ + + +
+
+
+

+ Empty + +
+ + +

+
+
+
+ + +
+ + + + + + + +
+
+
+
+
+
+`; + +exports[`GroupProfileSlug given a puplic group – "yoga-practice" given a closed group – "school-for-citizens" given a current user as pending member – "bob-der-baumeister" renders 1`] = ` +
+
+
+ +
+
+
+
+ + SFC + + + + + +
+ + + + + +
+

+ + School For Citizens + +

+ +

+ + &school-for-citizens + +

+ +

+ + + + + Paris + +

+ +

+ + group.foundation + +

+
+ + + +
+ + + +
+ +
+ +
+

+ + group.role + +

+ +
+ + + group.roles.pending + + + +
+ +

+ + group.type + +

+ +
+ + + group.types.closed + + + +
+ +

+ + group.actionRadius + +

+ +
+ + + group.actionRadii.national + + + +
+ +
+
+ +
+ +
+

+ + group.categories + +

+ +
+ +
+
+ + + + + + contribution.category.name.children + + + +
+
+
+ + + + + + contribution.category.name.science + + + + +
+
+
+ +
+ +
+

+ + group.goal + +

+ +
+ +
+ + Our children shall receive education for life. + + +
+
+ + +
+ +
+ +

+ + profile.network.title + +

+ +
+

+ group.membersListTitleNotAllowedSeeingGroupMembers +

+ + +
+
+ +
+
+
+
+

+ + English + +

+

+ Our goal +

+

+ Only those who enjoy learning and do not lose their curiosity can obtain a good education for life and continue to learn with joy throughout their lives. +

+

+ Curiosity +

+

+ For this we need a school that takes up the curiosity of the children, … +

+
+ + + + +
+
+ + + +
+
+
+

+ Empty + +
+ + +

+
+
+
+ + +
+ + + + + + + +
+
+
+
+
+
+`; + +exports[`GroupProfileSlug given a puplic group – "yoga-practice" given a closed group – "school-for-citizens" given a current user as usual member – "jenny-rostock" renders 1`] = ` +
+
+
+ +
+
+
+
+ + SFC + + + + + +
+ + + + + +
+
+ +
+
+
+
+ +
+

+ + School For Citizens + +

+ +

+ + &school-for-citizens + +

+ +

+ + + + + Paris + +

+ +

+ + group.foundation + +

+
+ +
+
+ +
+

+ + + + + 0 + + + + +

+

+ + group.membersCount + +

+
+
+
+
+ +
+ + + +
+ +
+ +
+

+ + group.role + +

+ +
+ + + group.roles.usual + + + +
+ +

+ + group.type + +

+ +
+ + + group.types.closed + + + +
+ +

+ + group.actionRadius + +

+ +
+ + + group.actionRadii.national + + + +
+ +
+
+ +
+ +
+

+ + group.categories + +

+ +
+ +
+
+ + + + + + contribution.category.name.children + + + +
+
+
+ + + + + + contribution.category.name.science + + + + +
+
+
+ +
+ +
+

+ + group.goal + +

+ +
+ +
+ + Our children shall receive education for life. + + +
+
+ + +
+ +
+ +

+ + profile.network.title + +

+ +
+
+ + group.membersListTitle + +
+ +
    +
  • +
    +
    + +
    + + PL + + + + + +
    +
    + +
    +
    + + + + @peter-lustig + + + + Peter Lustig + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + JR + + + + + +
    +
    + +
    +
    + + + + @jenny-rostock + + + + Jenny Rostock + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + BDB + + + + + +
    +
    + +
    +
    + + + + @bob-der-baumeister + + + + Bob der Baumeister + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + H + + + + + +
    +
    + +
    +
    + + + + @huey + + + + Huey + + + + + + + +
    + + +
    +
    +
    +
  • +
+ + + + + + +
+
+ +
+
+
+
+

+ + English + +

+

+ Our goal +

+

+ Only those who enjoy learning and do not lose their curiosity can obtain a good education for life and continue to learn with joy throughout their lives. +

+

+ Curiosity +

+

+ For this we need a school that takes up the curiosity of the children, … +

+
+ + + + +
+
+ +
+ + + +
+ +
+
+
+

+ Empty + +
+ + +

+
+
+
+ + +
+ + + + + + + +
+
+
+
+
+
+`; + +exports[`GroupProfileSlug given a puplic group – "yoga-practice" given a current user as group owner – "peter-lustig" renders 1`] = ` +
+
+
+ +
+
+
+
+
+
+
+
+ + YP + + + + + +
+ +
+
+ +
+
+
+
+
+
+ + + + + +
+
+ +
+
+
+
+ +
+

+ + Yoga Practice + +

+ +

+ + &yoga-practice + +

+ + + +

+ + group.foundation + +

+
+ +
+
+ +
+

+ + + + + 0 + + + + +

+

+ + group.membersCount + +

+
+
+
+
+ +
+ + + +
+ +
+ +
+

+ + group.role + +

+ +
+ + + group.roles.owner + + + +
+ +

+ + group.type + +

+ +
+ + + group.types.public + + + +
+ +

+ + group.actionRadius + +

+ +
+ + + group.actionRadii.interplanetary + + + +
+ +
+
+ +
+ +
+

+ + group.categories + +

+ +
+ +
+
+ + + + + + contribution.category.name.body-and-excercise + + + +
+
+
+ + + + + + contribution.category.name.psyche + + + +
+
+
+ + + + + + contribution.category.name.spirituality + + + + +
+
+
+ + + + +
+ +
+ +

+ + profile.network.title + +

+ +
+
+ + group.membersListTitle + +
+ +
    +
  • +
    +
    + +
    + + PL + + + + + +
    +
    + +
    +
    + + + + @peter-lustig + + + + Peter Lustig + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + JR + + + + + +
    +
    + +
    +
    + + + + @jenny-rostock + + + + Jenny Rostock + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + BDB + + + + + +
    +
    + +
    +
    + + + + @bob-der-baumeister + + + + Bob der Baumeister + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + H + + + + + +
    +
    + +
    +
    + + + + @huey + + + + Huey + + + + + + + +
    + + +
    +
    +
    +
  • +
+ + + + + + +
+
+ +
+
+
+
+

+ What Is yoga? +

+

+ Yoga is not just about practicing asanas. It's about how we do it. +

+

+ And practicing asanas doesn't have to be yoga, it can be more athletic than yogic. +

+

+ What makes practicing asanas yogic? +

+

+ The important thing is: +

+
    +
  • +

    + Use the exercises … +

    +
  • +
+
+ + + + +
+
+ +
+ + + +
+ +
+
+
+

+ Empty + +
+ + +

+
+
+
+ + +
+ + + + + + + +
+
+
+
+
+
+`; + +exports[`GroupProfileSlug given a puplic group – "yoga-practice" given a current user as none(!) member – "huey" renders 1`] = ` +
+
+
+ +
+
+
+
+ + YP + + + + + +
+ + + + + +
+

+ + Yoga Practice + +

+ +

+ + &yoga-practice + +

+ + + +

+ + group.foundation + +

+
+ +
+
+ +
+

+ + + + + 0 + + + + +

+

+ + group.membersCount + +

+
+
+
+
+ +
+ + + +
+ +
+ +
+ + +

+ + group.type + +

+ +
+ + + group.types.public + + + +
+ +

+ + group.actionRadius + +

+ +
+ + + group.actionRadii.interplanetary + + + +
+ +
+
+ +
+ +
+

+ + group.categories + +

+ +
+ +
+
+ + + + + + contribution.category.name.body-and-excercise + + + +
+
+
+ + + + + + contribution.category.name.psyche + + + +
+
+
+ + + + + + contribution.category.name.spirituality + + + + +
+
+
+ + + + +
+ +
+ +

+ + profile.network.title + +

+ +
+
+ + group.membersListTitle + +
+ +
    +
  • +
    +
    + +
    + + PL + + + + + +
    +
    + +
    +
    + + + + @peter-lustig + + + + Peter Lustig + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + JR + + + + + +
    +
    + +
    +
    + + + + @jenny-rostock + + + + Jenny Rostock + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + BDB + + + + + +
    +
    + +
    +
    + + + + @bob-der-baumeister + + + + Bob der Baumeister + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + H + + + + + +
    +
    + +
    +
    + + + + @huey + + + + Huey + + + + + + + +
    + + +
    +
    +
    +
  • +
+ + + + + + +
+
+ +
+
+
+
+

+ What Is yoga? +

+

+ Yoga is not just about practicing asanas. It's about how we do it. +

+

+ And practicing asanas doesn't have to be yoga, it can be more athletic than yogic. +

+

+ What makes practicing asanas yogic? +

+

+ The important thing is: +

+
    +
  • +

    + Use the exercises … +

    +
  • +
+
+ + + + +
+
+ + + +
+
+
+

+ Empty + +
+ + +

+
+
+
+ + +
+ + + + + + + +
+
+
+
+
+
+`; + +exports[`GroupProfileSlug given a puplic group – "yoga-practice" given a current user as pending member – "bob-der-baumeister" renders 1`] = ` +
+
+
+ +
+
+
+
+ + YP + + + + + +
+ + + + + +
+

+ + Yoga Practice + +

+ +

+ + &yoga-practice + +

+ + + +

+ + group.foundation + +

+
+ +
+
+ +
+

+ + + + + 0 + + + + +

+

+ + group.membersCount + +

+
+
+
+
+ +
+ + + +
+ +
+ +
+

+ + group.role + +

+ +
+ + + group.roles.pending + + + +
+ +

+ + group.type + +

+ +
+ + + group.types.public + + + +
+ +

+ + group.actionRadius + +

+ +
+ + + group.actionRadii.interplanetary + + + +
+ +
+
+ +
+ +
+

+ + group.categories + +

+ +
+ +
+
+ + + + + + contribution.category.name.body-and-excercise + + + +
+
+
+ + + + + + contribution.category.name.psyche + + + +
+
+
+ + + + + + contribution.category.name.spirituality + + + + +
+
+
+ + + + +
+ +
+ +

+ + profile.network.title + +

+ +
+
+ + group.membersListTitle + +
+ +
    +
  • +
    +
    + +
    + + PL + + + + + +
    +
    + +
    +
    + + + + @peter-lustig + + + + Peter Lustig + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + JR + + + + + +
    +
    + +
    +
    + + + + @jenny-rostock + + + + Jenny Rostock + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + BDB + + + + + +
    +
    + +
    +
    + + + + @bob-der-baumeister + + + + Bob der Baumeister + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + H + + + + + +
    +
    + +
    +
    + + + + @huey + + + + Huey + + + + + + + +
    + + +
    +
    +
    +
  • +
+ + + + + + +
+
+ +
+
+
+
+

+ What Is yoga? +

+

+ Yoga is not just about practicing asanas. It's about how we do it. +

+

+ And practicing asanas doesn't have to be yoga, it can be more athletic than yogic. +

+

+ What makes practicing asanas yogic? +

+

+ The important thing is: +

+
    +
  • +

    + Use the exercises … +

    +
  • +
+
+ + + + +
+
+ + + +
+
+
+

+ Empty + +
+ + +

+
+
+
+ + +
+ + + + + + + +
+
+
+
+
+
+`; + +exports[`GroupProfileSlug given a puplic group – "yoga-practice" given a current user as usual member – "jenny-rostock" renders 1`] = ` +
+
+
+ +
+
+
+
+ + YP + + + + + +
+ + + + + +
+
+ +
+
+
+
+ +
+

+ + Yoga Practice + +

+ +

+ + &yoga-practice + +

+ + + +

+ + group.foundation + +

+
+ +
+
+ +
+

+ + + + + 0 + + + + +

+

+ + group.membersCount + +

+
+
+
+
+ +
+ + + +
+ +
+ +
+

+ + group.role + +

+ +
+ + + group.roles.usual + + + +
+ +

+ + group.type + +

+ +
+ + + group.types.public + + + +
+ +

+ + group.actionRadius + +

+ +
+ + + group.actionRadii.interplanetary + + + +
+ +
+
+ +
+ +
+

+ + group.categories + +

+ +
+ +
+
+ + + + + + contribution.category.name.body-and-excercise + + + +
+
+
+ + + + + + contribution.category.name.psyche + + + +
+
+
+ + + + + + contribution.category.name.spirituality + + + + +
+
+
+ + + + +
+ +
+ +

+ + profile.network.title + +

+ +
+
+ + group.membersListTitle + +
+ +
    +
  • +
    +
    + +
    + + PL + + + + + +
    +
    + +
    +
    + + + + @peter-lustig + + + + Peter Lustig + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + JR + + + + + +
    +
    + +
    +
    + + + + @jenny-rostock + + + + Jenny Rostock + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + BDB + + + + + +
    +
    + +
    +
    + + + + @bob-der-baumeister + + + + Bob der Baumeister + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + H + + + + + +
    +
    + +
    +
    + + + + @huey + + + + Huey + + + + + + + +
    + + +
    +
    +
    +
  • +
+ + + + + + +
+
+ +
+
+
+
+

+ What Is yoga? +

+

+ Yoga is not just about practicing asanas. It's about how we do it. +

+

+ And practicing asanas doesn't have to be yoga, it can be more athletic than yogic. +

+

+ What makes practicing asanas yogic? +

+

+ The important thing is: +

+
    +
  • +

    + Use the exercises … +

    +
  • +
+
+ + + + +
+
+ +
+ + + +
+ +
+
+
+

+ Empty + +
+ + +

+
+
+
+ + +
+ + + + + + + +
+
+
+
+
+
+`; + +exports[`GroupProfileSlug given a puplic group – "yoga-practice" given a hidden group – "investigative-journalism" given a current user as group owner – "peter-lustig" renders 1`] = ` +
+
+
+ +
+
+
+
+
+
+
+
+ + IJ + + + + + +
+ +
+
+ +
+
+
+
+
+
+ + + + + +
+
+ +
+
+
+
+ +
+

+ + Investigative Journalism + +

+ +

+ + &investigative-journalism + +

+ +

+ + + + + Hamburg + +

+ +

+ + group.foundation + +

+
+ +
+
+ +
+

+ + + + + 0 + + + + +

+

+ + group.membersCount + +

+
+
+
+
+ +
+ + + +
+ +
+ +
+

+ + group.role + +

+ +
+ + + group.roles.owner + + + +
+ +

+ + group.type + +

+ +
+ + + group.types.hidden + + + +
+ +

+ + group.actionRadius + +

+ +
+ + + group.actionRadii.global + + + +
+ +
+
+ +
+ +
+

+ + group.categories + +

+ +
+ +
+
+ + + + + + contribution.category.name.it-and-media + + + +
+
+
+ + + + + + contribution.category.name.law + + + +
+
+
+ + + + + + contribution.category.name.politics + + + + +
+
+
+ +
+ +
+

+ + group.goal + +

+ +
+ +
+ + Investigative journalists share ideas and insights and can collaborate. + + +
+
+ + +
+ +
+ +

+ + profile.network.title + +

+ +
+
+ + group.membersListTitle + +
+ +
    +
  • +
    +
    + +
    + + PL + + + + + +
    +
    + +
    +
    + + + + @peter-lustig + + + + Peter Lustig + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + JR + + + + + +
    +
    + +
    +
    + + + + @jenny-rostock + + + + Jenny Rostock + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + BDB + + + + + +
    +
    + +
    +
    + + + + @bob-der-baumeister + + + + Bob der Baumeister + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + H + + + + + +
    +
    + +
    +
    + + + + @huey + + + + Huey + + + + + + + +
    + + +
    +
    +
    +
  • +
+ + + + + + +
+
+ +
+
+
+
+

+ + English: + +

+

+ This group is hidden. +

+

+ What is our group for? +

+

+ This group was created to allow investigative journalists to share and collaborate. +

+

+ How does it work? +

+

+ Here you can internally share posts and comments about them. +

+

+
+

+

+ + Deutsch: + +

+

+ Diese Gruppe ist verborgen. +

+

+ … +

+
+ + + + +
+
+ +
+ + + +
+ +
+
+
+

+ Empty + +
+ + +

+
+
+
+ + +
+ + + + + + + +
+
+
+
+
+
+`; + +exports[`GroupProfileSlug given a puplic group – "yoga-practice" given a hidden group – "investigative-journalism" given a current user as none(!) member – "huey" renders 1`] = ` +
+ +
+`; + +exports[`GroupProfileSlug given a puplic group – "yoga-practice" given a hidden group – "investigative-journalism" given a current user as pending member – "bob-der-baumeister" renders 1`] = ` +
+ +
+`; + +exports[`GroupProfileSlug given a puplic group – "yoga-practice" given a hidden group – "investigative-journalism" given a current user as usual member – "jenny-rostock" renders 1`] = ` +
+
+
+ +
+
+
+
+ + IJ + + + + + +
+ + + + + +
+
+ +
+
+
+
+ +
+

+ + Investigative Journalism + +

+ +

+ + &investigative-journalism + +

+ +

+ + + + + Hamburg + +

+ +

+ + group.foundation + +

+
+ +
+
+ +
+

+ + + + + 0 + + + + +

+

+ + group.membersCount + +

+
+
+
+
+ +
+ + + +
+ +
+ +
+

+ + group.role + +

+ +
+ + + group.roles.usual + + + +
+ +

+ + group.type + +

+ +
+ + + group.types.hidden + + + +
+ +

+ + group.actionRadius + +

+ +
+ + + group.actionRadii.global + + + +
+ +
+
+ +
+ +
+

+ + group.categories + +

+ +
+ +
+
+ + + + + + contribution.category.name.it-and-media + + + +
+
+
+ + + + + + contribution.category.name.law + + + +
+
+
+ + + + + + contribution.category.name.politics + + + + +
+
+
+ +
+ +
+

+ + group.goal + +

+ +
+ +
+ + Investigative journalists share ideas and insights and can collaborate. + + +
+
+ + +
+ +
+ +

+ + profile.network.title + +

+ +
+
+ + group.membersListTitle + +
+ +
    +
  • +
    +
    + +
    + + PL + + + + + +
    +
    + +
    +
    + + + + @peter-lustig + + + + Peter Lustig + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + JR + + + + + +
    +
    + +
    +
    + + + + @jenny-rostock + + + + Jenny Rostock + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + BDB + + + + + +
    +
    + +
    +
    + + + + @bob-der-baumeister + + + + Bob der Baumeister + + + + + + + +
    + + +
    +
    +
    +
  • +
  • +
    +
    + +
    + + H + + + + + +
    +
    + +
    +
    + + + + @huey + + + + Huey + + + + + + + +
    + + +
    +
    +
    +
  • +
+ + + + + + +
+
+ +
+
+
+
+

+ + English: + +

+

+ This group is hidden. +

+

+ What is our group for? +

+

+ This group was created to allow investigative journalists to share and collaborate. +

+

+ How does it work? +

+

+ Here you can internally share posts and comments about them. +

+

+
+

+

+ + Deutsch: + +

+

+ Diese Gruppe ist verborgen. +

+

+ … +

+
+ + + + +
+
+ +
+ + + +
+ +
+
+
+

+ Empty + +
+ + +

+
+
+
+ + +
+ + + + + + + +
+
+
+
+
+
+`; diff --git a/webapp/pages/groups/_id/_slug.spec.js b/webapp/pages/groups/_id/_slug.spec.js index bb9279bce..2fb9fc37c 100644 --- a/webapp/pages/groups/_id/_slug.spec.js +++ b/webapp/pages/groups/_id/_slug.spec.js @@ -1,5 +1,5 @@ -import { mount } from '@vue/test-utils' import GroupProfileSlug from './_slug.vue' +import { render, screen, fireEvent } from '@testing-library/vue' const localVue = global.localVue @@ -10,13 +10,19 @@ const stubs = { 'v-popover': true, 'nuxt-link': true, 'router-link': true, - 'infinite-loading': true, + // 'infinite-loading': true, 'follow-list': true, } +// Mock Math.random, used in Dropdown +Object.assign(Math, { + random: () => 0, +}) + +jest.mock('vue-infinite-loading', () => ({})) + describe('GroupProfileSlug', () => { let wrapper - let Wrapper let mocks let yogaPractice let schoolForCitizens @@ -95,6 +101,7 @@ describe('GroupProfileSlug', () => { ], locationName: null, location: null, + isMutedByMe: false, // myRole: 'usual', } schoolForCitizens = { @@ -128,6 +135,7 @@ describe('GroupProfileSlug', () => { nameDE: 'Paris', nameEN: 'Paris', }, + isMutedByMe: true, // myRole: 'usual', } investigativeJournalism = { @@ -170,6 +178,7 @@ describe('GroupProfileSlug', () => { nameDE: 'Hamburg', nameEN: 'Hamburg', }, + isMutedByMe: false, // myRole: 'usual', } peterLustig = { @@ -198,508 +207,137 @@ describe('GroupProfileSlug', () => { } }) - describe('mount', () => { - Wrapper = (data = () => {}) => { - return mount(GroupProfileSlug, { - mocks, - localVue, - data, - stubs, + const Wrapper = (data = () => {}) => { + return render(GroupProfileSlug, { + mocks, + localVue, + data, + stubs, + }) + } + + describe('given a puplic group – "yoga-practice"', () => { + describe('given a current user', () => { + describe('as group owner – "peter-lustig"', () => { + beforeEach(() => { + mocks.$store = { + getters: { + 'auth/user': peterLustig, + 'auth/isModerator': () => false, + }, + } + wrapper = Wrapper(() => { + return { + Group: [ + { + ...yogaPractice, + myRole: 'owner', + }, + ], + GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], + } + }) + }) + + it('renders', () => { + expect(wrapper.container).toMatchSnapshot() + }) + + describe('after "show more" click displays full description', () => { + beforeEach(async () => { + const button = screen.getByText('comment.show.more') + await fireEvent.click(button) + // await wrapper.container.vm.$nextTick() + }) + + it('has full description', () => { + // test if end of full description is visible + expect( + screen.queryByText('Use the exercises (consciously) for your personal development.'), + ).not.toBeNull() + }) + + it('has "show less" button', () => { + expect(screen.queryByText('comment.show.less')).not.toBeNull() + }) + }) }) - } - describe('given a puplic group – "yoga-practice"', () => { - describe('given a current user', () => { - describe('as group owner – "peter-lustig"', () => { - beforeEach(() => { - mocks.$store = { - getters: { - 'auth/user': peterLustig, - 'auth/isModerator': () => false, - }, + describe('as usual member – "jenny-rostock"', () => { + beforeEach(() => { + mocks.$store = { + getters: { + 'auth/user': jennyRostock, + 'auth/isModerator': () => false, + }, + } + wrapper = Wrapper(() => { + return { + Group: [ + { + ...yogaPractice, + myRole: 'usual', + }, + ], + GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], } - wrapper = Wrapper(() => { - return { - Group: [ - { - ...yogaPractice, - myRole: 'owner', - }, - ], - GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], - } - }) - }) - - it('has group name – to verificate the group', () => { - expect(wrapper.text()).toContain('Yoga Practice') - }) - - it('has AvatarUploader', () => { - expect(wrapper.find('.avatar-uploader').exists()).toBe(true) - }) - - it('has ProfileAvatar', () => { - expect(wrapper.find('.profile-avatar').exists()).toBe(true) - }) - - it('has GroupContentMenu', () => { - expect(wrapper.find('.group-content-menu').exists()).toBe(true) - }) - - it('has group slug', () => { - // expect(wrapper.find('[data-test="ampersand"]').exists()).toBe(true) - expect(wrapper.text()).toContain('&yoga-practice') - }) - - describe('displays no(!) group location – because is "null"', () => { - it('has no(!) group location icon "map-marker"', () => { - expect(wrapper.find('[data-test="map-marker"]').exists()).toBe(false) - }) - }) - - it('has group foundation', () => { - expect(wrapper.text()).toContain('group.foundation') - }) - - it('has members count', () => { - expect(wrapper.text()).toContain('group.membersCount') - }) - - it('has join/leave button disabled(!)', () => { - expect(wrapper.find('.join-leave-button').exists()).toBe(true) - expect(wrapper.find('.join-leave-button').attributes('disabled')).toBe('disabled') - }) - - it('has group role "owner"', () => { - expect(wrapper.text()).toContain('group.role') - expect(wrapper.text()).toContain('group.roles.owner') - }) - - it('has group type "public"', () => { - expect(wrapper.text()).toContain('group.type') - expect(wrapper.text()).toContain('group.types.public') - }) - - it('has group action radius "interplanetary"', () => { - expect(wrapper.text()).toContain('group.actionRadius') - expect(wrapper.text()).toContain('group.actionRadii.interplanetary') - }) - - it('has group categories "psyche", "body-and-excercise", "spirituality"', () => { - expect(wrapper.text()).toContain('group.categories') - expect(wrapper.text()).toContain('contribution.category.name.psyche') - expect(wrapper.text()).toContain('contribution.category.name.body-and-excercise') - expect(wrapper.text()).toContain('contribution.category.name.spirituality') - }) - - it('has no(!) group goal – because is "null"', () => { - expect(wrapper.text()).not.toContain('group.goal') - }) - - it('has ProfileList with members', () => { - const profileList = wrapper.find('.profile-list') - expect(profileList.exists()).toBe(true) - expect(profileList.text()).toContain('group.membersListTitle') - expect(profileList.text()).not.toContain( - 'group.membersListTitleNotAllowedSeeingGroupMembers', - ) - expect(profileList.text()).toContain('Peter Lustig') - expect(profileList.text()).toContain('Jenny Rostock') - expect(profileList.text()).toContain('Bob der Baumeister') - expect(profileList.text()).toContain('Huey') - }) - - describe('displays description – here as well the functionallity', () => { - let groupDescriptionBaseCard - - beforeEach(async () => { - groupDescriptionBaseCard = wrapper.find('.group-description') - }) - - it('has description BaseCard', () => { - expect(groupDescriptionBaseCard.exists()).toBe(true) - }) - - describe('displays descriptionExcerpt first', () => { - it('has descriptionExcerpt', () => { - expect(groupDescriptionBaseCard.text()).toContain( - `What Is yoga?Yoga is not just about practicing asanas. It's about how we do it.And practicing asanas doesn't have to be yoga, it can be more athletic than yogic.What makes practicing asanas yogic?The important thing is:Use the exercises …`, - ) - }) - - it('has "show more" button', () => { - expect(wrapper.vm.isDescriptionCollapsed).toBe(true) - expect(groupDescriptionBaseCard.text()).toContain('comment.show.more') - }) - }) - - describe('after "show more" click displays full description', () => { - beforeEach(async () => { - await groupDescriptionBaseCard.find('.collaps-button').trigger('click') - await wrapper.vm.$nextTick() - }) - - it('has full description', () => { - // test if end of full description is visible - expect(groupDescriptionBaseCard.text()).toContain( - `Use the exercises (consciously) for your personal development.`, - ) - }) - - it('has "show less" button', () => { - expect(wrapper.vm.isDescriptionCollapsed).toBe(false) - expect(groupDescriptionBaseCard.text()).toContain('comment.show.less') - }) - }) - }) - - it('has profile post add button', () => { - expect(wrapper.find('.profile-post-add-button').exists()).toBe(true) - }) - - it('has empty post list', () => { - expect(wrapper.find('[data-test="icon-empty"]').exists()).toBe(true) }) }) - describe('as usual member – "jenny-rostock"', () => { - beforeEach(() => { - mocks.$store = { - getters: { - 'auth/user': jennyRostock, - 'auth/isModerator': () => false, - }, + it('renders', () => { + expect(wrapper.container).toMatchSnapshot() + }) + }) + + describe('as pending member – "bob-der-baumeister"', () => { + beforeEach(() => { + mocks.$store = { + getters: { + 'auth/user': bobDerBaumeister, + 'auth/isModerator': () => false, + }, + } + wrapper = Wrapper(() => { + return { + Group: [ + { + ...yogaPractice, + myRole: 'pending', + }, + ], + GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], } - wrapper = Wrapper(() => { - return { - Group: [ - { - ...yogaPractice, - myRole: 'usual', - }, - ], - GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], - } - }) - }) - - it('has group name – to verificate the group', () => { - expect(wrapper.text()).toContain('Yoga Practice') - }) - - it('has not(!) AvatarUploader', () => { - expect(wrapper.find('.avatar-uploader').exists()).toBe(false) - }) - - it('has ProfileAvatar', () => { - expect(wrapper.find('.profile-avatar').exists()).toBe(true) - }) - - it('has not(!) GroupContentMenu', () => { - expect(wrapper.find('.group-content-menu').exists()).toBe(false) - }) - - it('has group slug', () => { - // expect(wrapper.find('[data-test="ampersand"]').exists()).toBe(true) - expect(wrapper.text()).toContain('&yoga-practice') - }) - - describe('displays no(!) group location – because is "null"', () => { - it('has no(!) group location icon "map-marker"', () => { - expect(wrapper.find('[data-test="map-marker"]').exists()).toBe(false) - }) - }) - - it('has group foundation', () => { - expect(wrapper.text()).toContain('group.foundation') - }) - - it('has members count', () => { - expect(wrapper.text()).toContain('group.membersCount') - }) - - it('has join/leave button enabled', () => { - expect(wrapper.find('.join-leave-button').exists()).toBe(true) - expect(wrapper.find('.join-leave-button').attributes('disabled')).toBeFalsy() - }) - - it('has group role "usual"', () => { - expect(wrapper.text()).toContain('group.role') - expect(wrapper.text()).toContain('group.roles.usual') - }) - - it('has group type "public"', () => { - expect(wrapper.text()).toContain('group.type') - expect(wrapper.text()).toContain('group.types.public') - }) - - it('has group action radius "interplanetary"', () => { - expect(wrapper.text()).toContain('group.actionRadius') - expect(wrapper.text()).toContain('group.actionRadii.interplanetary') - }) - - it('has group categories "psyche", "body-and-excercise", "spirituality"', () => { - expect(wrapper.text()).toContain('group.categories') - expect(wrapper.text()).toContain('contribution.category.name.psyche') - expect(wrapper.text()).toContain('contribution.category.name.body-and-excercise') - expect(wrapper.text()).toContain('contribution.category.name.spirituality') - }) - - it('has no(!) group goal – because is "null"', () => { - expect(wrapper.text()).not.toContain('group.goal') - }) - - it('has ProfileList with members', () => { - const profileList = wrapper.find('.profile-list') - expect(profileList.exists()).toBe(true) - expect(profileList.text()).toContain('group.membersListTitle') - expect(profileList.text()).not.toContain( - 'group.membersListTitleNotAllowedSeeingGroupMembers', - ) - expect(profileList.text()).toContain('Peter Lustig') - expect(profileList.text()).toContain('Jenny Rostock') - expect(profileList.text()).toContain('Bob der Baumeister') - expect(profileList.text()).toContain('Huey') - }) - - it('has description BaseCard', () => { - expect(wrapper.find('.group-description').exists()).toBe(true) - }) - - it('has profile post add button', () => { - expect(wrapper.find('.profile-post-add-button').exists()).toBe(true) - }) - - it('has empty post list', () => { - expect(wrapper.find('[data-test="icon-empty"]').exists()).toBe(true) }) }) - describe('as pending member – "bob-der-baumeister"', () => { - beforeEach(() => { - mocks.$store = { - getters: { - 'auth/user': bobDerBaumeister, - 'auth/isModerator': () => false, - }, + it('renders', () => { + expect(wrapper.container).toMatchSnapshot() + }) + }) + + describe('as none(!) member – "huey"', () => { + beforeEach(() => { + mocks.$store = { + getters: { + 'auth/user': huey, + 'auth/isModerator': () => false, + }, + } + wrapper = Wrapper(() => { + return { + Group: [ + { + ...yogaPractice, + myRole: null, + }, + ], + GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], } - wrapper = Wrapper(() => { - return { - Group: [ - { - ...yogaPractice, - myRole: 'pending', - }, - ], - GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], - } - }) - }) - - it('has group name – to verificate the group', () => { - expect(wrapper.text()).toContain('Yoga Practice') - }) - - it('has not(!) AvatarUploader', () => { - expect(wrapper.find('.avatar-uploader').exists()).toBe(false) - }) - - it('has ProfileAvatar', () => { - expect(wrapper.find('.profile-avatar').exists()).toBe(true) - }) - - it('has not(!) GroupContentMenu', () => { - expect(wrapper.find('.group-content-menu').exists()).toBe(false) - }) - - it('has group slug', () => { - // expect(wrapper.find('[data-test="ampersand"]').exists()).toBe(true) - expect(wrapper.text()).toContain('&yoga-practice') - }) - - describe('displays no(!) group location – because is "null"', () => { - it('has no(!) group location icon "map-marker"', () => { - expect(wrapper.find('[data-test="map-marker"]').exists()).toBe(false) - }) - }) - - it('has group foundation', () => { - expect(wrapper.text()).toContain('group.foundation') - }) - - it('has members count', () => { - expect(wrapper.text()).toContain('group.membersCount') - }) - - it('has join/leave button enabled', () => { - expect(wrapper.find('.join-leave-button').exists()).toBe(true) - expect(wrapper.find('.join-leave-button').attributes('disabled')).toBeFalsy() - }) - - it('has group role "pending"', () => { - expect(wrapper.text()).toContain('group.role') - expect(wrapper.text()).toContain('group.roles.pending') - }) - - it('has group type "public"', () => { - expect(wrapper.text()).toContain('group.type') - expect(wrapper.text()).toContain('group.types.public') - }) - - it('has group action radius "interplanetary"', () => { - expect(wrapper.text()).toContain('group.actionRadius') - expect(wrapper.text()).toContain('group.actionRadii.interplanetary') - }) - - it('has group categories "psyche", "body-and-excercise", "spirituality"', () => { - expect(wrapper.text()).toContain('group.categories') - expect(wrapper.text()).toContain('contribution.category.name.psyche') - expect(wrapper.text()).toContain('contribution.category.name.body-and-excercise') - expect(wrapper.text()).toContain('contribution.category.name.spirituality') - }) - - it('has no(!) group goal – because is "null"', () => { - expect(wrapper.text()).not.toContain('group.goal') - }) - - it('has ProfileList with members', () => { - const profileList = wrapper.find('.profile-list') - expect(profileList.exists()).toBe(true) - expect(profileList.text()).toContain('group.membersListTitle') - expect(profileList.text()).not.toContain( - 'group.membersListTitleNotAllowedSeeingGroupMembers', - ) - expect(profileList.text()).toContain('Peter Lustig') - expect(profileList.text()).toContain('Jenny Rostock') - expect(profileList.text()).toContain('Bob der Baumeister') - expect(profileList.text()).toContain('Huey') - }) - - it('has description BaseCard', () => { - expect(wrapper.find('.group-description').exists()).toBe(true) - }) - - it('has no(!) profile post add button', () => { - expect(wrapper.find('.profile-post-add-button').exists()).toBe(false) - }) - - it('has empty post list', () => { - expect(wrapper.find('[data-test="icon-empty"]').exists()).toBe(true) }) }) - describe('as none(!) member – "huey"', () => { - beforeEach(() => { - mocks.$store = { - getters: { - 'auth/user': huey, - 'auth/isModerator': () => false, - }, - } - wrapper = Wrapper(() => { - return { - Group: [ - { - ...yogaPractice, - myRole: null, - }, - ], - GroupMembers: [peterLustig, jennyRostock, bobDerBaumeister, huey], - } - }) - }) - - it('has group name – to verificate the group', () => { - expect(wrapper.text()).toContain('Yoga Practice') - }) - - it('has not(!) AvatarUploader', () => { - expect(wrapper.find('.avatar-uploader').exists()).toBe(false) - }) - - it('has ProfileAvatar', () => { - expect(wrapper.find('.profile-avatar').exists()).toBe(true) - }) - - it('has not(!) GroupContentMenu', () => { - expect(wrapper.find('.group-content-menu').exists()).toBe(false) - }) - - it('has group slug', () => { - // expect(wrapper.find('[data-test="ampersand"]').exists()).toBe(true) - expect(wrapper.text()).toContain('&yoga-practice') - }) - - describe('displays no(!) group location – because is "null"', () => { - it('has no(!) group location icon "map-marker"', () => { - expect(wrapper.find('[data-test="map-marker"]').exists()).toBe(false) - }) - }) - - it('has group foundation', () => { - expect(wrapper.text()).toContain('group.foundation') - }) - - it('has members count', () => { - expect(wrapper.text()).toContain('group.membersCount') - }) - - it('has join/leave button enabled', () => { - expect(wrapper.find('.join-leave-button').exists()).toBe(true) - expect(wrapper.find('.join-leave-button').attributes('disabled')).toBeFalsy() - }) - - it('has no(!) group role', () => { - expect(wrapper.text()).not.toContain('group.role') - expect(wrapper.text()).not.toContain('group.roles') - }) - - it('has group type "public"', () => { - expect(wrapper.text()).toContain('group.type') - expect(wrapper.text()).toContain('group.types.public') - }) - - it('has group action radius "interplanetary"', () => { - expect(wrapper.text()).toContain('group.actionRadius') - expect(wrapper.text()).toContain('group.actionRadii.interplanetary') - }) - - it('has group categories "psyche", "body-and-excercise", "spirituality"', () => { - expect(wrapper.text()).toContain('group.categories') - expect(wrapper.text()).toContain('contribution.category.name.psyche') - expect(wrapper.text()).toContain('contribution.category.name.body-and-excercise') - expect(wrapper.text()).toContain('contribution.category.name.spirituality') - }) - - it('has no(!) group goal – because is "null"', () => { - expect(wrapper.text()).not.toContain('group.goal') - }) - - it('has ProfileList with members', () => { - const profileList = wrapper.find('.profile-list') - expect(profileList.exists()).toBe(true) - expect(profileList.text()).toContain('group.membersListTitle') - expect(profileList.text()).not.toContain( - 'group.membersListTitleNotAllowedSeeingGroupMembers', - ) - expect(profileList.text()).toContain('Peter Lustig') - expect(profileList.text()).toContain('Jenny Rostock') - expect(profileList.text()).toContain('Bob der Baumeister') - expect(profileList.text()).toContain('Huey') - }) - - it('has description BaseCard', () => { - expect(wrapper.find('.group-description').exists()).toBe(true) - }) - - it('has no(!) profile post add button', () => { - expect(wrapper.find('.profile-post-add-button').exists()).toBe(false) - }) - - it('has empty post list', () => { - expect(wrapper.find('[data-test="icon-empty"]').exists()).toBe(true) - }) + it('renders', () => { + expect(wrapper.container).toMatchSnapshot() }) }) }) @@ -727,99 +365,8 @@ describe('GroupProfileSlug', () => { }) }) - it('has group name – to verificate the group', () => { - expect(wrapper.text()).toContain('School For Citizens') - }) - - it('has AvatarUploader', () => { - expect(wrapper.find('.avatar-uploader').exists()).toBe(true) - }) - - it('has ProfileAvatar', () => { - expect(wrapper.find('.profile-avatar').exists()).toBe(true) - }) - - it('has GroupContentMenu', () => { - expect(wrapper.find('.group-content-menu').exists()).toBe(true) - }) - - it('has group slug', () => { - // expect(wrapper.find('[data-test="ampersand"]').exists()).toBe(true) - expect(wrapper.text()).toContain('&school-for-citizens') - }) - - describe('displays group location', () => { - it('has group location icon "map-marker"', () => { - expect(wrapper.find('[data-test="map-marker"]').exists()).toBe(true) - }) - - it('has group location name "Paris"', () => { - expect(wrapper.text()).toContain('Paris') - }) - }) - - it('has group foundation', () => { - expect(wrapper.text()).toContain('group.foundation') - }) - - it('has members count', () => { - expect(wrapper.text()).toContain('group.membersCount') - }) - - it('has join/leave button disabled(!)', () => { - expect(wrapper.find('.join-leave-button').exists()).toBe(true) - expect(wrapper.find('.join-leave-button').attributes('disabled')).toBe('disabled') - }) - - it('has group role "owner"', () => { - expect(wrapper.text()).toContain('group.role') - expect(wrapper.text()).toContain('group.roles.owner') - }) - - it('has group type "closed"', () => { - expect(wrapper.text()).toContain('group.type') - expect(wrapper.text()).toContain('group.types.closed') - }) - - it('has group action radius "national"', () => { - expect(wrapper.text()).toContain('group.actionRadius') - expect(wrapper.text()).toContain('group.actionRadii.national') - }) - - it('has group categories "children", "science"', () => { - expect(wrapper.text()).toContain('group.categories') - expect(wrapper.text()).toContain('contribution.category.name.children') - expect(wrapper.text()).toContain('contribution.category.name.science') - }) - - it('has group goal', () => { - expect(wrapper.text()).toContain('group.goal') - expect(wrapper.text()).toContain('Our children shall receive education for life.') - }) - - it('has ProfileList with members', () => { - const profileList = wrapper.find('.profile-list') - expect(profileList.exists()).toBe(true) - expect(profileList.text()).toContain('group.membersListTitle') - expect(profileList.text()).not.toContain( - 'group.membersListTitleNotAllowedSeeingGroupMembers', - ) - expect(profileList.text()).toContain('Peter Lustig') - expect(profileList.text()).toContain('Jenny Rostock') - expect(profileList.text()).toContain('Bob der Baumeister') - expect(profileList.text()).toContain('Huey') - }) - - it('has description BaseCard', () => { - expect(wrapper.find('.group-description').exists()).toBe(true) - }) - - it('has profile post add button', () => { - expect(wrapper.find('.profile-post-add-button').exists()).toBe(true) - }) - - it('has empty post list', () => { - expect(wrapper.find('[data-test="icon-empty"]').exists()).toBe(true) + it('renders', () => { + expect(wrapper.container).toMatchSnapshot() }) }) @@ -844,99 +391,31 @@ describe('GroupProfileSlug', () => { }) }) - it('has group name – to verificate the group', () => { - expect(wrapper.text()).toContain('School For Citizens') + it('renders', () => { + expect(wrapper.container).toMatchSnapshot() }) - it('has not(!) AvatarUploader', () => { - expect(wrapper.find('.avatar-uploader').exists()).toBe(false) - }) - - it('has ProfileAvatar', () => { - expect(wrapper.find('.profile-avatar').exists()).toBe(true) - }) - - it('has not(!) GroupContentMenu', () => { - expect(wrapper.find('.group-content-menu').exists()).toBe(false) - }) - - it('has group slug', () => { - // expect(wrapper.find('[data-test="ampersand"]').exists()).toBe(true) - expect(wrapper.text()).toContain('&school-for-citizens') - }) - - describe('displays group location', () => { - it('has group location icon "map-marker"', () => { - expect(wrapper.find('[data-test="map-marker"]').exists()).toBe(true) + describe('clicking unmute button with valid server answer', () => { + beforeEach(async () => { + const button = screen.getByText('group.unmute') + await fireEvent.click(button) }) - it('has group location name "Paris"', () => { - expect(wrapper.text()).toContain('Paris') + it('shows a success message', () => { + expect(mocks.$toast.success).toHaveBeenCalledWith('group.unmuted') }) }) - it('has group foundation', () => { - expect(wrapper.text()).toContain('group.foundation') - }) + describe('clicking unmute button with server error', () => { + beforeEach(async () => { + mocks.$apollo.mutate = jest.fn().mockRejectedValue({ message: 'Ouch!' }) + const button = screen.getByText('group.unmute') + await fireEvent.click(button) + }) - it('has members count', () => { - expect(wrapper.text()).toContain('group.membersCount') - }) - - it('has join/leave button enabled', () => { - expect(wrapper.find('.join-leave-button').exists()).toBe(true) - expect(wrapper.find('.join-leave-button').attributes('disabled')).toBeFalsy() - }) - - it('has group role "usual"', () => { - expect(wrapper.text()).toContain('group.role') - expect(wrapper.text()).toContain('group.roles.usual') - }) - - it('has group type "closed"', () => { - expect(wrapper.text()).toContain('group.type') - expect(wrapper.text()).toContain('group.types.closed') - }) - - it('has group action radius "national"', () => { - expect(wrapper.text()).toContain('group.actionRadius') - expect(wrapper.text()).toContain('group.actionRadii.national') - }) - - it('has group categories "children", "science"', () => { - expect(wrapper.text()).toContain('group.categories') - expect(wrapper.text()).toContain('contribution.category.name.children') - expect(wrapper.text()).toContain('contribution.category.name.science') - }) - - it('has group goal', () => { - expect(wrapper.text()).toContain('group.goal') - expect(wrapper.text()).toContain('Our children shall receive education for life.') - }) - - it('has ProfileList with members', () => { - const profileList = wrapper.find('.profile-list') - expect(profileList.exists()).toBe(true) - expect(profileList.text()).toContain('group.membersListTitle') - expect(profileList.text()).not.toContain( - 'group.membersListTitleNotAllowedSeeingGroupMembers', - ) - expect(profileList.text()).toContain('Peter Lustig') - expect(profileList.text()).toContain('Jenny Rostock') - expect(profileList.text()).toContain('Bob der Baumeister') - expect(profileList.text()).toContain('Huey') - }) - - it('has description BaseCard', () => { - expect(wrapper.find('.group-description').exists()).toBe(true) - }) - - it('has profile post add button', () => { - expect(wrapper.find('.profile-post-add-button').exists()).toBe(true) - }) - - it('has empty post list', () => { - expect(wrapper.find('[data-test="icon-empty"]').exists()).toBe(true) + it('shows error message', async () => { + expect(mocks.$toast.error).toHaveBeenCalledWith('Ouch!') + }) }) }) @@ -961,99 +440,8 @@ describe('GroupProfileSlug', () => { }) }) - it('has group name – to verificate the group', () => { - expect(wrapper.text()).toContain('School For Citizens') - }) - - it('has not(!) AvatarUploader', () => { - expect(wrapper.find('.avatar-uploader').exists()).toBe(false) - }) - - it('has ProfileAvatar', () => { - expect(wrapper.find('.profile-avatar').exists()).toBe(true) - }) - - it('has not(!) GroupContentMenu', () => { - expect(wrapper.find('.group-content-menu').exists()).toBe(false) - }) - - it('has group slug', () => { - // expect(wrapper.find('[data-test="ampersand"]').exists()).toBe(true) - expect(wrapper.text()).toContain('&school-for-citizens') - }) - - describe('displays group location', () => { - it('has group location icon "map-marker"', () => { - expect(wrapper.find('[data-test="map-marker"]').exists()).toBe(true) - }) - - it('has group location name "Paris"', () => { - expect(wrapper.text()).toContain('Paris') - }) - }) - - it('has group foundation', () => { - expect(wrapper.text()).toContain('group.foundation') - }) - - it('has no(!) members count', () => { - expect(wrapper.text()).not.toContain('group.membersCount') - }) - - it('has join/leave button enabled', () => { - expect(wrapper.find('.join-leave-button').exists()).toBe(true) - expect(wrapper.find('.join-leave-button').attributes('disabled')).toBeFalsy() - }) - - it('has group role "pending"', () => { - expect(wrapper.text()).toContain('group.role') - expect(wrapper.text()).toContain('group.roles.pending') - }) - - it('has group type "closed"', () => { - expect(wrapper.text()).toContain('group.type') - expect(wrapper.text()).toContain('group.types.closed') - }) - - it('has group action radius "national"', () => { - expect(wrapper.text()).toContain('group.actionRadius') - expect(wrapper.text()).toContain('group.actionRadii.national') - }) - - it('has group categories "children", "science"', () => { - expect(wrapper.text()).toContain('group.categories') - expect(wrapper.text()).toContain('contribution.category.name.children') - expect(wrapper.text()).toContain('contribution.category.name.science') - }) - - it('has group goal', () => { - expect(wrapper.text()).toContain('group.goal') - expect(wrapper.text()).toContain('Our children shall receive education for life.') - }) - - it('has ProfileList without(!) members', () => { - const profileList = wrapper.find('.profile-list') - expect(profileList.exists()).toBe(true) - // expect(profileList.text()).not.toContain('group.membersListTitle') // does not work, because is part of 'group.membersListTitleNotAllowedSeeingGroupMembers' - expect(profileList.text()).toContain( - 'group.membersListTitleNotAllowedSeeingGroupMembers', - ) - expect(profileList.text()).not.toContain('Peter Lustig') - expect(profileList.text()).not.toContain('Jenny Rostock') - expect(profileList.text()).not.toContain('Bob der Baumeister') - expect(profileList.text()).not.toContain('Huey') - }) - - it('has description BaseCard', () => { - expect(wrapper.find('.group-description').exists()).toBe(true) - }) - - it('has no(!) profile post add button', () => { - expect(wrapper.find('.profile-post-add-button').exists()).toBe(false) - }) - - it('has empty post list', () => { - expect(wrapper.find('[data-test="icon-empty"]').exists()).toBe(true) + it('renders', () => { + expect(wrapper.container).toMatchSnapshot() }) }) @@ -1078,99 +466,8 @@ describe('GroupProfileSlug', () => { }) }) - it('has group name – to verificate the group', () => { - expect(wrapper.text()).toContain('School For Citizens') - }) - - it('has not(!) AvatarUploader', () => { - expect(wrapper.find('.avatar-uploader').exists()).toBe(false) - }) - - it('has ProfileAvatar', () => { - expect(wrapper.find('.profile-avatar').exists()).toBe(true) - }) - - it('has not(!) GroupContentMenu', () => { - expect(wrapper.find('.group-content-menu').exists()).toBe(false) - }) - - it('has group slug', () => { - // expect(wrapper.find('[data-test="ampersand"]').exists()).toBe(true) - expect(wrapper.text()).toContain('&school-for-citizens') - }) - - describe('displays group location', () => { - it('has group location icon "map-marker"', () => { - expect(wrapper.find('[data-test="map-marker"]').exists()).toBe(true) - }) - - it('has group location name "Paris"', () => { - expect(wrapper.text()).toContain('Paris') - }) - }) - - it('has group foundation', () => { - expect(wrapper.text()).toContain('group.foundation') - }) - - it('has no(!) members count', () => { - expect(wrapper.text()).not.toContain('group.membersCount') - }) - - it('has join/leave button enabled', () => { - expect(wrapper.find('.join-leave-button').exists()).toBe(true) - expect(wrapper.find('.join-leave-button').attributes('disabled')).toBeFalsy() - }) - - it('has no(!) group role', () => { - expect(wrapper.text()).not.toContain('group.role') - expect(wrapper.text()).not.toContain('group.roles') - }) - - it('has group type "closed"', () => { - expect(wrapper.text()).toContain('group.type') - expect(wrapper.text()).toContain('group.types.closed') - }) - - it('has group action radius "national"', () => { - expect(wrapper.text()).toContain('group.actionRadius') - expect(wrapper.text()).toContain('group.actionRadii.national') - }) - - it('has group categories "children", "science"', () => { - expect(wrapper.text()).toContain('group.categories') - expect(wrapper.text()).toContain('contribution.category.name.children') - expect(wrapper.text()).toContain('contribution.category.name.science') - }) - - it('has group goal', () => { - expect(wrapper.text()).toContain('group.goal') - expect(wrapper.text()).toContain('Our children shall receive education for life.') - }) - - it('has ProfileList without(!) members', () => { - const profileList = wrapper.find('.profile-list') - expect(profileList.exists()).toBe(true) - // expect(profileList.text()).not.toContain('group.membersListTitle') // does not work, because is part of 'group.membersListTitleNotAllowedSeeingGroupMembers' - expect(profileList.text()).toContain( - 'group.membersListTitleNotAllowedSeeingGroupMembers', - ) - expect(profileList.text()).not.toContain('Peter Lustig') - expect(profileList.text()).not.toContain('Jenny Rostock') - expect(profileList.text()).not.toContain('Bob der Baumeister') - expect(profileList.text()).not.toContain('Huey') - }) - - it('has description BaseCard', () => { - expect(wrapper.find('.group-description').exists()).toBe(true) - }) - - it('has no(!) profile post add button', () => { - expect(wrapper.find('.profile-post-add-button').exists()).toBe(false) - }) - - it('has empty post list', () => { - expect(wrapper.find('[data-test="icon-empty"]').exists()).toBe(true) + it('renders', () => { + expect(wrapper.container).toMatchSnapshot() }) }) }) @@ -1199,102 +496,8 @@ describe('GroupProfileSlug', () => { }) }) - it('has group name – to verificate the group', () => { - expect(wrapper.text()).toContain('Investigative Journalism') - }) - - it('has AvatarUploader', () => { - expect(wrapper.find('.avatar-uploader').exists()).toBe(true) - }) - - it('has ProfileAvatar', () => { - expect(wrapper.find('.profile-avatar').exists()).toBe(true) - }) - - it('has GroupContentMenu', () => { - expect(wrapper.find('.group-content-menu').exists()).toBe(true) - }) - - it('has group slug', () => { - // expect(wrapper.find('[data-test="ampersand"]').exists()).toBe(true) - expect(wrapper.text()).toContain('&investigative-journalism') - }) - - describe('displays group location', () => { - it('has group location icon "map-marker"', () => { - expect(wrapper.find('[data-test="map-marker"]').exists()).toBe(true) - }) - - it('has group location name "Hamburg"', () => { - expect(wrapper.text()).toContain('Hamburg') - }) - }) - - it('has group foundation', () => { - expect(wrapper.text()).toContain('group.foundation') - }) - - it('has members count', () => { - expect(wrapper.text()).toContain('group.membersCount') - }) - - it('has join/leave button disabled(!)', () => { - expect(wrapper.find('.join-leave-button').exists()).toBe(true) - expect(wrapper.find('.join-leave-button').attributes('disabled')).toBe('disabled') - }) - - it('has group role "owner"', () => { - expect(wrapper.text()).toContain('group.role') - expect(wrapper.text()).toContain('group.roles.owner') - }) - - it('has group type "hidden"', () => { - expect(wrapper.text()).toContain('group.type') - expect(wrapper.text()).toContain('group.types.hidden') - }) - - it('has group action radius "global"', () => { - expect(wrapper.text()).toContain('group.actionRadius') - expect(wrapper.text()).toContain('group.actionRadii.global') - }) - - it('has group categories "law", "politics", "it-and-media"', () => { - expect(wrapper.text()).toContain('group.categories') - expect(wrapper.text()).toContain('contribution.category.name.law') - expect(wrapper.text()).toContain('contribution.category.name.politics') - expect(wrapper.text()).toContain('contribution.category.name.it-and-media') - }) - - it('has group goal', () => { - expect(wrapper.text()).toContain('group.goal') - expect(wrapper.text()).toContain( - 'Investigative journalists share ideas and insights and can collaborate.', - ) - }) - - it('has ProfileList with members', () => { - const profileList = wrapper.find('.profile-list') - expect(profileList.exists()).toBe(true) - expect(profileList.text()).toContain('group.membersListTitle') - expect(profileList.text()).not.toContain( - 'group.membersListTitleNotAllowedSeeingGroupMembers', - ) - expect(profileList.text()).toContain('Peter Lustig') - expect(profileList.text()).toContain('Jenny Rostock') - expect(profileList.text()).toContain('Bob der Baumeister') - expect(profileList.text()).toContain('Huey') - }) - - it('has description BaseCard', () => { - expect(wrapper.find('.group-description').exists()).toBe(true) - }) - - it('has profile post add button', () => { - expect(wrapper.find('.profile-post-add-button').exists()).toBe(true) - }) - - it('has empty post list', () => { - expect(wrapper.find('[data-test="icon-empty"]').exists()).toBe(true) + it('renders', () => { + expect(wrapper.container).toMatchSnapshot() }) }) @@ -1319,102 +522,8 @@ describe('GroupProfileSlug', () => { }) }) - it('has group name – to verificate the group', () => { - expect(wrapper.text()).toContain('Investigative Journalism') - }) - - it('has not(!) AvatarUploader', () => { - expect(wrapper.find('.avatar-uploader').exists()).toBe(false) - }) - - it('has ProfileAvatar', () => { - expect(wrapper.find('.profile-avatar').exists()).toBe(true) - }) - - it('has not(!) GroupContentMenu', () => { - expect(wrapper.find('.group-content-menu').exists()).toBe(false) - }) - - it('has group slug', () => { - // expect(wrapper.find('[data-test="ampersand"]').exists()).toBe(true) - expect(wrapper.text()).toContain('&investigative-journalism') - }) - - describe('displays group location', () => { - it('has group location icon "map-marker"', () => { - expect(wrapper.find('[data-test="map-marker"]').exists()).toBe(true) - }) - - it('has group location name "Hamburg"', () => { - expect(wrapper.text()).toContain('Hamburg') - }) - }) - - it('has group foundation', () => { - expect(wrapper.text()).toContain('group.foundation') - }) - - it('has members count', () => { - expect(wrapper.text()).toContain('group.membersCount') - }) - - it('has join/leave button enabled', () => { - expect(wrapper.find('.join-leave-button').exists()).toBe(true) - expect(wrapper.find('.join-leave-button').attributes('disabled')).toBeFalsy() - }) - - it('has group role "usual"', () => { - expect(wrapper.text()).toContain('group.role') - expect(wrapper.text()).toContain('group.roles.usual') - }) - - it('has group type "hidden"', () => { - expect(wrapper.text()).toContain('group.type') - expect(wrapper.text()).toContain('group.types.hidden') - }) - - it('has group action radius "global"', () => { - expect(wrapper.text()).toContain('group.actionRadius') - expect(wrapper.text()).toContain('group.actionRadii.global') - }) - - it('has group categories "law", "politics", "it-and-media"', () => { - expect(wrapper.text()).toContain('group.categories') - expect(wrapper.text()).toContain('contribution.category.name.law') - expect(wrapper.text()).toContain('contribution.category.name.politics') - expect(wrapper.text()).toContain('contribution.category.name.it-and-media') - }) - - it('has group goal', () => { - expect(wrapper.text()).toContain('group.goal') - expect(wrapper.text()).toContain( - 'Investigative journalists share ideas and insights and can collaborate.', - ) - }) - - it('has ProfileList with members', () => { - const profileList = wrapper.find('.profile-list') - expect(profileList.exists()).toBe(true) - expect(profileList.text()).toContain('group.membersListTitle') - expect(profileList.text()).not.toContain( - 'group.membersListTitleNotAllowedSeeingGroupMembers', - ) - expect(profileList.text()).toContain('Peter Lustig') - expect(profileList.text()).toContain('Jenny Rostock') - expect(profileList.text()).toContain('Bob der Baumeister') - expect(profileList.text()).toContain('Huey') - }) - - it('has description BaseCard', () => { - expect(wrapper.find('.group-description').exists()).toBe(true) - }) - - it('has profile post add button', () => { - expect(wrapper.find('.profile-post-add-button').exists()).toBe(true) - }) - - it('has empty post list', () => { - expect(wrapper.find('[data-test="icon-empty"]').exists()).toBe(true) + it('renders', () => { + expect(wrapper.container).toMatchSnapshot() }) }) @@ -1439,90 +548,8 @@ describe('GroupProfileSlug', () => { }) }) - it('has no(!) group name – to verificate the group', () => { - expect(wrapper.text()).not.toContain('Investigative Journalism') - }) - - it('has not(!) AvatarUploader', () => { - expect(wrapper.find('.avatar-uploader').exists()).toBe(false) - }) - - it('has not(!) ProfileAvatar', () => { - expect(wrapper.find('.profile-avatar').exists()).toBe(false) - }) - - it('has not(!) GroupContentMenu', () => { - expect(wrapper.find('.group-content-menu').exists()).toBe(false) - }) - - it('has no(!) group slug', () => { - // expect(wrapper.find('[data-test="ampersand"]').exists()).toBe(false) - expect(wrapper.text()).not.toContain('&investigative-journalism') - }) - - describe('displays not(!) group location', () => { - it('has no(!) group location icon "map-marker"', () => { - expect(wrapper.find('[data-test="map-marker"]').exists()).toBe(false) - }) - - it('has no(!) group location name "Hamburg"', () => { - expect(wrapper.text()).not.toContain('Hamburg') - }) - }) - - it('has no(!) group foundation', () => { - expect(wrapper.text()).not.toContain('group.foundation') - }) - - it('has no(!) members count', () => { - expect(wrapper.text()).not.toContain('group.membersCount') - }) - - it('has no(!) join/leave button', () => { - expect(wrapper.find('.join-leave-button').exists()).toBe(false) - }) - - it('has no(!) group role', () => { - expect(wrapper.text()).not.toContain('group.role') - expect(wrapper.text()).not.toContain('group.roles') - }) - - it('has no(!) group type', () => { - expect(wrapper.text()).not.toContain('group.type') - expect(wrapper.text()).not.toContain('group.types') - }) - - it('has no(!) group action radius', () => { - expect(wrapper.text()).not.toContain('group.actionRadius') - expect(wrapper.text()).not.toContain('group.actionRadii') - }) - - it('has no(!) group categories "law", "politics", "it-and-media"', () => { - expect(wrapper.text()).not.toContain('group.categories') - expect(wrapper.text()).not.toContain('contribution.category.name.law') - expect(wrapper.text()).not.toContain('contribution.category.name.politics') - expect(wrapper.text()).not.toContain('contribution.category.name.it-and-media') - }) - - it('has no(!) group goal', () => { - expect(wrapper.text()).not.toContain('group.goal') - }) - - it('has not(!) ProfileList', () => { - const profileList = wrapper.find('.profile-list') - expect(profileList.exists()).toBe(false) - }) - - it('has not(!) description BaseCard', () => { - expect(wrapper.find('.group-description').exists()).toBe(false) - }) - - it('has no(!) profile post add button', () => { - expect(wrapper.find('.profile-post-add-button').exists()).toBe(false) - }) - - it('has no(!) empty post list', () => { - expect(wrapper.find('[data-test="icon-empty"]').exists()).toBe(false) + it('renders', () => { + expect(wrapper.container).toMatchSnapshot() }) }) @@ -1547,90 +574,8 @@ describe('GroupProfileSlug', () => { }) }) - it('has no(!) group name – to verificate the group', () => { - expect(wrapper.text()).not.toContain('Investigative Journalism') - }) - - it('has not(!) AvatarUploader', () => { - expect(wrapper.find('.avatar-uploader').exists()).toBe(false) - }) - - it('has not(!) ProfileAvatar', () => { - expect(wrapper.find('.profile-avatar').exists()).toBe(false) - }) - - it('has not(!) GroupContentMenu', () => { - expect(wrapper.find('.group-content-menu').exists()).toBe(false) - }) - - it('has no(!) group slug', () => { - // expect(wrapper.find('[data-test="ampersand"]').exists()).toBe(false) - expect(wrapper.text()).not.toContain('&investigative-journalism') - }) - - describe('displays not(!) group location', () => { - it('has no(!) group location icon "map-marker"', () => { - expect(wrapper.find('[data-test="map-marker"]').exists()).toBe(false) - }) - - it('has no(!) group location name "Hamburg"', () => { - expect(wrapper.text()).not.toContain('Hamburg') - }) - }) - - it('has no(!) group foundation', () => { - expect(wrapper.text()).not.toContain('group.foundation') - }) - - it('has no(!) members count', () => { - expect(wrapper.text()).not.toContain('group.membersCount') - }) - - it('has no(!) join/leave button', () => { - expect(wrapper.find('.join-leave-button').exists()).toBe(false) - }) - - it('has no(!) group role', () => { - expect(wrapper.text()).not.toContain('group.role') - expect(wrapper.text()).not.toContain('group.roles') - }) - - it('has no(!) group type', () => { - expect(wrapper.text()).not.toContain('group.type') - expect(wrapper.text()).not.toContain('group.types') - }) - - it('has no(!) group action radius', () => { - expect(wrapper.text()).not.toContain('group.actionRadius') - expect(wrapper.text()).not.toContain('group.actionRadii') - }) - - it('has no(!) group categories "law", "politics", "it-and-media"', () => { - expect(wrapper.text()).not.toContain('group.categories') - expect(wrapper.text()).not.toContain('contribution.category.name.law') - expect(wrapper.text()).not.toContain('contribution.category.name.politics') - expect(wrapper.text()).not.toContain('contribution.category.name.it-and-media') - }) - - it('has no(!) group goal', () => { - expect(wrapper.text()).not.toContain('group.goal') - }) - - it('has not(!) ProfileList', () => { - const profileList = wrapper.find('.profile-list') - expect(profileList.exists()).toBe(false) - }) - - it('has not(!) description BaseCard', () => { - expect(wrapper.find('.group-description').exists()).toBe(false) - }) - - it('has no(!) profile post add button', () => { - expect(wrapper.find('.profile-post-add-button').exists()).toBe(false) - }) - - it('has no(!) empty post list', () => { - expect(wrapper.find('[data-test="icon-empty"]').exists()).toBe(false) + it('renders', () => { + expect(wrapper.container).toMatchSnapshot() }) }) }) diff --git a/webapp/pages/groups/_id/_slug.vue b/webapp/pages/groups/_id/_slug.vue index 10d2ca8d2..9061f047e 100644 --- a/webapp/pages/groups/_id/_slug.vue +++ b/webapp/pages/groups/_id/_slug.vue @@ -18,18 +18,14 @@ - - @@ -84,19 +80,9 @@ -->
- + + {{ $t('group.unmute') }} + -

@@ -314,8 +298,7 @@ import uniqBy from 'lodash/uniqBy' import { profilePagePosts } from '~/graphql/PostQuery' import { updateGroupMutation, groupQuery, groupMembersQuery } from '~/graphql/groups' -// import { muteUser, unmuteUser } from '~/graphql/settings/MutedUsers' -// import { blockUser, unblockUser } from '~/graphql/settings/BlockedUsers' +import { muteGroup, unmuteGroup } from '~/graphql/settings/MutedGroups' import UpdateQuery from '~/components/utils/UpdateQuery' import postListActions from '~/mixins/postListActions' import AvatarUploader from '~/components/Uploader/AvatarUploader' @@ -470,6 +453,32 @@ export default { // this.resetPostList() // } // }, + async muteGroup() { + try { + await this.$apollo.mutate({ + mutation: muteGroup(), + variables: { + groupId: this.group.id, + }, + }) + this.$toast.success(this.$t('group.muted')) + } catch (error) { + this.$toast.error(error.message) + } + }, + async unmuteGroup() { + try { + await this.$apollo.mutate({ + mutation: unmuteGroup(), + variables: { + groupId: this.group.id, + }, + }) + this.$toast.success(this.$t('group.unmuted')) + } catch (error) { + this.$toast.error(error.message) + } + }, uniq(items, field = 'id') { return uniqBy(items, field) },