diff --git a/.travis.yml b/.travis.yml index d419783a..0252e24c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,11 +37,13 @@ deploy: script: ./build/deploy_gh_pages.sh on: branch: master + condition: $JOB != e2e - skip_cleanup: true provider: script script: npm run branch-release on: branch: master + condition: $JOB != e2e - provider: npm skip_cleanup: true email: gotsijroman@gmail.com diff --git a/lib/components/ApiInfo/api-info.spec.js b/lib/components/ApiInfo/api-info.spec.js index d44e1d97..d9f9e95f 100644 --- a/lib/components/ApiInfo/api-info.spec.js +++ b/lib/components/ApiInfo/api-info.spec.js @@ -37,13 +37,13 @@ describe('Redoc components', () => { }); - it('shold init component data', () => { + it('should init component data', () => { expect(component).not.toBeNull(); expect(component.data).not.toBeNull(); 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 headerElement = nativeElement.querySelector('h1'); expect(headerElement).toHaveText('Swagger Petstore (1.0.0)'); diff --git a/lib/components/Method/method.scss b/lib/components/Method/method.scss index ac890e96..2dcc7fa7 100644 --- a/lib/components/Method/method.scss +++ b/lib/components/Method/method.scss @@ -1,6 +1,12 @@ @import '../../common/styles/variables'; @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 { display: block; } @@ -71,6 +77,7 @@ responses-list, params-list { color: $sample-panel-color; width: 40%; padding: 10px 20px; + background: $samples-panel-bg-color; } responses-samples { @@ -128,3 +135,21 @@ responses-samples { .http-method.head { 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; + } +} diff --git a/lib/components/MethodsList/methods-list.scss b/lib/components/MethodsList/methods-list.scss index fcd6ffde..8bbc0fcb 100644 --- a/lib/components/MethodsList/methods-list.scss +++ b/lib/components/MethodsList/methods-list.scss @@ -1,12 +1,6 @@ @import '../../common/styles/variables'; @import '../../common/styles/share-link'; -method { - padding-bottom: 100px; - display: block; - border-bottom: 2px solid rgba(127, 127, 127, 0.25); -} - .tag-info { padding: 0 20px; box-sizing: border-box; @@ -39,3 +33,9 @@ method { position: absolute; z-index: -1; } + +@media (max-width: 1100px) { + .methods:before { + display: none; + } +} diff --git a/package.json b/package.json index 8e4baf1e..dd645a23 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "redoc", "description": "Swagger-generated API Reference Documentation", - "version": "0.2.0", + "version": "0.3.0", "repository": { "type": "git", "url": "git://github.com/Rebilly/ReDoc" diff --git a/tests/e2e/helpers.js b/tests/e2e/helpers.js index 0b570074..8c097368 100644 --- a/tests/e2e/helpers.js +++ b/tests/e2e/helpers.js @@ -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 = { loadJson: loadJson, verifyNoBrowserErrors: verifyNoBrowserErrors, scrollToEl: scrollToEl, - fixFFTest: fixFFTest + fixFFTest: fixFFTest, + eachNth: eachNth } diff --git a/tests/e2e/redoc.spec.js b/tests/e2e/redoc.spec.js index 0f88407d..e53a3a03 100644 --- a/tests/e2e/redoc.spec.js +++ b/tests/e2e/redoc.spec.js @@ -2,6 +2,7 @@ const verifyNoBrowserErrors = require('./helpers').verifyNoBrowserErrors; const scrollToEl = require('./helpers').scrollToEl; const fixFFTest = require('./helpers').fixFFTest; +const eachNth = require('./helpers').eachNth; const URL = 'index.html'; @@ -35,7 +36,7 @@ basicTests(null, 'Extended Petstore'); describe('Scroll sync', () => { let specUrl = URL; - + beforeEach((done) => { browser.get(specUrl); fixFFTest(done); @@ -59,6 +60,14 @@ describe('APIs.guru specs test', ()=> { delete apisGuruList['googleapis.com:mirror']; // bad urls in images 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)) { let apiInfo = apisGuruList[apiName].versions[apisGuruList[apiName].preferred]; let url = apiInfo.swaggerUrl;