blob: eaef0e777be6a0fd0c34c0cf2fe083e444ba2232 [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001// Copyright 2021 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5import React from 'react';
6import {render, cleanup} from '@testing-library/react';
7import {assert} from 'chai';
8
9import DetailsStep from './DetailsStep.tsx';
10
11describe('DetailsStep', () => {
12 afterEach(cleanup);
13
14 it('renders', async () => {
15 const {container} = render(<DetailsStep />);
16
17 // this is checking for the first question
18 const input = container.querySelector('input');
19 assert.isNotNull(input)
20
21 // this is checking for the rest
22 const count = document.querySelectorAll('textarea').length;
23 assert.equal(count, 3)
24 });
25
26 it('renders category in title', async () => {
27 const {container} = render(<DetailsStep category='UI'/>);
28
29 // this is checking the title contains our category
30 const title = container.querySelector('h2');
31 assert.include(title?.innerText, 'Details for problems with UI');
32 });
33
34});