mirror of
https://github.com/mattermost/mattermost-mobile.git
synced 2026-11-16 16:11:34 +00:00
* 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>
45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {translateBlockKit} from './block_kit';
|
|
|
|
describe('translateBlockKit section accessory button', () => {
|
|
it('should require a non-empty action_id', () => {
|
|
const blocks = translateBlockKit([{
|
|
type: 'section',
|
|
text: {type: 'plain_text', text: 'Body'},
|
|
accessory: {
|
|
type: 'button',
|
|
text: {type: 'plain_text', text: 'Go'},
|
|
action_id: '',
|
|
},
|
|
}]);
|
|
expect(blocks).toEqual([{
|
|
type: 'container',
|
|
content: [{type: 'text', text: 'Body'}],
|
|
}]);
|
|
});
|
|
|
|
it('should keep accessory button when action_id is present', () => {
|
|
const blocks = translateBlockKit([{
|
|
type: 'section',
|
|
text: {type: 'plain_text', text: 'Body'},
|
|
accessory: {
|
|
type: 'button',
|
|
text: {type: 'plain_text', text: 'Go'},
|
|
action_id: 'go_action',
|
|
style: 'primary',
|
|
},
|
|
}]);
|
|
const container = blocks[0] as MmContainerBlock;
|
|
const columnSet = container.content[0] as MmColumnSetBlock;
|
|
const button = columnSet.columns[1].items[0] as MmButtonBlock;
|
|
expect(button).toMatchObject({
|
|
type: 'button',
|
|
action_id: 'go_action',
|
|
text: 'Go',
|
|
style: 'primary',
|
|
});
|
|
});
|
|
});
|