fix: remove env in colletion delete button (#3682)

This commit is contained in:
jack zhang 2024-03-14 10:35:19 +08:00 committed by GitHub
parent 69ff55ba90
commit ca01bdc306
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 35 deletions

View File

@ -31,47 +31,15 @@ describe('CollectionDeletedPlaceholder', () => {
});
describe('name exist', () => {
test("designable: true & process.env.NODE_ENV === 'development', render `Result` component", () => {
const NODE_ENV = process.env.NODE_ENV;
process.env.NODE_ENV = 'development';
test('designable: true, render `Result` component', () => {
renderApp('test', true);
process.env.NODE_ENV = NODE_ENV;
expect(document.body.innerHTML).toContain('ant-result');
});
test("designable: false & process.env.NODE_ENV === 'development', render `Result` component", () => {
const NODE_ENV = process.env.NODE_ENV;
process.env.NODE_ENV = 'development';
test('designable: false, render nothing', () => {
renderApp('test', false);
process.env.NODE_ENV = NODE_ENV;
expect(document.body.innerHTML).toContain('ant-result');
});
test("designable: true & process.env.NODE_ENV !== 'development', render `Result` component", () => {
const NODE_ENV = process.env.NODE_ENV;
process.env.NODE_ENV = 'production';
renderApp('test', true);
process.env.NODE_ENV = NODE_ENV;
expect(document.body.innerHTML).toContain('ant-result');
});
test("designable: false & process.env.NODE_ENV !== 'development', render nothing", () => {
const NODE_ENV = process.env.NODE_ENV;
process.env.NODE_ENV = 'production';
renderApp('test', false);
process.env.NODE_ENV = NODE_ENV;
expect(screen.getByTestId('app').innerHTML.length).toBe(0);
});
});

View File

@ -61,7 +61,7 @@ export const CollectionDeletedPlaceholder: FC<CollectionDeletedPlaceholderProps>
}).replaceAll('&gt;', '>');
}, [message, nameValue, type, t, blockType]);
if (designable || process.env.NODE_ENV === 'development') {
if (designable) {
if (type === 'Field') {
return <Text type="secondary">{messageValue}</Text>;
}