angular / angular/components

bug(Tooltip): Harness returns if _any_ tooltip is open

Open
#26,773 0 comments 0 reactions 0 assignees View on GitHub
area: material/tooltip P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

`MatTooltipHarness.isOpen()` returns `true` if _any_ tooltip is open. Intuitively it should returns if the tooltip _associated with that harness_ is open. The docs also sound like that's what it should do, because it uses the word "the" instead of "a":

> Gets whether the tooltip is open.

### Reproduction

Steps to reproduce:
1. Have tooltips on 2 elements
2. Open one of them
3. Test `.isOpen()` on the harness for a different one

Here's a stackblitz: https://stackblitz.com/edit/harness-issue-84mcjr?file=src/app/button-harness-example.spec.ts

### Expected Behavior

`.isOpen()` would return true for the tooltip that is open, and false for the one that is not

### Actual Behavior

`.isOpen()` returns true for both

### Environment

```
@angular-devkit/architect 0.1501.2
@angular-devkit/build-angular 15.1.2
@angular-devkit/core 15.0.5
@angular-devkit/schematics 15.0.5
@angular/cdk 15.0.3
@angular/cli 15.0.5
@angular/fire 7.5.0
@angular/material 15.0.3
@schematics/angular 15.0.5
rxjs 7.5.7
typescript 4.8.4
```

Contributor guide

Open the contributing guide

Research direction

Start by locating MatTooltipHarness.isOpen() and the associated tooltip harness tests. Reproduce the two-tooltip case from the issue, then verify that isOpen() distinguishes the tooltip associated with the harness from other open tooltips; the relevant test should pass for both the open and closed harnesses.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.