Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@

<div
*ngIf="operatorDescription && !editingTitle"
class="operator-description">
class="operator-description"
nz-tooltip
[nzTooltipTitle]="operatorDescription"
nzTooltipPlacement="bottom">
<p>{{ operatorDescription }}</p>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,10 @@

p {
margin-bottom: 0;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 3;
line-clamp: 3;
-webkit-box-orient: vertical;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,50 @@ describe("OperatorPropertyEditFrameComponent", () => {
fixture.detectChanges();
expect(component.operatorVersion).toEqual(mockScanPredicate.operatorVersion);
});

describe("operator description truncation", () => {
beforeEach(async () => {
TestBed.resetTestingModule();
await TestBed.configureTestingModule({
providers: [
WorkflowActionService,
{ provide: OperatorMetadataService, useClass: StubOperatorMetadataService },
{ provide: ComputingUnitStatusService, useClass: MockComputingUnitStatusService },
DatePipe,
...commonTestProviders,
],
imports: [
OperatorPropertyEditFrameComponent,
BrowserAnimationsModule,
FormsModule,
FormlyModule.forRoot(TEXERA_FORMLY_CONFIG),
FormlyNgZorroAntdModule,
ReactiveFormsModule,
HttpClientTestingModule,
],
}).compileComponents();

fixture = TestBed.createComponent(OperatorPropertyEditFrameComponent);
component = fixture.componentInstance;
});

it("should render .operator-description with tooltip when description is set", () => {
component.operatorDescription = "A long description that should be truncated after three lines.";
component.editingTitle = false;
fixture.detectChanges();

const descEl = fixture.debugElement.query(By.css(".operator-description"));
expect(descEl).toBeTruthy();
expect(descEl.attributes["nz-tooltip"]).toBeDefined();
});

it("should not render .operator-description when description is not set", () => {
component.operatorDescription = undefined;
component.editingTitle = false;
fixture.detectChanges();

const descEl = fixture.debugElement.query(By.css(".operator-description"));
expect(descEl).toBeNull();
});
});
});
Loading