blob: 0b43dee75baef0bce9ad78dc4beb6ca63b48e0af [file] [log] [blame]
Adrià Vilanova Martínezac4a6442022-05-15 19:05:13 +02001// 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 {assert} from 'chai';
7import {render, cleanup} from '@testing-library/react';
8import CustomQuestionsStep from 'react/issue-wizard/CustomQuestionsStep.tsx';
9import {CustomQuestionType} from 'react/issue-wizard/IssueWizardTypes.tsx';
10
11describe('IssueWizard CustomQuestionsStep', () => {
12 afterEach(cleanup);
13 it('renders', async () => {
14 render(<CustomQuestionsStep questions={[]}/>);
15 const stepper = document.getElementById("mobile-stepper")
16
17 assert.isNotNull(stepper);
18 });
19
20 it('render InputType Question', async () => {
21 const questionList = [{
22 type: CustomQuestionType.Input,
23 question: "this is a test",
24 }]
25 const {container} = render(<CustomQuestionsStep questions={questionList}/>);
26 const input = container.querySelector('input');
27 assert.isNotNull(input);
28 })
29
30 it('render TextType Question', async () => {
31 const questionList = [{
32 type: CustomQuestionType.Text,
33 question: "this is a test",
34 }]
35 const {container} = render(<CustomQuestionsStep questions={questionList}/>);
36 const input = container.querySelector('textarea');
37 assert.isNotNull(input);
38 })
39});