keyValueTable.spec.tsx 780 B

123456789101112131415161718192021
  1. import {render, screen} from 'sentry-test/reactTestingLibrary';
  2. import {KeyValueTable, KeyValueTableRow} from 'sentry/components/keyValueTable';
  3. describe('KeyValueTable', function () {
  4. it('basic', function () {
  5. render(
  6. <KeyValueTable>
  7. <KeyValueTableRow keyName="Coffee" value="Black hot drink" />
  8. <KeyValueTableRow keyName="Milk" value={<a href="#">White cold drink</a>} />
  9. </KeyValueTable>
  10. );
  11. const terms = screen.getAllByRole('term');
  12. const definitions = screen.getAllByRole('definition');
  13. expect(terms[0]).toHaveTextContent('Coffee');
  14. expect(definitions[0]).toHaveTextContent('Black hot drink');
  15. expect(terms[1]).toHaveTextContent('Milk');
  16. expect(definitions[1]).toHaveTextContent('White cold drink');
  17. });
  18. });