Adrià Vilanova MartÃnez | ac4a644 | 2022-05-15 19:05:13 +0200 | [diff] [blame] | 1 | // 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 | |
| 5 | import React from 'react'; |
| 6 | import {assert} from 'chai'; |
| 7 | import {render, cleanup} from '@testing-library/react'; |
| 8 | import CustomQuestionsStep from 'react/issue-wizard/CustomQuestionsStep.tsx'; |
| 9 | import {CustomQuestionType} from 'react/issue-wizard/IssueWizardTypes.tsx'; |
| 10 | |
| 11 | describe('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 | }); |