This commit is contained in:
Henry Jameson 2026-07-31 17:02:38 +03:00
commit b477bcbdf5
3 changed files with 19 additions and 14 deletions

View file

@ -183,6 +183,7 @@ const Chat = {
},
async replyStatus(newVal) {
await nextTick() // wait for changes to propagate to postStatusForm
if (this.testMode) return
this.$refs.postStatusForm.update()
},
$route: async function (newVal) {
@ -246,12 +247,13 @@ const Chat = {
if (!isNewMessage) return
if (!this.testMode)
if (!this.testMode) {
await readChat({
id: this.chat.id,
lastReadId,
credentials: useOAuthStore().token,
})
}
useChatsStore().readChat(this.chat.id)
this.lastReadMessageId = this.maxId

View file

@ -37,8 +37,8 @@ describe('routes', () => {
const matchedComponents = router.currentRoute.value.matched
expect(matchedComponents[0].components.default.name).to.eql(
'AsyncComponentWrapper',
expect(matchedComponents[0].components.default.__file).to.contain(
'user_profile.vue',
)
})
@ -47,8 +47,8 @@ describe('routes', () => {
const matchedComponents = router.currentRoute.value.matched
expect(matchedComponents[0].components.default.name).to.eql(
'AsyncComponentWrapper',
expect(matchedComponents[0].components.default.__file).to.contain(
'user_profile.vue',
)
})
@ -56,9 +56,8 @@ describe('routes', () => {
await router.push('/lists')
const matchedComponents = router.currentRoute.value.matched
expect(matchedComponents[0].components.default.name).to.eql(
'AsyncComponentWrapper',
expect(matchedComponents[0].components.default.__file).to.contain(
'lists.vue',
)
})
@ -67,8 +66,8 @@ describe('routes', () => {
const matchedComponents = router.currentRoute.value.matched
expect(matchedComponents[0].components.default.name).to.eql(
'AsyncComponentWrapper',
expect(matchedComponents[0].components.default.__file).to.contain(
'lists_timeline.vue',
)
})
@ -77,8 +76,8 @@ describe('routes', () => {
const matchedComponents = router.currentRoute.value.matched
expect(matchedComponents[0].components.default.name).to.eql(
'AsyncComponentWrapper',
expect(matchedComponents[0].components.default.__file).to.contain(
'lists_edit.vue',
)
})
})

View file

@ -33,6 +33,10 @@ const global = {
state: {
api: {},
users: {},
statuses: {
allStatusesObject: {
},
},
},
},
$route: {
@ -69,7 +73,7 @@ describe('ChatView methods', () => {
expect(component.vm.messages.length).to.eql(2)
})
it('Updates minId and lastMessage and newMessageCount', () => {
it('Updates minId and lastMessage and newMessageCount', async () => {
component.vm.addMessages({ messages: [message1] })
expect(component.vm.maxId).to.eql(message1.id)
expect(component.vm.minId).to.eql(message1.id)
@ -80,7 +84,7 @@ describe('ChatView methods', () => {
expect(component.vm.minId).to.eql(message1.id)
expect(component.vm.newMessageCount).to.eql(2)
component.vm.readChat()
await component.vm.readChat()
expect(component.vm.newMessageCount).to.eql(0)
expect(component.vm.lastReadMessageId).to.eql(message2.id)