mattermost-mobile-upstream/app/components/button/button_markdown_text/button_markdown_text.test.tsx
Daniel Espino García 84ea188366
Mattermost Blocks (#9764)
* Mattermost Blocks

* Move block renderer to its own components folder

* Sync translation layer

* UX fixes

* Refactor button to use the button component

* Code review

* Fix CI

* Add animations to collapse blocks

* Add unit tests

* Add e2e tests and related fixes

* Address coderabbit comments

* Address UX comments

* Address feedback

* Address coderabbit comments

* Fix snapshots

* Sync with webapp translation

* Add node limit to button markdown node

* Address feedback

* i18n-extract

* Fix test

* Move image utils to the utils folder

* Remove unneeded style

* Revert build script change

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2026-06-29 18:42:16 +02:00

54 lines
1.5 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {Preferences} from '@constants';
import {renderWithIntlAndTheme} from '@test/intl-test-helper';
import ButtonMarkdownText from './button_markdown_text';
describe('ButtonMarkdownText', () => {
const theme = Preferences.THEMES.denim;
const baseStyle = {color: theme.centerChannelColor, fontSize: 15};
it('should render plain text', () => {
const {getByText} = renderWithIntlAndTheme(
<ButtonMarkdownText
value='Approve'
baseStyle={baseStyle}
theme={theme}
maxNodes={1000}
/>,
);
expect(getByText('Approve')).toBeTruthy();
});
it('should render bold markdown', () => {
const {getByText} = renderWithIntlAndTheme(
<ButtonMarkdownText
value='**Approve**'
baseStyle={baseStyle}
theme={theme}
maxNodes={1000}
/>,
);
expect(getByText('Approve')).toBeTruthy();
});
it('should render link text without making it a link', () => {
const {getByText} = renderWithIntlAndTheme(
<ButtonMarkdownText
value='[Docs](https://example.com)'
baseStyle={baseStyle}
theme={theme}
maxNodes={1000}
/>,
);
expect(getByText('Docs')).toBeTruthy();
});
});