Merge branch 'master' into releases

This commit is contained in:
RedocBot 2016-01-20 17:38:37 +00:00 committed by travis@localhost
commit ffd9cb5510
7 changed files with 59 additions and 11 deletions

View File

@ -37,11 +37,13 @@ deploy:
script: ./build/deploy_gh_pages.sh script: ./build/deploy_gh_pages.sh
on: on:
branch: master branch: master
condition: $JOB != e2e
- skip_cleanup: true - skip_cleanup: true
provider: script provider: script
script: npm run branch-release script: npm run branch-release
on: on:
branch: master branch: master
condition: $JOB != e2e
- provider: npm - provider: npm
skip_cleanup: true skip_cleanup: true
email: gotsijroman@gmail.com email: gotsijroman@gmail.com

View File

@ -37,13 +37,13 @@ describe('Redoc components', () => {
}); });
it('shold init component data', () => { it('should init component data', () => {
expect(component).not.toBeNull(); expect(component).not.toBeNull();
expect(component.data).not.toBeNull(); expect(component.data).not.toBeNull();
component.data.title.should.be.equal('Swagger Petstore'); component.data.title.should.be.equal('Swagger Petstore');
}); });
it('shold render api name and version', () => { it('should render api name and version', () => {
let nativeElement = getChildDebugElement(fixture.debugElement, 'api-info').nativeElement; let nativeElement = getChildDebugElement(fixture.debugElement, 'api-info').nativeElement;
let headerElement = nativeElement.querySelector('h1'); let headerElement = nativeElement.querySelector('h1');
expect(headerElement).toHaveText('Swagger Petstore (1.0.0)'); expect(headerElement).toHaveText('Swagger Petstore (1.0.0)');

View File

@ -1,6 +1,12 @@
@import '../../common/styles/variables'; @import '../../common/styles/variables';
@import '../../common/styles/share-link'; @import '../../common/styles/share-link';
:host {
padding-bottom: 100px;
display: block;
border-bottom: 2px solid rgba(127, 127, 127, 0.25);
}
responses-list, params-list { responses-list, params-list {
display: block; display: block;
} }
@ -71,6 +77,7 @@ responses-list, params-list {
color: $sample-panel-color; color: $sample-panel-color;
width: 40%; width: 40%;
padding: 10px 20px; padding: 10px 20px;
background: $samples-panel-bg-color;
} }
responses-samples { responses-samples {
@ -128,3 +135,21 @@ responses-samples {
.http-method.head { .http-method.head {
background-color: darkkhaki; background-color: darkkhaki;
} }
@media (max-width: 1100px) {
.methods:before {
display: none;
}
.method-samples, .method-content {
width: 100%;
}
.method-samples {
margin-top: 2em;
}
:host {
padding-bottom: 0;
}
}

View File

@ -1,12 +1,6 @@
@import '../../common/styles/variables'; @import '../../common/styles/variables';
@import '../../common/styles/share-link'; @import '../../common/styles/share-link';
method {
padding-bottom: 100px;
display: block;
border-bottom: 2px solid rgba(127, 127, 127, 0.25);
}
.tag-info { .tag-info {
padding: 0 20px; padding: 0 20px;
box-sizing: border-box; box-sizing: border-box;
@ -39,3 +33,9 @@ method {
position: absolute; position: absolute;
z-index: -1; z-index: -1;
} }
@media (max-width: 1100px) {
.methods:before {
display: none;
}
}

View File

@ -1,7 +1,7 @@
{ {
"name": "redoc", "name": "redoc",
"description": "Swagger-generated API Reference Documentation", "description": "Swagger-generated API Reference Documentation",
"version": "0.2.0", "version": "0.3.0",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/Rebilly/ReDoc" "url": "git://github.com/Rebilly/ReDoc"

View File

@ -82,9 +82,21 @@ function fixFFTest(done) {
}) })
} }
/* picks each n-th property from object */
function eachNth(obj, n) {
let res = {};
Object.keys(obj).forEach((k, idx) => {
if (idx % n === 0) {
res[k] = obj[k];
}
});
return res;
}
module.exports = { module.exports = {
loadJson: loadJson, loadJson: loadJson,
verifyNoBrowserErrors: verifyNoBrowserErrors, verifyNoBrowserErrors: verifyNoBrowserErrors,
scrollToEl: scrollToEl, scrollToEl: scrollToEl,
fixFFTest: fixFFTest fixFFTest: fixFFTest,
eachNth: eachNth
} }

View File

@ -2,6 +2,7 @@
const verifyNoBrowserErrors = require('./helpers').verifyNoBrowserErrors; const verifyNoBrowserErrors = require('./helpers').verifyNoBrowserErrors;
const scrollToEl = require('./helpers').scrollToEl; const scrollToEl = require('./helpers').scrollToEl;
const fixFFTest = require('./helpers').fixFFTest; const fixFFTest = require('./helpers').fixFFTest;
const eachNth = require('./helpers').eachNth;
const URL = 'index.html'; const URL = 'index.html';
@ -59,6 +60,14 @@ describe('APIs.guru specs test', ()=> {
delete apisGuruList['googleapis.com:mirror']; // bad urls in images delete apisGuruList['googleapis.com:mirror']; // bad urls in images
delete apisGuruList['googleapis.com:discovery']; // non-string references delete apisGuruList['googleapis.com:discovery']; // non-string references
// run quick version of e2e test on all builds except releases
if (process.env.TRAVIS && !process.env.TRAVIS_TAG) {
console.log('Running on short APIs guru list');
apisGuruList = eachNth(apisGuruList, 10);
} else {
console.log('Running on full APIs guru list')
}
for (let apiName of Object.keys(apisGuruList)) { for (let apiName of Object.keys(apisGuruList)) {
let apiInfo = apisGuruList[apiName].versions[apisGuruList[apiName].preferred]; let apiInfo = apisGuruList[apiName].versions[apisGuruList[apiName].preferred];
let url = apiInfo.swaggerUrl; let url = apiInfo.swaggerUrl;