mengw15 commented on code in PR #7839:
URL: https://github.com/apache/texera/pull/7839#discussion_r3835769776
##########
frontend/src/app/dashboard/component/user/filters-instructions/filters-instructions.component.spec.ts:
##########
@@ -18,17 +18,26 @@
*/
import { ComponentFixture, TestBed } from "@angular/core/testing";
+import { By } from "@angular/platform-browser";
+import { NoopAnimationsModule } from "@angular/platform-browser/animations";
Review Comment:
Checked this rather than assumed it: with **no** `detectChanges()` and
**no** `tick()` after `show()`, the panel is already complete — `.ant-popover`
goes 0 → 1 and 10 `<li>` are present the moment `show()` returns; a later
`detectChanges()` and `tick()` both leave it at 10.
The modal specs need `ApplicationRef.tick()` because
`NzModalService.create()` attaches the modal as a root view detached from the
fixture. The popover is not built that way: `NzTooltipBaseDirective` creates it
via `hostView.createComponent(...)`, so it lives inside the fixture's view
tree, and `NzToolTipComponent.show()` runs its own `cdr.detectChanges()` — that
pass attaches the `cdkConnectedOverlay` and stamps the content synchronously.
The closed-state test asserts the panel is absent before opening, so both
directions are pinned.
Leaving it as is — a tick here would imply a dependency that does not exist.
##########
frontend/src/app/workspace/component/agent/agent-panel/agent-chat/agent-chat.component.spec.ts:
##########
@@ -782,6 +784,60 @@ describe("AgentChatComponent", () => {
expect(messages[1].querySelector("button")).toBeTruthy();
});
+ it("pluralises the tool-call summary and opens the details modal from the
hover button", () => {
+ createComponent();
+ // A pure tool-call step carries no text, so nothing here waits on
<markdown>.
+ const step = makeStep({
+ content: "",
+ isBegin: true,
+ toolCalls: [{ toolName: "addOperator" }, { toolName: "runWorkflow" }],
+ });
+ agentService.stepsSubject.next([step]);
+ fixture.detectChanges();
+
+ const message = fixture.nativeElement.querySelector(".messages-container
.message") as HTMLElement;
+ expect(message.textContent).toContain("Execute 2 tools");
+
+ // The newest step is auto-hovered, so its details button is the one
rendered.
+ (message.querySelector("button") as HTMLButtonElement).click();
+ fixture.detectChanges();
+
+ expect(component.selectedResponse).toBe(step);
+ expect(component.isDetailsModalVisible).toBe(true);
+ });
+
+ it("closing the step-detail modal clears the flag through its two-way
binding", () => {
+ createComponent();
+ component.showResponseDetails(makeStep());
+ fixture.detectChanges();
+ expect(component.isDetailsModalVisible).toBe(true);
+
+ // The child owns the close control; its visibleChange output is what
drives
+ // the parent's [(visible)] binding back to false.
+
fixture.debugElement.query(By.directive(ReActStepDetailModalComponent)).componentInstance.closeModal();
+ fixture.detectChanges();
Review Comment:
Fixed in 18c33de — captured the debug element and asserted it first, which
also makes this consistent with the other two lookups in the PR (the
system-info `nz-modal` and the popover panel already do this).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]