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', () => { describe('name exist', () => {
test("designable: true & process.env.NODE_ENV === 'development', render `Result` component", () => { test('designable: true, render `Result` component', () => {
const NODE_ENV = process.env.NODE_ENV;
process.env.NODE_ENV = 'development';
renderApp('test', true); renderApp('test', true);
process.env.NODE_ENV = NODE_ENV;
expect(document.body.innerHTML).toContain('ant-result'); expect(document.body.innerHTML).toContain('ant-result');
}); });
test("designable: false & process.env.NODE_ENV === 'development', render `Result` component", () => { test('designable: false, render nothing', () => {
const NODE_ENV = process.env.NODE_ENV;
process.env.NODE_ENV = 'development';
renderApp('test', false); 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); expect(screen.getByTestId('app').innerHTML.length).toBe(0);
}); });
}); });

View File

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