-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
100 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
app/screens/post_priority_picker/post_priority_picker.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
import {screen} from '@testing-library/react-native'; | ||
import React, {type ComponentProps} from 'react'; | ||
|
||
import {useIsTablet} from '@hooks/device'; | ||
import {renderWithIntl} from '@test/intl-test-helper'; | ||
|
||
import PostPriorityPicker from './post_priority_picker'; | ||
|
||
jest.mock('@hooks/device'); | ||
const mockedIsTablet = jest.mocked(useIsTablet); | ||
|
||
function getBaseProps(): ComponentProps<typeof PostPriorityPicker> { | ||
return { | ||
closeButtonId: '', | ||
componentId: 'BottomSheet', | ||
isPersistenNotificationsEnabled: true, | ||
isPostAcknowledgementEnabled: true, | ||
persistentNotificationInterval: 0, | ||
postPriority: {priority: ''}, | ||
updatePostPriority: jest.fn(), | ||
}; | ||
} | ||
describe('post_priority_picker', () => { | ||
it('correctly shows the apply and cancel buttons on mobile', async () => { | ||
mockedIsTablet.mockReturnValue(false); | ||
const props = getBaseProps(); | ||
renderWithIntl(<PostPriorityPicker {...props}/>); | ||
expect(await screen.findByText('Apply')).toBeVisible(); | ||
expect(await screen.findByText('Cancel')).toBeVisible(); | ||
}); | ||
|
||
it('correctly shows the apply and cancel buttons on tablet', async () => { | ||
mockedIsTablet.mockReturnValue(true); | ||
const props = getBaseProps(); | ||
renderWithIntl(<PostPriorityPicker {...props}/>); | ||
expect(await screen.findByText('Apply')).toBeVisible(); | ||
expect(await screen.findByText('Cancel')).toBeVisible(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters