Merge remote-tracking branch 'upstream/develop' into themes-accent
* upstream/develop: (33 commits) add emoji reactions to changelog fix emoji reaction classes broken in develop review changes Fix password and email update remove unnecessary anonymous function Apply suggestion to src/services/api/api.service.js remove logs/commented code remove favs count from react button remove mock data change emoji reactions to use new format Added polyfills for EventTarget (needed for Safari) and CustomEvent (needed for IE) Fix missing TWKN when logged in, but server is set to private mode. Fix follower request fetching Add domain mutes to changelog Implement domain mutes v2 change changelog to reflect actual release history of frontend Fix #750 , fix error messages and captcha resetting Optimize Notifications Rendering update CHANGELOG Use last seen notif instead of first unseen notif for sinceId ...
This commit is contained in:
commit
f0c4bb1193
49 changed files with 840 additions and 104 deletions
|
@ -241,6 +241,51 @@ describe('Statuses module', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('emojiReactions', () => {
|
||||
it('increments count in existing reaction', () => {
|
||||
const state = defaultState()
|
||||
const status = makeMockStatus({ id: '1' })
|
||||
status.emoji_reactions = [ { emoji: '😂', count: 1, accounts: [] } ]
|
||||
|
||||
mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' })
|
||||
mutations.addOwnReaction(state, { id: '1', emoji: '😂', currentUser: { id: 'me' } })
|
||||
expect(state.allStatusesObject['1'].emoji_reactions[0].count).to.eql(2)
|
||||
expect(state.allStatusesObject['1'].emoji_reactions[0].accounts[0].id).to.eql('me')
|
||||
})
|
||||
|
||||
it('adds a new reaction', () => {
|
||||
const state = defaultState()
|
||||
const status = makeMockStatus({ id: '1' })
|
||||
status.emoji_reactions = []
|
||||
|
||||
mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' })
|
||||
mutations.addOwnReaction(state, { id: '1', emoji: '😂', currentUser: { id: 'me' } })
|
||||
expect(state.allStatusesObject['1'].emoji_reactions[0].count).to.eql(1)
|
||||
expect(state.allStatusesObject['1'].emoji_reactions[0].accounts[0].id).to.eql('me')
|
||||
})
|
||||
|
||||
it('decreases count in existing reaction', () => {
|
||||
const state = defaultState()
|
||||
const status = makeMockStatus({ id: '1' })
|
||||
status.emoji_reactions = [ { emoji: '😂', count: 2, accounts: [{ id: 'me' }] } ]
|
||||
|
||||
mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' })
|
||||
mutations.removeOwnReaction(state, { id: '1', emoji: '😂', currentUser: {} })
|
||||
expect(state.allStatusesObject['1'].emoji_reactions[0].count).to.eql(1)
|
||||
expect(state.allStatusesObject['1'].emoji_reactions[0].accounts).to.eql([])
|
||||
})
|
||||
|
||||
it('removes a reaction', () => {
|
||||
const state = defaultState()
|
||||
const status = makeMockStatus({ id: '1' })
|
||||
status.emoji_reactions = [{ emoji: '😂', count: 1, accounts: [{ id: 'me' }] }]
|
||||
|
||||
mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' })
|
||||
mutations.removeOwnReaction(state, { id: '1', emoji: '😂', currentUser: {} })
|
||||
expect(state.allStatusesObject['1'].emoji_reactions.length).to.eql(0)
|
||||
})
|
||||
})
|
||||
|
||||
describe('showNewStatuses', () => {
|
||||
it('resets the minId to the min of the visible statuses when adding new to visible statuses', () => {
|
||||
const state = defaultState()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as NotificationUtils from 'src/services/notification_utils/notification_utils.js'
|
||||
|
||||
describe('NotificationUtils', () => {
|
||||
describe('visibleNotificationsFromStore', () => {
|
||||
describe('filteredNotificationsFromStore', () => {
|
||||
it('should return sorted notifications with configured types', () => {
|
||||
const store = {
|
||||
state: {
|
||||
|
@ -47,7 +47,7 @@ describe('NotificationUtils', () => {
|
|||
type: 'like'
|
||||
}
|
||||
]
|
||||
expect(NotificationUtils.visibleNotificationsFromStore(store)).to.eql(expected)
|
||||
expect(NotificationUtils.filteredNotificationsFromStore(store)).to.eql(expected)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue