Skip to content

Commit 6b151b0

Browse files
pfaffeDevtools-frontend LUCI CQ
authored andcommitted
Revert "[PatchWidget] Handle discard and saveAll actions"
This reverts commit 34e26e6. Reason for revert: Waterfall turned red with this CL. Original change's description: > [PatchWidget] Handle `discard` and `saveAll` actions > > Fixed: 399559699 > Change-Id: I14073f0e3b8107ff4b632c0b87c7c90aeec1feab > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6348560 > Reviewed-by: Wolfgang Beyer <[email protected]> > Reviewed-by: Alex Rudenko <[email protected]> > Commit-Queue: Ergün Erdoğmuş <[email protected]> No-Presubmit: true No-Tree-Checks: true No-Try: true Change-Id: I9ededca126a5c3c2350f6df87e1853e4ec82f571 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6357069 Commit-Queue: Rubber Stamper <[email protected]> Bot-Commit: Rubber Stamper <[email protected]> Auto-Submit: Philip Pfaffe <[email protected]>
1 parent fe93423 commit 6b151b0

File tree

3 files changed

+2
-67
lines changed

3 files changed

+2
-67
lines changed

front_end/panels/ai_assistance/PatchWidget.test.ts

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import * as PanelCommon from '../../panels/common/common.js';
99
import {
1010
cleanup,
1111
createPatchWidget,
12-
createPatchWidgetWithDiffView,
1312
createTestFilesystem,
1413
initializePersistenceImplForTests,
1514
mockAidaClient,
@@ -177,51 +176,4 @@ Files:
177176
assert.strictEqual(input.projectName, 'test2');
178177
});
179178
});
180-
181-
describe('diff view', () => {
182-
let commitWorkingCopyStub:
183-
sinon.SinonStub<Parameters<typeof Workspace.UISourceCode.UISourceCode.prototype.commitWorkingCopy>>;
184-
let resetWorkingCopyStub:
185-
sinon.SinonStub<Parameters<typeof Workspace.UISourceCode.UISourceCode.prototype.resetWorkingCopy>>;
186-
187-
beforeEach(() => {
188-
createTestFilesystem('file://test');
189-
updateHostConfig({
190-
devToolsFreestyler: {
191-
enabled: true,
192-
patching: true,
193-
},
194-
});
195-
196-
commitWorkingCopyStub =
197-
sinon.stub(Workspace.UISourceCode.UISourceCode.prototype, 'commitWorkingCopy').callThrough();
198-
resetWorkingCopyStub =
199-
sinon.stub(Workspace.UISourceCode.UISourceCode.prototype, 'resetWorkingCopy').callThrough();
200-
});
201-
202-
it('save all should commit the working copy of the changed UI codes to the disk and render savedToDisk view',
203-
async () => {
204-
const {uiSourceCode} = createTestFilesystem('file://test');
205-
const {view} = await createPatchWidgetWithDiffView();
206-
207-
uiSourceCode.setWorkingCopy('working copy');
208-
view.input.onSaveAll();
209-
const nextInput = await view.nextInput;
210-
211-
assert.isTrue(nextInput.savedToDisk);
212-
assert.isTrue(commitWorkingCopyStub.called, 'Expected commitWorkingCopy to be called but it is not called');
213-
});
214-
215-
it('discard should discard the working copy and render the view without patchSuggestion', async () => {
216-
const {uiSourceCode} = createTestFilesystem('file://test');
217-
const {view} = await createPatchWidgetWithDiffView();
218-
uiSourceCode.setWorkingCopy('working copy');
219-
220-
view.input.onDiscard();
221-
const nextInput = await view.nextInput;
222-
223-
assert.notExists(nextInput.patchSuggestion);
224-
assert.isTrue(resetWorkingCopyStub.called, 'Expected resetWorkingCopy to be called but it is not called');
225-
});
226-
});
227179
});

front_end/panels/ai_assistance/PatchWidget.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -501,21 +501,14 @@ ${processedFiles.map(filename => `* ${filename}`).join('\n')}`;
501501
}
502502

503503
#onDiscard(): void {
504-
this.#workspaceDiff.modifiedUISourceCodes().forEach(modifiedUISourceCode => {
505-
modifiedUISourceCode.resetWorkingCopy();
506-
});
507-
504+
// TODO: Remove changes from the working copies as well.
508505
this.#patchSuggestion = undefined;
509506
this.#patchSources = undefined;
510507
this.requestUpdate();
511508
}
512509

513510
#onSaveAll(): void {
514-
// TODO: What should we do for the inspector stylesheet?
515-
this.#workspaceDiff.modifiedUISourceCodes().forEach(modifiedUISourceCode => {
516-
modifiedUISourceCode.commitWorkingCopy();
517-
});
518-
511+
// TODO: Handle saving all the files.
519512
this.#savedToDisk = true;
520513
this.requestUpdate();
521514
}

front_end/testing/AiAssistanceHelpers.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,6 @@ export async function createPatchWidget(options?: {
229229
};
230230
}
231231

232-
export async function createPatchWidgetWithDiffView() {
233-
const {view, panel, aidaClient} =
234-
await createPatchWidget({aidaClient: mockAidaClient([[{explanation: 'patch applied'}]])});
235-
panel.changeSummary = 'body { background-color: red; }';
236-
view.input.onApplyToWorkspace();
237-
assert.exists((await view.nextInput).patchSuggestion);
238-
239-
return {panel, view, aidaClient};
240-
}
241-
242232
export function initializePersistenceImplForTests(): void {
243233
const workspace = Workspace.Workspace.WorkspaceImpl.instance({forceNew: true});
244234
const debuggerWorkspaceBinding = Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance({

0 commit comments

Comments
 (0)