mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-02 09:01:21 +08:00
🐛 fix(query-results): 修复执行消息面板布局异常
This commit is contained in:
@@ -495,6 +495,11 @@ const findResultMessageTextarea = (renderer: ReactTestRenderer, mode: 'compact'
|
||||
node.type === 'textarea' && node.props['data-query-result-message-textarea'] === mode,
|
||||
);
|
||||
|
||||
const findByClassName = (renderer: ReactTestRenderer, className: string) =>
|
||||
renderer.root.find((node) =>
|
||||
typeof node.props?.className === 'string' && node.props.className.includes(className),
|
||||
);
|
||||
|
||||
const findEditorAction = (id: string) =>
|
||||
editorState.editor.addAction.mock.calls
|
||||
.map((call: any[]) => call[0])
|
||||
@@ -1162,6 +1167,8 @@ describe('QueryEditor external SQL save', () => {
|
||||
|
||||
const rendered = textContent(renderer!.toJSON());
|
||||
const messageTextarea = findResultMessageTextarea(renderer!);
|
||||
const messageBlock = findByClassName(renderer!, 'query-result-message-block');
|
||||
const messageScrollBody = findByClassName(renderer!, 'query-result-message-scroll-body');
|
||||
expect(rendered).toContain('消息 1');
|
||||
expect(messageTextarea.props.value).toBe([
|
||||
" select c.queryno,'' ,left(dbo.f_vendor_class(''' + b.groupid + ''',' + colname + '),",
|
||||
@@ -1174,6 +1181,20 @@ describe('QueryEditor external SQL save', () => {
|
||||
display: 'block',
|
||||
whiteSpace: 'pre',
|
||||
overflow: 'auto',
|
||||
width: '100%',
|
||||
minWidth: 0,
|
||||
});
|
||||
expect(messageTextarea.props.style.minWidth).not.toBe('max-content');
|
||||
expect(messageBlock.props.style).toMatchObject({
|
||||
alignItems: 'stretch',
|
||||
width: '100%',
|
||||
});
|
||||
expect(messageScrollBody.props.style).toMatchObject({
|
||||
display: 'flex',
|
||||
alignItems: 'stretch',
|
||||
width: '100%',
|
||||
overflow: 'hidden',
|
||||
minWidth: 0,
|
||||
});
|
||||
expect(messageTextarea.props.value).not.toContain('mssql:');
|
||||
});
|
||||
@@ -2645,6 +2666,9 @@ describe('QueryEditor external SQL save', () => {
|
||||
expect(source).toContain("flex: fillHeight ? 1 : '0 1 auto'");
|
||||
expect(source).toContain('wrap="off"');
|
||||
expect(source).toContain("whiteSpace: 'pre'");
|
||||
expect(source).toContain("alignItems: 'stretch'");
|
||||
expect(source).toContain("minWidth: 0");
|
||||
expect(source).not.toContain("minWidth: 'max-content'");
|
||||
expect(source).toContain("data-query-result-message-textarea");
|
||||
expect(source).toContain("query_editor.results_panel.message.action.copy");
|
||||
expect(source).toContain("typeof navigator?.clipboard?.writeText !== 'function'");
|
||||
@@ -2988,7 +3012,7 @@ describe('QueryEditor external SQL save', () => {
|
||||
});
|
||||
});
|
||||
|
||||
expect(storeState.setActiveContext).toHaveBeenCalledWith({ connectionId: 'conn-1', dbName: 'front_end_sys' });
|
||||
expect(storeState.setActiveContext).not.toHaveBeenCalled();
|
||||
expect(storeState.addTab).toHaveBeenCalledWith(expect.objectContaining({
|
||||
type: 'table',
|
||||
connectionId: 'conn-1',
|
||||
@@ -2998,7 +3022,7 @@ describe('QueryEditor external SQL save', () => {
|
||||
}));
|
||||
});
|
||||
|
||||
it('keeps sidebar object navigation tied to the dragged database after drop', async () => {
|
||||
it('keeps object hyperlink tab opening tied to the dragged database after drop', async () => {
|
||||
const domListeners: Record<string, ((event?: any) => void)[]> = {};
|
||||
editorState.domNode = {
|
||||
style: { cursor: '' },
|
||||
@@ -3070,7 +3094,7 @@ describe('QueryEditor external SQL save', () => {
|
||||
});
|
||||
});
|
||||
|
||||
expect(storeState.setActiveContext).toHaveBeenCalledWith({ connectionId: 'conn-1', dbName: 'front_end_sys' });
|
||||
expect(storeState.setActiveContext).not.toHaveBeenCalled();
|
||||
expect(storeState.addTab).toHaveBeenCalledWith(expect.objectContaining({
|
||||
type: 'table',
|
||||
connectionId: 'conn-1',
|
||||
|
||||
@@ -143,6 +143,7 @@ const QueryEditorResultsPanel: React.FC<QueryEditorResultsPanelProps> = ({
|
||||
border: darkMode ? '1px solid rgba(255,255,255,0.12)' : '1px solid rgba(0,0,0,0.08)',
|
||||
background: darkMode ? 'rgba(255,255,255,0.03)' : '#fff',
|
||||
textAlign: 'left',
|
||||
alignItems: 'stretch',
|
||||
marginTop,
|
||||
width: maxWidth ? `min(100%, ${maxWidth}px)` : '100%',
|
||||
flex: fillHeight ? 1 : undefined,
|
||||
@@ -171,9 +172,12 @@ const QueryEditorResultsPanel: React.FC<QueryEditorResultsPanelProps> = ({
|
||||
className="query-result-message-scroll-body"
|
||||
style={{
|
||||
flex: fillHeight ? 1 : '0 1 auto',
|
||||
display: 'flex',
|
||||
alignItems: 'stretch',
|
||||
width: '100%',
|
||||
minHeight: compact ? 72 : 0,
|
||||
maxHeight: compact ? 160 : undefined,
|
||||
overflow: 'auto',
|
||||
overflow: 'hidden',
|
||||
minWidth: 0,
|
||||
borderRadius: 6,
|
||||
}}
|
||||
@@ -188,8 +192,9 @@ const QueryEditorResultsPanel: React.FC<QueryEditorResultsPanelProps> = ({
|
||||
onKeyDown={handleMessageTextareaKeyDown}
|
||||
style={{
|
||||
display: 'block',
|
||||
flex: '1 1 auto',
|
||||
width: '100%',
|
||||
minWidth: 'max-content',
|
||||
minWidth: 0,
|
||||
height: '100%',
|
||||
minHeight: compact ? 72 : 0,
|
||||
padding: 0,
|
||||
@@ -310,6 +315,7 @@ const QueryEditorResultsPanel: React.FC<QueryEditorResultsPanelProps> = ({
|
||||
<div className={isV2Ui ? 'gn-v2-query-success' : undefined} style={{
|
||||
flex: 1, minHeight: 0, display: 'flex', justifyContent: 'flex-start',
|
||||
flexDirection: 'column', gap: 12, padding: 24, color: '#666', userSelect: 'text',
|
||||
alignItems: 'stretch',
|
||||
overflow: 'hidden',
|
||||
}}>
|
||||
{renderMessageBlock({
|
||||
|
||||
Reference in New Issue
Block a user