Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

logRoles does not print hidden elements

Đang mở
#1,201 7 bình luận 0 reaction 0 người được giao Xem trên GitHub

@naorpeled đang làm issue này rồi.

Từ ngày 18/6/2023.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, typescript
Lĩnh vực
testing-qa

Hướng nghiên cứu

Bắt đầu từ các entry point logRoles và logRole, đặc biệt là chữ ký TypeScript được đề cập trong issue, và tái hiện output rỗng với các phần tử bị ẩn. So sánh output của role với screen.debug; được xem là hoàn tất khi các phần tử bị ẩn được bao gồm như yêu cầu, tham số thứ hai được chấp nhận và output liên quan phân biệt các phần tử bị ẩn.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
  • @testing-library/react version: 14.0.0
  • Testing Framework and version: Jest 29.4.3
  • DOM Environment: jsdom 29.4.3
Relevant code or config:
const buttons = await waitFor(
    screen.getAllByRole("button", { hidden: true })
);

logRoles(buttons)
What you did:

I was trying to logRoles for a DOM tree with hidden elements. Failed to see the elements show in the roles list.

What happened:

Logging roles for hidden elements produces an empty log.

Reproduction:
  1. Get all elements of a DOM tree including hidden ones. Make sure you have hidden ones.
  2. Log using logRoles
  3. See that some log entries are empty compared to what you see when you screen.debug
Problem description:

If you log an element you found using { hidden: true }, logRoles will not print it. Similarly won't print hidden elements in a DOM tree you pass in. This is the opposite of what I would expect from this tool. I want to know why something may be failing to query, so I want to see everything in the tree.
The logRole function does take a { hidden } parameter and by default is set to false, however the function signature in Typescript does not accept a second parameter.

Suggested solution:

A useful thing would be that hidden was on by default, the function signature would be updated to take the second parameter, and that elements logged that are hidden, report so in the pretty role output.

Ngôn ngữ chính
JavaScript
Star
19.7k
Fork
1.2k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của testing-library/react-testing-library

Tất cả issue của testing-library/react-testing-library

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.