mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 08:36:33 +03:00
fix: Response objects couldn't open (#1867)
* This was undefined on response toggle * Add test cases for opening response object
This commit is contained in:
parent
5694913e71
commit
18f943d2b5
|
@ -4,9 +4,7 @@ describe('Menu', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have valid items count', () => {
|
it('should have valid items count', () => {
|
||||||
cy.get('.menu-content')
|
cy.get('.menu-content').find('li').should('have.length', 34);
|
||||||
.find('li')
|
|
||||||
.should('have.length', 34);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should sync active menu items while scroll', () => {
|
it('should sync active menu items while scroll', () => {
|
||||||
|
@ -35,9 +33,7 @@ describe('Menu', () => {
|
||||||
.should('have.text', 'Add a new pet to the store')
|
.should('have.text', 'Add a new pet to the store')
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
|
|
||||||
cy.contains('h1', 'Swagger Petstore')
|
cy.contains('h1', 'Swagger Petstore').scrollIntoView().wait(100);
|
||||||
.scrollIntoView()
|
|
||||||
.wait(100)
|
|
||||||
|
|
||||||
cy.contains('h1', 'Introduction')
|
cy.contains('h1', 'Introduction')
|
||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
|
@ -59,10 +55,25 @@ describe('Menu', () => {
|
||||||
it('should deactivate tag when other is activated', () => {
|
it('should deactivate tag when other is activated', () => {
|
||||||
const petItem = () => cy.contains('[role=menuitem].-depth1', 'pet');
|
const petItem = () => cy.contains('[role=menuitem].-depth1', 'pet');
|
||||||
|
|
||||||
petItem()
|
petItem().click({ force: true }).should('have.class', 'active');
|
||||||
.click({ force: true })
|
|
||||||
.should('have.class', 'active');
|
|
||||||
cy.contains('[role=menuitem].-depth1', 'store').click({ force: true });
|
cy.contains('[role=menuitem].-depth1', 'store').click({ force: true });
|
||||||
petItem().should('not.have.class', 'active');
|
petItem().should('not.have.class', 'active');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should be able to open a response object to see more details', () => {
|
||||||
|
cy.contains('h2', 'Find pet by ID')
|
||||||
|
.scrollIntoView()
|
||||||
|
.wait(100)
|
||||||
|
.parent()
|
||||||
|
.find('div h3')
|
||||||
|
.should('have.text', 'Responses')
|
||||||
|
.parent()
|
||||||
|
.find('div:first button')
|
||||||
|
.click()
|
||||||
|
.should('have.attr', 'aria-expanded', 'true')
|
||||||
|
.parent()
|
||||||
|
.find('div h5')
|
||||||
|
.then($h5 => $h5[0].firstChild!.nodeValue!.trim())
|
||||||
|
.should('eq', 'Response Schema:');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -30,7 +30,7 @@ export const ResponseView = observer(({ response }: ResponseViewProps): React.Re
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<StyledResponseTitle
|
<StyledResponseTitle
|
||||||
onClick={response.toggle}
|
onClick={() => response.toggle()}
|
||||||
type={type}
|
type={type}
|
||||||
empty={empty}
|
empty={empty}
|
||||||
title={summary || ''}
|
title={summary || ''}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user