prefixed operation ids with parent id

This commit is contained in:
ben.blowers 2020-04-24 15:21:00 +01:00
parent ffa216ea87
commit 2b06692959
3 changed files with 6 additions and 6 deletions

View File

@ -30,7 +30,7 @@ describe('Menu', () => {
cy.location('hash').should('equal', '#tag/pet'); cy.location('hash').should('equal', '#tag/pet');
cy.contains('[role=menuitem]', 'Find pet by ID').click({ force: true }); cy.contains('[role=menuitem]', 'Find pet by ID').click({ force: true });
cy.location('hash').should('equal', '#operation/getPetById'); cy.location('hash').should('equal', '#tag/pet/operation/getPetById');
}); });
it('should deactivate tag when other is activated', () => { it('should deactivate tag when other is activated', () => {

View File

@ -21,12 +21,12 @@ describe('Servers', () => {
initReDoc(win, spec, {}); initReDoc(win, spec, {});
// TODO add cy-data attributes // TODO add cy-data attributes
cy.get('[data-section-id="operation/addPet"]').should( cy.get('[data-section-id="tag/pet/operation/addPet"]').should(
'contain', 'contain',
'http://petstore.swagger.io/v2/pet', 'http://petstore.swagger.io/v2/pet',
); );
cy.get('[data-section-id="operation/addPet"]').should( cy.get('[data-section-id="tag/pet/operation/addPet"]').should(
'contain', 'contain',
'http://petstore.swagger.io/sandbox/pet', 'http://petstore.swagger.io/sandbox/pet',
); );
@ -40,7 +40,7 @@ describe('Servers', () => {
initReDoc(win, spec, {}); initReDoc(win, spec, {});
// TODO add cy-data attributes // TODO add cy-data attributes
cy.get('[data-section-id="operation/addPet"]').should( cy.get('[data-section-id="tag/pet/operation/addPet"]').should(
'contain', 'contain',
'http://localhost:' + win.location.port + '/pet', 'http://localhost:' + win.location.port + '/pet',
); );
@ -55,7 +55,7 @@ describe('Servers', () => {
initReDoc(win, spec, {}); initReDoc(win, spec, {});
// TODO add cy-data attributes // TODO add cy-data attributes
cy.get('[data-section-id="operation/addPet"]').should( cy.get('[data-section-id="tag/pet/operation/addPet"]').should(
'contain', 'contain',
'http://localhost:' + win.location.port + '/pet', 'http://localhost:' + win.location.port + '/pet',
); );

View File

@ -108,7 +108,7 @@ export class OperationModel implements IMenuItem {
} else { } else {
this.id = this.id =
operationSpec.operationId !== undefined operationSpec.operationId !== undefined
? 'operation/' + operationSpec.operationId ? (parent ? parent.id + '/' : '') + 'operation/' + operationSpec.operationId
: parent !== undefined : parent !== undefined
? parent.id + this.pointer ? parent.id + this.pointer
: this.pointer; : this.pointer;