Revert "fix: attach inline prompt to cell.inputArea (under the editor), not cell.node"
This reverts commit 8ed55c43c7.
This commit is contained in:
@@ -87,7 +87,6 @@ function makeFakeCell(
|
||||
const cell = new (CodeCell as unknown as new () => CodeCell)();
|
||||
(cell as any).model = model;
|
||||
(cell as any).node = document.createElement('div');
|
||||
(cell as any).inputArea = { node: document.createElement('div') };
|
||||
|
||||
const notebook: any = { widgets: [] as CodeCell[] };
|
||||
const panel: any = {
|
||||
@@ -128,7 +127,7 @@ describe('OpenCodeCellActions', () => {
|
||||
const actions = new OpenCodeCellActions(cell);
|
||||
const btns = actions.node.querySelectorAll('button');
|
||||
expect(btns.length).toBe(1);
|
||||
expect(btns[0].textContent).toContain('AI');
|
||||
expect(btns[0].textContent).toContain('🪄');
|
||||
});
|
||||
|
||||
it('disables the button when notebook panel cannot be resolved', () => {
|
||||
@@ -155,7 +154,7 @@ describe('OpenCodeCellActions', () => {
|
||||
const btn = actions.node.querySelector('button') as HTMLButtonElement;
|
||||
btn.click();
|
||||
|
||||
const prompt = cell.inputArea!.node.querySelector(
|
||||
const prompt = cell.node.querySelector(
|
||||
'.opencode-inline-prompt'
|
||||
) as HTMLElement;
|
||||
expect(prompt).not.toBeNull();
|
||||
@@ -170,7 +169,7 @@ describe('OpenCodeCellActions', () => {
|
||||
const btn = actions.node.querySelector('button') as HTMLButtonElement;
|
||||
btn.click();
|
||||
btn.click();
|
||||
expect(cell.inputArea!.node.querySelector('.opencode-inline-prompt')).toBeNull();
|
||||
expect(cell.node.querySelector('.opencode-inline-prompt')).toBeNull();
|
||||
});
|
||||
|
||||
it('disconnects model signals on dispose', () => {
|
||||
@@ -197,7 +196,7 @@ describe('OpenCodeCellActions', () => {
|
||||
const btn = actions.node.querySelector('button') as HTMLButtonElement;
|
||||
btn.click();
|
||||
|
||||
const select = cell.inputArea!.node.querySelector(
|
||||
const select = cell.node.querySelector(
|
||||
'.opencode-inline-prompt .opencode-model-select'
|
||||
) as HTMLSelectElement;
|
||||
expect(select).not.toBeNull();
|
||||
@@ -220,7 +219,7 @@ describe('OpenCodeCellActions', () => {
|
||||
btn.click();
|
||||
|
||||
expect(
|
||||
cell.inputArea!.node.querySelector('.opencode-inline-prompt .opencode-model-select')
|
||||
cell.node.querySelector('.opencode-inline-prompt .opencode-model-select')
|
||||
).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -121,7 +121,7 @@ export class OpenCodeCellActions extends Widget {
|
||||
this._hidePrompt();
|
||||
}
|
||||
});
|
||||
Widget.attach(prompt, this._cell.inputArea?.node ?? this._cell.node);
|
||||
Widget.attach(prompt, this._cell.node);
|
||||
this._prompt = prompt;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user