added operation/* style data-test-id to OperationRow

This commit is contained in:
ben.blowers 2020-05-12 14:45:18 +01:00
parent 2b06692959
commit 3f31094182
2 changed files with 8 additions and 3 deletions

View File

@ -17,8 +17,11 @@ import { RequestSamples } from '../RequestSamples/RequestSamples';
import { ResponsesList } from '../Responses/ResponsesList';
import { ResponseSamples } from '../ResponseSamples/ResponseSamples';
import { SecurityRequirements } from '../SecurityRequirement/SecurityRequirement';
import {SECTION_ATTR} from '../../services';
const OperationRow = styled(Row)`
const OperationRow = styled(Row).attrs(props => ({
[SECTION_ATTR]: props.id,
}))`
backface-visibility: hidden;
contain: content;
overflow: hidden;
@ -43,7 +46,7 @@ export class Operation extends React.Component<OperationProps> {
return (
<OptionsContext.Consumer>
{options => (
<OperationRow>
<OperationRow id={operation.operationHash}>
<MiddlePanel>
<H2>
<ShareLink to={operation.id} />

View File

@ -66,6 +66,7 @@ export class OperationModel implements IMenuItem {
pointer: string;
operationId?: string;
operationHash?: string;
httpVerb: string;
deprecated: boolean;
path: string;
@ -106,9 +107,10 @@ export class OperationModel implements IMenuItem {
// TODO: update getting pathInfo for overriding servers on path level
this.servers = normalizeServers('', operationSpec.servers || operationSpec.pathServers || []);
} else {
this.operationHash = operationSpec.operationId && 'operation/' + operationSpec.operationId
this.id =
operationSpec.operationId !== undefined
? (parent ? parent.id + '/' : '') + 'operation/' + operationSpec.operationId
? (parent ? parent.id + '/' : '') + this.operationHash
: parent !== undefined
? parent.id + this.pointer
: this.pointer;