-
Notifications
You must be signed in to change notification settings - Fork 10
/
Scenario.tsx
66 lines (62 loc) · 2.51 KB
/
Scenario.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import React, { useState } from 'react'
import CucumberQueryContext from '../../CucumberQueryContext.js'
import GherkinQueryContext from '../../GherkinQueryContext.js'
import UriContext from '../../UriContext.js'
import { HighLight } from '../app/HighLight.js'
import { DefaultComponent, ScenarioProps, useCustomRendering } from '../customise/index.js'
import { Description } from './Description.js'
import { ExampleDetail } from './ExampleDetail.js'
import { Examples } from './Examples.js'
import { ExamplesContext } from './ExamplesContext.js'
import { GherkinSteps } from './GherkinSteps.js'
import { HookSteps } from './HookSteps.js'
import { Keyword } from './Keyword.js'
import { StepsList } from './StepsList.js'
import { Tags } from './Tags.js'
import { Title } from './Title.js'
const DefaultRenderer: DefaultComponent<ScenarioProps> = ({ scenario }) => {
const examplesList = scenario.examples || []
const hasExamples = examplesList.length > 0
const cucumberQuery = React.useContext(CucumberQueryContext)
const gherkinQuery = React.useContext(GherkinQueryContext)
const uri = React.useContext(UriContext)
const [selectedExample, setSelectedExample] = useState<string>()
const pickleIds = uri ? gherkinQuery.getPickleIds(uri, scenario.id) : []
const beforeHooks = cucumberQuery.getBeforeHookSteps(pickleIds[0])
const afterHooks = cucumberQuery.getAfterHookSteps(pickleIds[0])
if (selectedExample) {
return (
<ExampleDetail