Fix thread view

This commit is contained in:
Eric Bailey
2023-12-05 14:14:03 -06:00
parent 60c72e8f15
commit 3f3765c067
2 changed files with 16 additions and 8 deletions
+8 -6
View File
@@ -1,5 +1,7 @@
/* eslint-env detox/detox */ /* eslint-env detox/detox */
import {describe, beforeAll, it} from '@jest/globals'
import {expect} from 'detox'
import {openApp, loginAsAlice, createServer} from '../util' import {openApp, loginAsAlice, createServer} from '../util'
describe('Thread screen', () => { describe('Thread screen', () => {
@@ -31,15 +33,15 @@ describe('Thread screen', () => {
it('Can like the root post', async () => { it('Can like the root post', async () => {
const post = by.id('postThreadItem-by-bob.test') const post = by.id('postThreadItem-by-bob.test')
await expect( await expect(
element(by.id('likeCount').withAncestor(post)).atIndex(0), element(by.id('likeCount-expanded').withAncestor(post)).atIndex(0),
).not.toExist() ).not.toExist()
await element(by.id('likeBtn').withAncestor(post)).atIndex(0).tap() await element(by.id('likeBtn').withAncestor(post)).atIndex(0).tap()
await expect( await expect(
element(by.id('likeCount').withAncestor(post)).atIndex(0), element(by.id('likeCount-expanded').withAncestor(post)).atIndex(0),
).toHaveText('1 like') ).toHaveText('1 like')
await element(by.id('likeBtn').withAncestor(post)).atIndex(0).tap() await element(by.id('likeBtn').withAncestor(post)).atIndex(0).tap()
await expect( await expect(
element(by.id('likeCount').withAncestor(post)).atIndex(0), element(by.id('likeCount-expanded').withAncestor(post)).atIndex(0),
).not.toExist() ).not.toExist()
}) })
@@ -61,21 +63,21 @@ describe('Thread screen', () => {
it('Can repost the root post', async () => { it('Can repost the root post', async () => {
const post = by.id('postThreadItem-by-bob.test') const post = by.id('postThreadItem-by-bob.test')
await expect( await expect(
element(by.id('repostCount').withAncestor(post)).atIndex(0), element(by.id('repostCount-expanded').withAncestor(post)).atIndex(0),
).not.toExist() ).not.toExist()
await element(by.id('repostBtn').withAncestor(post)).atIndex(0).tap() await element(by.id('repostBtn').withAncestor(post)).atIndex(0).tap()
await expect(element(by.id('repostModal'))).toBeVisible() await expect(element(by.id('repostModal'))).toBeVisible()
await element(by.id('repostBtn').withAncestor(by.id('repostModal'))).tap() await element(by.id('repostBtn').withAncestor(by.id('repostModal'))).tap()
await expect(element(by.id('repostModal'))).not.toBeVisible() await expect(element(by.id('repostModal'))).not.toBeVisible()
await expect( await expect(
element(by.id('repostCount').withAncestor(post)).atIndex(0), element(by.id('repostCount-expanded').withAncestor(post)).atIndex(0),
).toHaveText('1 repost') ).toHaveText('1 repost')
await element(by.id('repostBtn').withAncestor(post)).atIndex(0).tap() await element(by.id('repostBtn').withAncestor(post)).atIndex(0).tap()
await expect(element(by.id('repostModal'))).toBeVisible() await expect(element(by.id('repostModal'))).toBeVisible()
await element(by.id('repostBtn').withAncestor(by.id('repostModal'))).tap() await element(by.id('repostBtn').withAncestor(by.id('repostModal'))).tap()
await expect(element(by.id('repostModal'))).not.toBeVisible() await expect(element(by.id('repostModal'))).not.toBeVisible()
await expect( await expect(
element(by.id('repostCount').withAncestor(post)).atIndex(0), element(by.id('repostCount-expanded').withAncestor(post)).atIndex(0),
).not.toExist() ).not.toExist()
}) })
+8 -2
View File
@@ -375,7 +375,10 @@ let PostThreadItemLoaded = ({
style={styles.expandedInfoItem} style={styles.expandedInfoItem}
href={repostsHref} href={repostsHref}
title={repostsTitle}> title={repostsTitle}>
<Text testID="repostCount" type="lg" style={pal.textLight}> <Text
testID="repostCount-expanded"
type="lg"
style={pal.textLight}>
<Text type="xl-bold" style={pal.text}> <Text type="xl-bold" style={pal.text}>
{formatCount(post.repostCount)} {formatCount(post.repostCount)}
</Text>{' '} </Text>{' '}
@@ -390,7 +393,10 @@ let PostThreadItemLoaded = ({
style={styles.expandedInfoItem} style={styles.expandedInfoItem}
href={likesHref} href={likesHref}
title={likesTitle}> title={likesTitle}>
<Text testID="likeCount" type="lg" style={pal.textLight}> <Text
testID="likeCount-expanded"
type="lg"
style={pal.textLight}>
<Text type="xl-bold" style={pal.text}> <Text type="xl-bold" style={pal.text}>
{formatCount(post.likeCount)} {formatCount(post.likeCount)}
</Text>{' '} </Text>{' '}