it('calls TOGGLE_EMOTION when clicked', () => { const wrapper = Wrapper() happyEmotionButton = wrapper.findAll('.emotion-button > .base-button').at(1) happyEmotionButton.trigger('click') expect(mutations['posts/TOGGLE_EMOTION']).toHaveBeenCalledWith({}, 'happy') getters['posts/filteredByEmotions'] = jest.fn(() => ['happy']) const wrapper = Wrapper() happyEmotionButton = wrapper.findAll('.emotion-button > .base-button').at(1) const happyEmotionButtonImage = happyEmotionButton.find('img') expect(happyEmotionButtonImage.attributes().src).toEqual('/img/svg/emoji/happy_color.svg')
.findAll('.ds-menu-item') .filter((item) => item.text() === 'settings.name') .at(0) .find('span.ds-menu-item-link') .attributes('to'), .findAll('.ds-menu-item') .filter((item) => item.text() === 'settings.muted-users.mute') .at(0) .trigger('click') expect(wrapper.emitted('mute')).toEqual([ .findAll('.ds-menu-item') .filter((item) => item.text() === 'settings.muted-users.unmute') .at(0) .trigger('click') expect(wrapper.emitted('unmute')).toEqual([
allLink = wrapper .findAll('.dropdown-menu-item') .at(propsData.filterOptions.findIndex((option) => option.label === 'All')) }) const readLink = wrapper .findAll('.dropdown-menu-item') .at(propsData.filterOptions.findIndex((option) => option.label === 'Read')) expect(readLink.text()).toEqual('Read') }) const unreadLink = wrapper .findAll('.dropdown-menu-item') .at(propsData.filterOptions.findIndex((option) => option.label === 'Unread')) expect(unreadLink.text()).toEqual('Unread') })
.findAll('.ds-menu-item') .filter((item) => item.text() === 'report.contribution.title') .at(0) .trigger('click') expect(openModalSpy).toHaveBeenCalledWith('report') .findAll('.ds-menu-item') .filter((item) => item.text() === 'report.comment.title') .at(0) .trigger('click') expect(openModalSpy).toHaveBeenCalledWith('report') .findAll('.ds-menu-item') .filter((item) => item.text() === 'report.user.title') .at(0) .trigger('click') expect(openModalSpy).toHaveBeenCalledWith('report') .findAll('.ds-menu-item') .filter((item) => item.text() === 'report.organization.title') .at(0) .trigger('click') expect(openModalSpy).toHaveBeenCalledWith('report')
getters['posts/filteredCategoryIds'] = jest.fn(() => ['cat9']) wrapper = await Wrapper() democracyAndPoliticsButton = wrapper.findAll('.categories-filter .item .base-button').at(2) expect(democracyAndPoliticsButton.attributes().class).toContain('--filled') }) environmentAndNatureButton = wrapper.findAll('.categories-filter .item .base-button').at(0) environmentAndNatureButton.trigger('click') expect(mutations['posts/TOGGLE_CATEGORY']).toHaveBeenCalledWith({}, 'cat4')
spanishButton = wrapper .findAll('.languages-filter .item .base-button') .at(languages.findIndex((l) => l.code === 'es')) expect(spanishButton.attributes().class).toContain('--filled') }) englishButton = wrapper .findAll('.languages-filter .item .base-button') .at(languages.findIndex((l) => l.code === 'en')) englishButton.trigger('click') expect(mutations['posts/TOGGLE_LANGUAGE']).toHaveBeenCalledWith({}, 'en')
.findAll('.ds-menu-item') .filter((item) => item.text() === 'post.menu.pin') .at(0) .trigger('click') expect(wrapper.emitted('pinPost')).toEqual([ .findAll('.ds-menu-item') .filter((item) => item.text() === 'post.menu.unpin') .at(0) .trigger('click') expect(wrapper.emitted('unpinPost')).toEqual([ .findAll('.ds-menu-item') .filter((item) => item.text() === 'settings.deleteUserAccount.name') .at(0) .trigger('click') expect(wrapper.emitted('delete')).toEqual([
.findAll('.ds-menu-item') .filter((item) => item.text() === 'disable.contribution.title') .at(0) .trigger('click') expect(openModalSpy).toHaveBeenCalledWith('disable') .findAll('.ds-menu-item') .filter((item) => item.text() === 'disable.comment.title') .at(0) .trigger('click') expect(openModalSpy).toHaveBeenCalledWith('disable') .findAll('.ds-menu-item') .filter((item) => item.text() === 'disable.user.title') .at(0) .trigger('click') expect(openModalSpy).toHaveBeenCalledWith('disable') .findAll('.ds-menu-item') .filter((item) => item.text() === 'disable.organization.title') .at(0) .trigger('click') expect(openModalSpy).toHaveBeenCalledWith('disable') .findAll('.ds-menu-item') .filter((item) => item.text() === 'release.contribution.title') .at(0) .trigger('click') expect(openModalSpy).toHaveBeenCalledWith('release')