Skip to content

isHidden wrongly reports elements with display:contents as hidden #687

Open
@justdanpo

Description

@justdanpo

Is this a regression?

No

Description

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

isHidden wrongly reports elements with display:contents as hidden

Expected behavior

an element with display:contents should be treated as hidden only when all its children are hidden

Minimal reproduction of the problem with instructions

import { Component } from '@angular/core';
import { createComponentFactory, Spectator } from '@ngneat/spectator';

@Component({
    selector: 'test',
    template: '<div id="container"><div id="inner">text</div></div>',
    styles: '#container { display: contents; }',
})
class TestComponent {}

describe('isHidden', () => {
    const createFn = createComponentFactory(TestComponent);
    let spectator: Spectator<TestComponent>;
    beforeEach(() => {
        spectator = createFn({});
    });

    it('should work', () => {
        spectator.detectChanges();
        const el = spectator.query('#inner');
        expect(el).toBeVisible();
        expect(el).not.toBeHidden();
    });
});

What is the motivation / use case for changing the behavior?

Environment


Angular version: X.Y.Z


Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in

No response

Anything else?

No response

Do you want to create a pull request?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions