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
1 change: 1 addition & 0 deletions src/app/directed_acyclic_graph.ng.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
(mouseleave)="mousedown = false"
[class.animate-movement]="animateMove && !graphPanning"
[resolveReference]="resolveReference"
(edgeLabelClick)="edgeLabelClick.emit($event)"
/>
</section>
</figure>
Expand Down
1 change: 1 addition & 0 deletions src/app/directed_acyclic_graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ export class DirectedAcyclicGraph implements OnInit, OnDestroy {
@Output() selectedNodeChange = new EventEmitter<SelectedNode|null>();
@Output() groupIterationChanged = new EventEmitter<GroupIterationRecord>();
@Output() onGroupExpandToggled = new EventEmitter<GroupToggleEvent>();
@Output() edgeLabelClick = new EventEmitter<DagEdge>();

@Input() hoveredEdge?: DagEdge;

Expand Down
2 changes: 2 additions & 0 deletions src/app/directed_acyclic_graph_raw.ng.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@
*ngFor="let l of getEdgeLabels(); trackBy: edgeLabelTrack"
(mouseenter)="setEdgeHover(l.edge, true)"
(mouseleave)="setEdgeHover(l.edge, false)"
(click)="edgeLabelClick.emit(l.edge)"
[style.transform]="l.mid?.cssTransform"
[style.color]="getEdgeLabelColor(l.edge)"
[attr.edge-label]="l.label"
>
{{ l.label }}
</figcaption>
Expand Down
12 changes: 12 additions & 0 deletions src/app/directed_acyclic_graph_raw.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,18 @@ describe('Directed Acyclic Graph Raw', () => {
expect(fixture.componentInstance.dagRaw.groups[1].expanded).toBe(true);
}));

it('Correctly sends click events for edge labels',
waitForAsync(async () => {
const spy = jasmine.createSpy('edgeLabelClick');
fixture.componentInstance.dagRaw.edgeLabelClick.subscribe(spy);
const edgeLabel = await harness.getEdgeLabel('storage (red-edge)');

await edgeLabel.click();

expect(spy).toHaveBeenCalledWith(
jasmine.objectContaining({from: 'BigTable', to: 'AutoML Tables'}));
}));

// SKIP-PUBLIC
xit('Groups with expanded attribute are expanded on load',
waitForAsync(async () => {
Expand Down
1 change: 1 addition & 0 deletions src/app/directed_acyclic_graph_raw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ export class DagRaw implements DoCheck, OnInit, OnDestroy {
return this.$selectedNode;
}
@Output() selectedNodeChange = new EventEmitter<SelectedNode|null>();
@Output() edgeLabelClick = new EventEmitter<DagEdge>();

@Input() features = createDAGFeatures();
@Input('collapsed')
Expand Down
7 changes: 7 additions & 0 deletions src/app/test_resources/directed_acyclic_graph_raw_harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,11 @@ export class DagRawHarness extends ComponentHarness {
async getEdges(selector = '') {
return this.locatorForAll('.edge-group' + selector)();
}

/**
* Get an edge label by its text content.
*/
async getEdgeLabel(labelText: string) {
return this.locatorFor(`.edge-label[edge-label="${labelText}"]`)();
}
}
Loading