Skip to content

Required html input field shows required="" in InlineSnapshot #1013

@mithi

Description

@mithi
  • @testing-library/react version: 11.2.5
  • Testing Framework and version: JEST: 27.0.3
  • DOM Environment:
  • "@testing-library/jest-dom": ^5.16.1,

Relevant code or config:

describe('html input field', () => {
  it('should be required', () => {
    const { baseElement } = render(<input name="my-input" required />);
    expect(baseElement).toMatchInlineSnapshot(`
<body>
  <div>
    <input
      name="my-input"
      required=""
    />
  </div>
</body>
`);
  });
});

Problem description:

The inline snapshot of an html input with a required attribute is not what is expected.

Just wanted to put this out there incase this isn't a known issue. Could be related to:

Feel free to close if there's a good reason to do so. Thank you!

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