-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix regression double slashes added to full URL display
- Loading branch information
1 parent
672ef56
commit f29a4fe
Showing
5 changed files
with
89 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<html> | ||
<body> | ||
<script src="../bundles/redoc.standalone.js">{}</script> | ||
<div id="redoc" /> | ||
</body> | ||
</html>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<html> | ||
<body> | ||
<script src="../bundles/redoc.standalone.js">{}</script> | ||
<div id="redoc" /> | ||
</body> | ||
</html>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// tslint:disable:no-implicit-dependencies | ||
import * as yaml from 'yaml-js'; | ||
|
||
async function loadSpec(url: string): Promise<any> { | ||
const spec = await (await fetch(url)).text(); | ||
return yaml.load(spec); | ||
} | ||
|
||
function initReDoc(win, spec, options = {}) { | ||
(win as any).Redoc.init(spec, options, win.document.getElementById('redoc')); | ||
} | ||
|
||
describe('Servers', () => { | ||
beforeEach(() => { | ||
cy.visit('e2e/'); | ||
}); | ||
|
||
it('should have valid server', () => { | ||
cy.window().then(async win => { | ||
const spec = await loadSpec('/demo/openapi.yaml'); | ||
initReDoc(win, spec, {}); | ||
|
||
// TODO add cy-data attributes | ||
cy.get('[data-section-id="operation/addPet"]').should( | ||
'contain', | ||
'http://petstore.swagger.io/v2/pet', | ||
); | ||
|
||
cy.get('[data-section-id="operation/addPet"]').should( | ||
'contain', | ||
'http://petstore.swagger.io/sandbox/pet', | ||
); | ||
}); | ||
}); | ||
|
||
it('should have valid server for when servers not provided', () => { | ||
cy.window().then(async win => { | ||
const spec = await loadSpec('/demo/openapi.yaml'); | ||
delete spec.servers; | ||
initReDoc(win, spec, {}); | ||
|
||
// TODO add cy-data attributes | ||
cy.get('[data-section-id="operation/addPet"]').should( | ||
'contain', | ||
'http://localhost:' + win.location.port + '/e2e/pet', | ||
); | ||
}); | ||
}); | ||
|
||
it('should have valid server for when servers not provided at .html pages', () => { | ||
cy.visit('e2e/e2e.html'); | ||
cy.window().then(async win => { | ||
const spec = await loadSpec('/demo/openapi.yaml'); | ||
delete spec.servers; | ||
initReDoc(win, spec, {}); | ||
|
||
// TODO add cy-data attributes | ||
cy.get('[data-section-id="operation/addPet"]').should( | ||
'contain', | ||
'http://localhost:' + win.location.port + '/e2e/pet', | ||
); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters