From 76836d053993fa89d328730456dc0fe38c18ff02 Mon Sep 17 00:00:00 2001 From: Adam Altman Date: Wed, 20 Jan 2016 07:50:11 -0600 Subject: [PATCH 1/5] Fix typo in api-info spec --- lib/components/ApiInfo/api-info.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)'); From f64d4180a6d327aa3966a29e660049640a4dd6a5 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Wed, 20 Jan 2016 18:02:13 +0200 Subject: [PATCH 2/5] Basic responsiveness --- lib/components/Method/method.scss | 25 ++++++++++++++++++++ lib/components/MethodsList/methods-list.scss | 12 +++++----- 2 files changed, 31 insertions(+), 6 deletions(-) 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; + } +} From 528b1c4728d18c622797101fb1402a564a373109 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Wed, 20 Jan 2016 18:31:32 +0200 Subject: [PATCH 3/5] Run e2e on full APIs guru list only on tags --- tests/e2e/helpers.js | 14 +++++++++++++- tests/e2e/redoc.spec.js | 11 ++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) 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; From 602bedc3f7e6bf93b2d5d4cc3d1243aa547887b1 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Wed, 20 Jan 2016 18:34:10 +0200 Subject: [PATCH 4/5] v0.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" From dd72d42285e0f953cf4f819cc18f5359fa07ec8d Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Wed, 20 Jan 2016 19:24:05 +0200 Subject: [PATCH 5/5] Deploy only after unit tests --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) 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