More test + fix decodeURIComponent call
Previously I was calling decodeURIComponent on regex match result which was an array. This fixes that and alos adds more tests
This commit is contained in:
4
dist/index.html
vendored
4
dist/index.html
vendored
@@ -24,9 +24,9 @@
|
|||||||
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
|
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
var url = decodeURIComponent(window.location.search.match(/url=([^&]+)/));
|
var url = window.location.search.match(/url=([^&]+)/);
|
||||||
if (url && url.length > 1) {
|
if (url && url.length > 1) {
|
||||||
url = url[1];
|
url = decodeURIComponent(url[1]);
|
||||||
} else {
|
} else {
|
||||||
url = "http://petstore.swagger.wordnik.com/v2/swagger.json";
|
url = "http://petstore.swagger.wordnik.com/v2/swagger.json";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,9 +24,9 @@
|
|||||||
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
|
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
var url = decodeURIComponent(window.location.search.match(/url=([^&]+)/));
|
var url = window.location.search.match(/url=([^&]+)/);
|
||||||
if (url && url.length > 1) {
|
if (url && url.length > 1) {
|
||||||
url = url[1];
|
url = decodeURIComponent(url[1]);
|
||||||
} else {
|
} else {
|
||||||
url = "http://petstore.swagger.wordnik.com/v2/swagger.json";
|
url = "http://petstore.swagger.wordnik.com/v2/swagger.json";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,33 @@ describe('basics', function (done) {
|
|||||||
checkConsoleErrors();
|
checkConsoleErrors();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
describe('should render key elements in document', function () {
|
||||||
|
var elementQueries = [
|
||||||
|
'swagger-ui-container',
|
||||||
|
'resources_container',
|
||||||
|
'api_info',
|
||||||
|
'resource_pet',
|
||||||
|
'resource_store',
|
||||||
|
'resource_user',
|
||||||
|
'header'
|
||||||
|
];
|
||||||
|
|
||||||
|
this.timeout(10000);
|
||||||
|
|
||||||
|
elementQueries.forEach(function (id) {
|
||||||
|
|
||||||
|
it('should render element: ' + id, function (done) {
|
||||||
|
|
||||||
|
var locator = webdriver.By.id(id)
|
||||||
|
driver.isElementPresent(locator).then(function (isPresent) {
|
||||||
|
expect(isPresent).to.be.true;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
describe('cleanup', function () {
|
describe('cleanup', function () {
|
||||||
it('kills the static server', function () {
|
it('kills the static server', function () {
|
||||||
server.close();
|
server.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user