mirror of
https://github.com/mattermost/mattermost-mobile.git
synced 2026-11-18 17:38:15 +00:00
Android inverted thread lists could not scroll far enough to reveal the root post header after browsing replies. Apply Android-thread-specific list padding and layout handling, include the root post in the initial batch, and centralize detection in android_thread_scroll helpers. Co-authored-by: Cursor <cursoragent@cursor.com>
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {Platform} from 'react-native';
|
|
|
|
import {Screens} from '@constants';
|
|
|
|
import {isAndroidThreadRootPost, isAndroidThreadScreen} from './android_thread_scroll';
|
|
|
|
describe('android_thread_scroll', () => {
|
|
const originalOS = Platform.OS;
|
|
|
|
afterEach(() => {
|
|
Object.defineProperty(Platform, 'OS', {value: originalOS});
|
|
});
|
|
|
|
it('should identify Android thread screens only', () => {
|
|
Object.defineProperty(Platform, 'OS', {value: 'android'});
|
|
expect(isAndroidThreadScreen(Screens.THREAD)).toBe(true);
|
|
expect(isAndroidThreadScreen(Screens.CHANNEL)).toBe(false);
|
|
|
|
Object.defineProperty(Platform, 'OS', {value: 'ios'});
|
|
expect(isAndroidThreadScreen(Screens.THREAD)).toBe(false);
|
|
});
|
|
|
|
it('should identify Android thread root posts by root id or reply state', () => {
|
|
Object.defineProperty(Platform, 'OS', {value: 'android'});
|
|
|
|
expect(isAndroidThreadRootPost({
|
|
location: Screens.THREAD,
|
|
postId: 'root-post-id',
|
|
rootId: 'root-post-id',
|
|
})).toBe(true);
|
|
|
|
expect(isAndroidThreadRootPost({
|
|
location: Screens.THREAD,
|
|
postId: 'reply-post-id',
|
|
rootId: 'root-post-id',
|
|
})).toBe(false);
|
|
|
|
expect(isAndroidThreadRootPost({
|
|
location: Screens.THREAD,
|
|
isReplyPost: false,
|
|
})).toBe(true);
|
|
|
|
expect(isAndroidThreadRootPost({
|
|
location: Screens.THREAD,
|
|
isReplyPost: true,
|
|
})).toBe(false);
|
|
});
|
|
});
|