Skip to content

Commit eb2198b

Browse files
committed
Remove Save button
1 parent 58a87c4 commit eb2198b

2 files changed

Lines changed: 3 additions & 49 deletions

File tree

src/views/manage-solution/view/components/manage-solution.test.tsx

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -355,51 +355,13 @@ describe('ContextSelection', () => {
355355
expect(listener).toHaveBeenCalledWith({ type: 'GET_CONTEXT_SELECTION_DATA' });
356356
});
357357

358-
it('calls messageHandler.push with SAVE_CONTEXT_SELECTION when Save button is clicked', () => {
358+
it('does not render the Save button', () => {
359359
createContextSelectionComponent();
360360

361361
postGenericDataContext();
362362

363-
// Simulate state.isDirty to enable the Save button
364-
React.act(() => {
365-
messageHandler.postWindowMessage({ type: 'IS_DIRTY', data: true });
366-
});
367-
368363
const saveButton = container.querySelector('.save-button');
369-
expect(saveButton).not.toBeNull();
370-
expect(saveButton?.getAttribute('disabled')).toBeNull();
371-
372-
React.act(() => {
373-
if (saveButton) {
374-
fireEvent.click(saveButton);
375-
}
376-
});
377-
378-
expect(listener).toHaveBeenCalledWith({ type: 'SAVE_CONTEXT_SELECTION' });
379-
});
380-
381-
it('does not call messageHandler.push with SAVE_CONTEXT_SELECTION when Save button is disabled', () => {
382-
createContextSelectionComponent();
383-
384-
postGenericDataContext();
385-
386-
// Simulate state.isDirty to disable the Save button
387-
React.act(() => {
388-
messageHandler.postWindowMessage({ type: 'IS_DIRTY', data: false });
389-
});
390-
391-
const saveButton = container.querySelector('.save-button');
392-
expect(saveButton).not.toBeNull();
393-
expect(saveButton?.getAttribute('disabled')).not.toBeNull();
394-
395-
React.act(() => {
396-
if (saveButton) {
397-
fireEvent.click(saveButton);
398-
}
399-
});
400-
401-
// Must NOT call SAVE_CONTEXT_SELECTION
402-
expect(listener).not.toHaveBeenCalledWith({ type: 'SAVE_CONTEXT_SELECTION' });
364+
expect(saveButton).toBeNull();
403365
});
404366

405367
describe('test change handlers', () => {

src/views/manage-solution/view/components/manage-solution.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,6 @@ export const ManageSolution = (props: ManageSolutionProps) => {
156156
props.messageHandler.push({ type: 'SET_DEBUGGER', name });
157157
}, [props.messageHandler]);
158158

159-
const clickSave = React.useCallback(() => {
160-
props.messageHandler.push({ type: 'SAVE_CONTEXT_SELECTION' });
161-
}, [props.messageHandler]);
162-
163159
const changeAutoUpdate = React.useCallback((e: CheckboxChangeEvent) => {
164160
props.messageHandler.push({ type: 'SET_AUTO_UPDATE', value: e.target.checked });
165161
dispatch({ type: 'INCOMING_MESSAGE', message: { type: 'AUTO_UPDATE', data: e.target.checked } });
@@ -276,7 +272,7 @@ export const ManageSolution = (props: ManageSolutionProps) => {
276272
}, [adapter, selectedDebugAdapter, getProperty, getScaledProperty, keyFor]);
277273

278274
const showCoreSelector = state.solutionData.availableCoreNames !== undefined && state.solutionData.availableCoreNames.length > 1;
279-
const debugAdapterConfigurationDocsUrl= 'https://mdk-packs.github.io/vscode-cmsis-solution-docs/debug.html#configure-run-and-debug';
275+
const debugAdapterConfigurationDocsUrl = 'https://mdk-packs.github.io/vscode-cmsis-solution-docs/debug.html#configure-run-and-debug';
280276
const externalLink = (link: string, title: string, external?: boolean): React.JSX.Element => {
281277
return (<Button
282278
color="default"
@@ -306,10 +302,6 @@ export const ManageSolution = (props: ManageSolutionProps) => {
306302
},
307303
token: { fontSize: 13, sizeStep: 4, borderRadius: 3 }
308304
}}>
309-
<section className='stickyHeader'>
310-
<Button disabled={!state.isDirty} style={{ minWidth: '100px' }} type='primary' onClick={clickSave} className='save-button'>Save</Button>
311-
</section>
312-
313305
<Spin spinning={state.busy} indicator={<LoadingOutlined spin={true} />} size='large'>
314306
<section className="manage-solution-section">
315307

0 commit comments

Comments
 (0)