mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-29 14:00:05 +02:00

* Rename files to tsx * Update types * Remove props that aren't typed * Add `LayoutContextOwnStates` * Use `LayoutContextOwnStates` * Ignore ts errors about `SocketIOMock` * Address comments: remove `satisfies`, update `BroadcastChannel` fixture * Add types to `makeEditorOpenDocProvider`. Update `openDocId`->`currentDocumentId` * misc. * Type sockets as `SocketIOMock & Socket` * Fix remaining typing errors * Fix type of `ideReactContextValue` GitOrigin-RevId: 2734ac707517d56c452b0bf06ea3438f947a64be
26 lines
795 B
TypeScript
26 lines
795 B
TypeScript
import { expect } from 'chai'
|
|
import { render, screen } from '@testing-library/react'
|
|
|
|
import ChatToggleButton from '../../../../../frontend/js/features/editor-navigation-toolbar/components/chat-toggle-button'
|
|
|
|
describe('<ChatToggleButton />', function () {
|
|
const defaultProps = {
|
|
chatIsOpen: false,
|
|
unreadMessageCount: 0,
|
|
onClick: () => {},
|
|
}
|
|
|
|
it('displays the number of unread messages', function () {
|
|
const props = {
|
|
...defaultProps,
|
|
unreadMessageCount: 113,
|
|
}
|
|
render(<ChatToggleButton {...props} />)
|
|
screen.getByText('113')
|
|
})
|
|
|
|
it("doesn't display the unread messages badge when the number of unread messages is zero", function () {
|
|
render(<ChatToggleButton {...defaultProps} />)
|
|
expect(screen.queryByText('0')).to.not.exist
|
|
})
|
|
})
|