diff --git a/.gitignore b/.gitignore
index 38afc934..e8d87581 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,4 @@ jspm_packages
/demo/build
.tmp
/coverage
+.ghpages-tmp
diff --git a/.travis.yml b/.travis.yml
index 077a1cc3..208306e8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -41,11 +41,7 @@ deploy:
secure: PuhWLERrCEFmXmdFpw2OVFlqpOIVDmgwk5JUJOYaFdVCh/smp0+jZCQ4vrdFpuG96rnDVirD+A8xvW6NgsNNaRthLgOB/LRdFN69rU6Gvn3At6wlnC55t5dlhxPvCfnzJcHVBLXX4EmMkjnZqDg2uczXTzPodr3FnQJNuXmP8B33fzDVLyHccvXZ90abwXWVrgRIXPU28niqCR8DOC2OTzs7wqz+BLNkYDRRbyYXsg62HWuD33x5iof5IqBmhzBt3usCGmF3QGcgHrXHdZw3sZnit8+Bua++3KrXR0x6HGXXN1AoXVmCAkCa5OTQ5R3tCRxiJN3P2KLnvWeZR74sTFkovJB/6pGCvbJ/c7Wnuw6sD7SgOUBD359ULB6lAf5OnxBLoNebX4JxxVXF+zA4E3Bl44VxkzDpPWc15xqBPMB5vBREzMVmJ5mExn2s5cmLQjADbl9h0y6gZnhnNJ+iTmqtrVyM0ZkF2rPrzrTdGD+ULmRIlTMkdD1bh+/TJ3RdXT3P4/zNUJmiNnvgnnJVYYvsGaXWF+7uCVHT/8k2RsoSHqgkqh0gkDqGSwVix55y5mC7T2Vk9lMBhm6MvFJXaonOX0kxJS4EDQ3plPd6/ybG+TLhwggYnQ8o9msU5Nt6FpUShKiezjKurIhbQZdwlVivX3tahjW2QjNDO58xGgY=
on:
tags: true
- - skip_cleanup: true
- provider: script
- script: npm run github-release
- on:
- tags: true
+ condition: $JOB != e2e
- skip_cleanup: true
provider: script
script: npm run branch-release
@@ -56,5 +52,5 @@ deploy:
provider: script
script: npm run deploy
on:
- branch: master
+ tags: true
condition: $JOB != e2e
diff --git a/build/paths.js b/build/paths.js
index e2f27ffe..988f2cc8 100644
--- a/build/paths.js
+++ b/build/paths.js
@@ -9,7 +9,8 @@ var paths = {
output: 'dist/',
tmp: '.tmp/',
demo: 'demo/**/*',
- tests: '{lib,tests}/**/*.spec.js'
+ tests: '{lib,tests}/**/*.spec.js',
+ releases: 'demo/releases/'
}
paths.redocBuilt = path.join(paths.output, paths.outputName);
diff --git a/build/prepare_deploy.sh b/build/prepare_deploy.sh
index c55a08ae..137f404c 100755
--- a/build/prepare_deploy.sh
+++ b/build/prepare_deploy.sh
@@ -1,6 +1,15 @@
#!/bin/bash
set -e
set -x
+mkdir -p .ghpages-tmp && cd .ghpages-tmp
+git checkout gh-pages
+cp -R ../releases/* .
+git checkout master
+cd -
+gulp build
cd demo
cp -R ../dist ./dist
+mkdir -p releases
+cp -R ../.ghpages-tmp/* ./releases/
cd -
+gulp copy-version
diff --git a/build/tasks/build.js b/build/tasks/build.js
index ef14693b..6897c0a0 100644
--- a/build/tasks/build.js
+++ b/build/tasks/build.js
@@ -28,8 +28,7 @@ gulp.task('buildDev', function (callback) {
);
});
-
-gulp.task('bundle', ['buildStatic', 'concatDeps']);
+gulp.task('bundle', ['concatPrism', 'buildStatic', 'concatDeps']);
gulp.task('bundleProd', ['bundle', 'buildStaticMin', 'concatDepsMin']);
gulp.task('inlineTemplates', ['sass'], function() {
@@ -101,3 +100,35 @@ function bundle(outputFile, minify, cb) {
cb(new Error(err));
});
}
+
+gulp.task('concatPrism', function() {
+ require('../../system.config.js');
+ var prismFolder = System.normalizeSync('prismjs').substring(8);
+ prismFolder = prismFolder.substring(0, prismFolder.length -3);
+ var prismFiles = [
+ 'prism.js',
+ 'components/prism-actionscript.js',
+ 'components/prism-c.js',
+ 'components/prism-cpp.js',
+ 'components/prism-csharp.js',
+ 'components/prism-php.js',
+ 'components/prism-coffeescript.js',
+ 'components/prism-go.js',
+ 'components/prism-haskell.js',
+ 'components/prism-java.js',
+ 'components/prism-lua.js',
+ 'components/prism-matlab.js',
+ 'components/prism-perl.js',
+ 'components/prism-python.js',
+ 'components/prism-r.js',
+ 'components/prism-ruby.js',
+ 'components/prism-bash.js',
+ 'components/prism-swift.js',
+ 'components/prism-objectivec.js',
+ 'components/prism-scala.js'
+ ].map(file => path.join(prismFolder, file));
+
+ gulp.src(prismFiles)
+ .pipe(concat(path.join(paths.tmp, 'prismjs-bundle.js')))
+ .pipe(gulp.dest('.'))
+});
diff --git a/build/tasks/copy-version.js b/build/tasks/copy-version.js
new file mode 100644
index 00000000..aaf93012
--- /dev/null
+++ b/build/tasks/copy-version.js
@@ -0,0 +1,10 @@
+var gulp = require('gulp');
+var path = require('path');
+var paths = require('../paths');
+
+gulp.task('copy-version', function() {
+ var tag = 'v' + require(path.join(__dirname, '../../package.json')).version;
+ gulp.src(paths.redocBuilt + '.min.js')
+ .pipe(gulp.dest(path.join(paths.releases, tag)))
+ .pipe(gulp.dest(path.join(paths.releases, 'latest')));
+});
diff --git a/build/tasks/github-release.js b/build/tasks/github-release.js
deleted file mode 100644
index d2303cb2..00000000
--- a/build/tasks/github-release.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var gulp = require('gulp');
-var release = require('gulp-github-release');
-var path = require('path');
-var paths = require('../paths');
-
-gulp.task('github-release', ['build'], function(){
- gulp.src(paths.redocBuilt + '.min.js')
- .pipe(release({
- token: process.env.GH_TOKEN,
- manifest: require(path.join(__dirname, '../../package.json'))
- }));
-});
diff --git a/build/tasks/test.js b/build/tasks/test.js
index 18d396f3..6b93998e 100644
--- a/build/tasks/test.js
+++ b/build/tasks/test.js
@@ -5,7 +5,7 @@ var Server = require('karma').Server;
/**
* Run test once and exit
*/
-gulp.task('test', ['inlineTemplates'], function (done) {
+gulp.task('test', ['concatPrism', 'inlineTemplates'], function (done) {
new Server({
configFile: __dirname + '/../../karma.conf.js',
singleRun: true
diff --git a/karma.conf.js b/karma.conf.js
index bf73baac..a9dc7af0 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -46,6 +46,8 @@ module.exports = function (config) {
//load angular dependencies and browser polyfills
files: [
'node_modules/zone.js/dist/zone.js',
+ 'node_modules/zone.js/dist/fake-async-test.js',
+ 'node_modules/zone.js/dist/async-test.js',
'node_modules/zone.js/dist/jasmine-patch.js',
'node_modules/zone.js/dist/long-stack-trace-zone.js',
'node_modules/babel-polyfill/dist/polyfill.js',
@@ -55,7 +57,7 @@ module.exports = function (config) {
jspm: {
config: 'system.config.js',
loadFiles: ['tests/setup.js', 'tests/helpers.js', 'tests/unit/*.spec.js', 'lib/**/*.js'],
- serveFiles: ['tests/schemas/**/*.json','tests/schemas/**/*.yml', 'lib/**/*.html', '.tmp/lib/**/*.css'],
+ serveFiles: ['tests/schemas/**/*.json','tests/schemas/**/*.yml', 'lib/**/*.html', '.tmp/*js', '.tmp/lib/**/*.css'],
nocache: true
},
@@ -65,6 +67,7 @@ module.exports = function (config) {
'/lib/': '/base/lib/',
'/jspm_packages/': '/base/jspm_packages/',
'/node_modules/': '/base/node_modules/',
+ '/prismjs-bundle.js': '/base/.tmp/prismjs-bundle.js',
'/.tmp/': '/base/.tmp/'
},
reporters: travis ? ['mocha', 'coverage', 'coveralls'] : ['mocha', 'coverage'],
diff --git a/lib/common/components/DropDown/dropdown.scss b/lib/common/components/DropDown/dropdown.scss
index d9d2ef4b..93f6721c 100644
--- a/lib/common/components/DropDown/dropdown.scss
+++ b/lib/common/components/DropDown/dropdown.scss
@@ -1,13 +1,12 @@
@import '../../styles/variables';
-$silver: #666D71;
-$background-silver: #EEEFEF;
-$border: darken($background-silver, 2%);
-
:host {
.dk-select {
max-width: 100%;
- font-family: $headers-font;
+ font-family: $headers-font, $headers-font-family;
+ font-size: .929em;
+ min-width: 100px;
+ width: auto;
}
.dk-selected:after {
@@ -15,16 +14,11 @@ $border: darken($background-silver, 2%);
}
// button
-
.dk-selected {
- color: $silver;
- border-color: $silver;
- padding: 0.4em 0.9em 0.4em 0.4em;
- border-radius: 0.4rem;
- }
-
- .dk-select-open-down .dk-selected {
- border-radius: 0.4rem;
+ color: $secondary-color;
+ border-color: rgba($secondary-color, .5);
+ padding: 0.15em 0.6em 0.2em 0.5em;
+ border-radius: $border-radius;
}
.dk-select-open-down .dk-selected, .dk-selected:focus, .dk-selected:hover {
@@ -34,37 +28,45 @@ $border: darken($background-silver, 2%);
// tick
.dk-selected:before {
- border-top-color: $silver;
+ border-top-color: $secondary-color;
border-width: .35em .35em 0;
}
.dk-select-open-down .dk-selected:before,
.dk-select-open-up .dk-selected:before {
border-bottom-color: $primary-color;
- border-width: 0 .35em .35em;
}
// items
.dk-select-multi:focus .dk-select-options,
.dk-select-open-down .dk-select-options,
.dk-select-open-up .dk-select-options {
- border-color: $silver;
+ border-color: rgba($secondary-color, .2);
+ }
+
+ .dk-select-options .dk-option-highlight {
+ background: #ffffff;
}
.dk-select-options {
margin-top: 0.2em;
- border-radius: 0.4em;
+ padding: 0;
+ border-radius: $border-radius;
+ box-shadow: 0px 2px 4px 0px rgba(34, 36, 38, 0.12), 0px 2px 10px 0px rgba(34, 36, 38, 0.08) !important
}
.dk-option {
- color: $black;
- padding: 0.4em 0.4em;
+ color: $secondary-color;
+ padding: 0.16em 0.6em 0.2em 0.5em;
&:hover {
- background-color: $background-silver;
+ background-color: rgba($secondary-color, .12);
+ }
+ &:focus {
+ background-color: rgba($secondary-color, .12);
}
}
.dk-option-selected {
- background-color: $background-silver;
+ background-color: rgba(0, 0, 0, 0.05)!important;
}
}
diff --git a/lib/common/components/StickySidebar/sticky-sidebar.spec.js b/lib/common/components/StickySidebar/sticky-sidebar.spec.js
index 08cfe33c..58084d42 100644
--- a/lib/common/components/StickySidebar/sticky-sidebar.spec.js
+++ b/lib/common/components/StickySidebar/sticky-sidebar.spec.js
@@ -30,7 +30,7 @@ describe('Common components', () => {
builder.createAsync(TestApp).then(_fixture => {
fixture = _fixture;
let debugEl = getChildDebugElementByType(fixture.debugElement, StickySidebar);
- component = debugEl.componentInstance;
+ component = debugEl.injector.get(StickySidebar);
done();
}, err => done.fail(err));
});
diff --git a/lib/common/components/Tabs/tabs.js b/lib/common/components/Tabs/tabs.js
index d869df20..d8b23da1 100644
--- a/lib/common/components/Tabs/tabs.js
+++ b/lib/common/components/Tabs/tabs.js
@@ -8,7 +8,7 @@ import {CORE_DIRECTIVES} from 'angular2/common';
events: ['change'],
template: `
@@ -61,7 +61,7 @@ export class Tabs {
selector: 'tab',
inputs: ['tabTitle', 'tabStatus'],
template: `
-
+
`,
diff --git a/lib/components/ApiInfo/api-info.spec.js b/lib/components/ApiInfo/api-info.spec.js
index ae5e8b83..87bcbc0e 100644
--- a/lib/components/ApiInfo/api-info.spec.js
+++ b/lib/components/ApiInfo/api-info.spec.js
@@ -5,7 +5,8 @@ import {Component, provide} from 'angular2/core';
import {
TestComponentBuilder,
- injectAsync,
+ async,
+ inject,
beforeEach,
beforeEachProviders,
it
@@ -26,10 +27,12 @@ describe('Redoc components', () => {
provide(SchemaManager, {useValue: new SchemaManager()}),
provide(OptionsManager, {useValue: optsMgr})
]);
- beforeEach(injectAsync([TestComponentBuilder, SchemaManager], (tcb, schemaMgr) => {
+
+ beforeEach(async(inject([TestComponentBuilder, SchemaManager], (tcb, schemaMgr) => {
builder = tcb;
- return schemaMgr.load('/tests/schemas/api-info-test.json').then(() => null, (err) => { throw err; });
- }));
+ return schemaMgr.load('/tests/schemas/api-info-test.json');
+ })));
+
beforeEach((done) => {
builder.createAsync(TestApp).then(_fixture => {
fixture = _fixture;
diff --git a/lib/components/ApiLogo/api-logo.spec.js b/lib/components/ApiLogo/api-logo.spec.js
index 41976344..946f36c8 100644
--- a/lib/components/ApiLogo/api-logo.spec.js
+++ b/lib/components/ApiLogo/api-logo.spec.js
@@ -5,7 +5,8 @@ import {Component, provide} from 'angular2/core';
import {
TestComponentBuilder,
- injectAsync,
+ async,
+ inject,
beforeEach,
beforeEachProviders,
it
@@ -26,11 +27,11 @@ describe('Redoc components', () => {
beforeEachProviders(() => [
provide(SchemaManager, {useValue: new SchemaManager()})
]);
- beforeEach(injectAsync([TestComponentBuilder, SchemaManager], (tcb, _schemaMgr) => {
+ beforeEach(async(inject([TestComponentBuilder, SchemaManager], (tcb, _schemaMgr) => {
builder = tcb;
schemaMgr = _schemaMgr;
- return schemaMgr.load(schemaUrl).then(() => null, (err) => { throw err; });
- }));
+ return schemaMgr.load(schemaUrl);
+ })));
beforeEach((done) => {
builder.createAsync(TestApp).then(_fixture => {
fixture = _fixture;
diff --git a/lib/components/JsonSchema/json-schema-common.scss b/lib/components/JsonSchema/json-schema-common.scss
index c03e356b..4b2d2953 100644
--- a/lib/components/JsonSchema/json-schema-common.scss
+++ b/lib/components/JsonSchema/json-schema-common.scss
@@ -70,7 +70,7 @@ $sub-schema-offset: ($bullet-size/2) + $bullet-margin;
}
.param-type {
- color: $black;
+ color: rgba($black, 0.4);
font-size: 0.929em;
line-height: $param-name-height;
vertical-align: middle;
@@ -83,10 +83,6 @@ $sub-schema-offset: ($bullet-size/2) + $bullet-margin;
font-weight: $base-font-weight;
}
-.param-type {
- color: rgba($black, 0.4);
-}
-
.param-type.with-hint {
display: inline-block;
margin-bottom: 0.4em;
diff --git a/lib/components/JsonSchema/json-schema-lazy.js b/lib/components/JsonSchema/json-schema-lazy.js
index 47a98624..13457319 100644
--- a/lib/components/JsonSchema/json-schema-lazy.js
+++ b/lib/components/JsonSchema/json-schema-lazy.js
@@ -1,6 +1,6 @@
'use strict';
-import {Component, ElementRef} from 'angular2/core';
+import {Component, ElementRef, ViewContainerRef} from 'angular2/core';
import {CORE_DIRECTIVES} from 'angular2/common';
import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader';
@@ -18,10 +18,11 @@ var cache = {};
template: '',
directives: [CORE_DIRECTIVES]
})
-@Reflect.metadata('parameters', [[SchemaManager], [ElementRef], [DynamicComponentLoader], [OptionsManager]])
+@Reflect.metadata('parameters', [[SchemaManager], [ViewContainerRef], [ElementRef], [DynamicComponentLoader], [OptionsManager]])
export default class JsonSchemaLazy {
- constructor(schemaMgr, elementRef, dcl, optionsMgr) {
+ constructor(schemaMgr, viewRef, elementRef, dcl, optionsMgr) {
+ this.viewRef = viewRef;
this.elementRef = elementRef;
this.dcl = dcl;
this.optionsMgr = optionsMgr;
@@ -37,7 +38,7 @@ export default class JsonSchemaLazy {
if (this.optionsMgr.options.disableLazySchemas) return;
if (this.loaded) return;
if (this.pointer) {
- this.dcl.loadNextToLocation(JsonSchema, this.elementRef).then((compRef) => {
+ this.dcl.loadNextToLocation(JsonSchema, this.viewRef).then((compRef) => {
this.initComponent(compRef);
// trigger change detection
compRef.hostView.changeDetectorRef.detectChanges();
@@ -57,9 +58,9 @@ export default class JsonSchemaLazy {
// skip caching view with tabs inside (discriminator) as it needs attached controller
// FIXME: get rid of dependency on selector
if ($element.querySelector('.discriminator-wrap')) {
- this.dcl.loadNextToLocation(JsonSchema, this.elementRef).then((compRef) => {
+ this.dcl.loadNextToLocation(JsonSchema, this.viewRef).then((compRef) => {
this.initComponent(compRef);
- compRef.hostView.changeDetectorRef.markForCheck();
+ compRef.hostView.changeDetectorRef.detectChanges();
});
return;
}
@@ -67,9 +68,9 @@ export default class JsonSchemaLazy {
} );
});
} else {
- cache[this.pointer] = this.dcl.loadNextToLocation(JsonSchema, this.elementRef).then((compRef) => {
+ cache[this.pointer] = this.dcl.loadNextToLocation(JsonSchema, this.viewRef).then((compRef) => {
this.initComponent(compRef);
- compRef.hostView.changeDetectorRef.markForCheck();
+ compRef.hostView.changeDetectorRef.detectChanges();
return compRef;
});
}
diff --git a/lib/components/JsonSchema/json-schema.html b/lib/components/JsonSchema/json-schema.html
index f633f901..17f56144 100644
--- a/lib/components/JsonSchema/json-schema.html
+++ b/lib/components/JsonSchema/json-schema.html
@@ -5,13 +5,17 @@
{{schema._range}}
- {{enumItem.val | json}}
+ {{enumItem.val | json}}
-
-
+
+
{{prop._name}}
|
@@ -23,14 +27,14 @@
Required
- {{enumItem.val | json}}
+ {{enumItem.val | json}}
This field value determines the exact schema:
-
@@ -46,7 +50,7 @@
-
+
diff --git a/lib/components/JsonSchema/json-schema.js b/lib/components/JsonSchema/json-schema.js
index d40a34f9..8ab92146 100644
--- a/lib/components/JsonSchema/json-schema.js
+++ b/lib/components/JsonSchema/json-schema.js
@@ -89,7 +89,7 @@ export default class JsonSchema extends BaseComponent {
}
let discriminatorFieldIdx = -1;
- let props = Object.keys(schema.properties).map((prop, idx) => {
+ let props = schema.properties && Object.keys(schema.properties).map((prop, idx) => {
let propertySchema = schema.properties[prop];
let propPointer = propertySchema._pointer ||
JsonPointer.join(schema._pointer || this.pointer, ['properties', prop]);
@@ -105,6 +105,15 @@ export default class JsonSchema extends BaseComponent {
}
return propertySchema;
});
+
+ props = props || [];
+
+ if (schema.additionalProperties && schema.additionalProperties !== false) {
+ let propsSchema = this.prepareAdditionalProperties(schema.additionalProperties);
+ propsSchema._additional = true;
+ props.push(propsSchema);
+ }
+
// Move discriminator field to the end of properties list
if (discriminatorFieldIdx > -1) {
let discrProp = props.splice(discriminatorFieldIdx, 1);
@@ -116,6 +125,11 @@ export default class JsonSchema extends BaseComponent {
schema.properties = props;
}
+ prepareAdditionalProperties(schema) {
+ return JsonSchema.injectPropertyData(schema, ' *',
+ JsonPointer.join(schema._pointer || this.pointer, ['additionalProperties']));
+ }
+
static injectPropertyData(propertySchema, propertyName, propPointer) {
propertySchema = Object.assign({}, propertySchema);
@@ -190,7 +204,8 @@ const injectors = {
simpleType: {
check: (propertySchema) => {
if (propertySchema.type === 'object') {
- return !propertySchema.properties || !Object.keys(propertySchema.properties).length;
+ return (!propertySchema.properties || !Object.keys(propertySchema.properties).length)
+ && (typeof propertySchema.additionalProperties !== 'object');
}
return (propertySchema.type !== 'array') && propertySchema.type;
},
diff --git a/lib/components/JsonSchema/json-schema.scss b/lib/components/JsonSchema/json-schema.scss
index a24d883f..ef7d29a8 100644
--- a/lib/components/JsonSchema/json-schema.scss
+++ b/lib/components/JsonSchema/json-schema.scss
@@ -73,6 +73,10 @@ json-schema[nesteven="true"] {
border-bottom: 0;
}
+.param.additional > .param-name {
+ color: rgba($black, 0.4);
+}
+
.params-wrap {
border-collapse: collapse;
width: 100%;
diff --git a/lib/components/Method/method.html b/lib/components/Method/method.html
index 66bb8814..f3453aff 100644
--- a/lib/components/Method/method.html
+++ b/lib/components/Method/method.html
@@ -4,7 +4,7 @@
{{data.methodInfo.summary}}
diff --git a/lib/components/Method/method.spec.js b/lib/components/Method/method.spec.js
index 792b959e..89d5ad1b 100644
--- a/lib/components/Method/method.spec.js
+++ b/lib/components/Method/method.spec.js
@@ -6,7 +6,8 @@ import {BrowserDomAdapter} from 'angular2/platform/browser';
import {
TestComponentBuilder,
- injectAsync,
+ async,
+ inject,
beforeEach,
beforeEachProviders,
it
@@ -25,10 +26,10 @@ describe('Redoc components', () => {
provide(BrowserDomAdapter, {useClass: BrowserDomAdapter}),
provide(OptionsManager, {useClass: OptionsManager})
]);
- beforeEach(injectAsync([TestComponentBuilder, SchemaManager], (tcb, schemaMgr) => {
+ beforeEach(async(inject([TestComponentBuilder, SchemaManager], (tcb, schemaMgr) => {
builder = tcb;
- return schemaMgr.load('/tests/schemas/extended-petstore.yml').then(() => null, (err) => { throw err; });
- }));
+ return schemaMgr.load('/tests/schemas/extended-petstore.yml');
+ })));
beforeEach((done) => {
builder.createAsync(TestApp).then(fixture => {
component = getChildDebugElement(fixture.debugElement, 'method').componentInstance;
diff --git a/lib/components/MethodsList/methods-list.html b/lib/components/MethodsList/methods-list.html
index 86a00c90..e8f134cf 100644
--- a/lib/components/MethodsList/methods-list.html
+++ b/lib/components/MethodsList/methods-list.html
@@ -1,10 +1,10 @@
-
diff --git a/lib/components/MethodsList/methods-list.spec.js b/lib/components/MethodsList/methods-list.spec.js
index ce12b4c8..22cba67b 100644
--- a/lib/components/MethodsList/methods-list.spec.js
+++ b/lib/components/MethodsList/methods-list.spec.js
@@ -7,7 +7,8 @@ import {BrowserDomAdapter} from 'angular2/platform/browser';
import {
TestComponentBuilder,
- injectAsync,
+ inject,
+ async,
beforeEach,
beforeEachProviders,
it
@@ -26,10 +27,10 @@ describe('Redoc components', () => {
provide(OptionsManager, {useClass: OptionsManager}),
provide(BrowserDomAdapter, {useClass: BrowserDomAdapter})
]);
- beforeEach(injectAsync([TestComponentBuilder, SchemaManager], (tcb, schemaMgr) => {
+ beforeEach(async(inject([TestComponentBuilder, SchemaManager], (tcb, schemaMgr) => {
builder = tcb;
- return schemaMgr.load('/tests/schemas/methods-list-component.json').then(() => null, (err) => { throw err; });
- }));
+ return schemaMgr.load('/tests/schemas/methods-list-component.json');
+ })));
beforeEach((done) => {
builder.createAsync(TestApp).then(_fixture => {
fixture = _fixture;
diff --git a/lib/components/ParamsList/params-list.html b/lib/components/ParamsList/params-list.html
index bdffe020..fa673090 100644
--- a/lib/components/ParamsList/params-list.html
+++ b/lib/components/ParamsList/params-list.html
@@ -1,12 +1,12 @@
-
+
{{paramType.place}} Parameters
?
-
+
{{param.name}}
@@ -16,7 +16,7 @@
title="{{param._displayTypeHint}}"> {{param._displayType}} {{param._displayFormat}}
Required
- {{enumItem.val | json}}
+ {{enumItem.val | json}}
diff --git a/lib/components/Redoc/redoc.js b/lib/components/Redoc/redoc.js
index e1bceb4b..3858d92e 100644
--- a/lib/components/Redoc/redoc.js
+++ b/lib/components/Redoc/redoc.js
@@ -66,7 +66,7 @@ export default class Redoc extends BaseComponent {
];
if (Redoc.appRef) {
- Redoc.dispose();
+ Redoc.destroy();
}
Redoc.showLoadingAnimation();
return SchemaManager.instance().load(specUrl)
@@ -102,7 +102,7 @@ export default class Redoc extends BaseComponent {
}
}
- static dispose() {
+ static destroy() {
let el = dom.query('redoc');
let elClone;
let parent;
@@ -115,10 +115,10 @@ export default class Redoc extends BaseComponent {
elClone = el.cloneNode(false);
if (Redoc.appRef) {
- Redoc.appRef.dispose();
+ Redoc.appRef.destroy();
Redoc.appRef = null;
- // Redoc dispose removes host element, so need to restore it
+ // Redoc destroy removes host element, so need to restore it
elClone.innerHTML = 'Loading...';
parent && parent.insertBefore(elClone, nextSibling);
}
diff --git a/lib/components/Redoc/redoc.spec.js b/lib/components/Redoc/redoc.spec.js
index fd7b1462..b6bcaac6 100644
--- a/lib/components/Redoc/redoc.spec.js
+++ b/lib/components/Redoc/redoc.spec.js
@@ -6,7 +6,8 @@ import {BrowserDomAdapter} from 'angular2/platform/browser';
import {
TestComponentBuilder,
- injectAsync,
+ inject,
+ async,
beforeEach,
beforeEachProviders,
it
@@ -26,10 +27,10 @@ describe('Redoc components', () => {
provide(BrowserDomAdapter, {useValue: new BrowserDomAdapter()}),
provide(OptionsManager, {useValue: optsMgr})
]);
- beforeEach(injectAsync([TestComponentBuilder, SchemaManager], (tcb, schemaMgr) => {
+ beforeEach(async(inject([TestComponentBuilder, SchemaManager], (tcb, schemaMgr) => {
builder = tcb;
- return schemaMgr.load('/tests/schemas/extended-petstore.yml').then(() => null, (err) => { throw err; });
- }));
+ return schemaMgr.load('/tests/schemas/extended-petstore.yml');
+ })));
it('should init component', (done) => {
@@ -141,29 +142,29 @@ describe('Redoc components', () => {
});
});
- describe('Redoc dispose', () => {
+ describe('Redoc destroy', () => {
let builder;
let fixture;
let element;
- let disposeSpy;
+ let destroySpy;
let dom = new BrowserDomAdapter();
beforeEachProviders(() => [
provide(SchemaManager, {useValue: new SchemaManager()}),
provide(BrowserDomAdapter, {useValue: new BrowserDomAdapter()}),
provide(OptionsManager, {useValue: optsMgr})
]);
- beforeEach(injectAsync([TestComponentBuilder, SchemaManager], (tcb, schemaMgr) => {
+ beforeEach(async(inject([TestComponentBuilder, SchemaManager], (tcb, schemaMgr) => {
builder = tcb;
- return schemaMgr.load('/tests/schemas/methods-list-component.json').then(() => null, (err) => { throw err; });
- }));
+ return schemaMgr.load('/tests/schemas/methods-list-component.json');
+ })));
beforeEach((done) => {
builder.createAsync(TestApp).then(_fixture => {
fixture = _fixture;
element = getChildDebugElement(fixture.debugElement, 'methods-list').nativeElement;
- disposeSpy = jasmine.createSpy('spy');
+ destroySpy = jasmine.createSpy('spy');
Redoc.appRef = {
- dispose: disposeSpy
+ destroy: destroySpy
};
fixture.detectChanges();
done();
@@ -175,20 +176,20 @@ describe('Redoc components', () => {
Redoc.appRef = null;
});
- it('should call componentRef.dispose', () => {
- Redoc.dispose();
- expect(disposeSpy).toHaveBeenCalled();
+ it('should call componentRef.destroy', () => {
+ Redoc.destroy();
+ expect(destroySpy).toHaveBeenCalled();
});
it('should create new host element', () => {
element.parentElement.removeChild(element);
- Redoc.dispose();
+ Redoc.destroy();
expect(dom.query('redoc')).not.toBeNull();
dom.query('redoc').should.not.be.equal(element);
});
it('should set to null appRef', () => {
- Redoc.dispose();
+ Redoc.destroy();
expect(Redoc.appRef).toBeNull();
});
});
diff --git a/lib/components/RequestSamples/request-samples.html b/lib/components/RequestSamples/request-samples.html
index 60ede141..78bb0657 100644
--- a/lib/components/RequestSamples/request-samples.html
+++ b/lib/components/RequestSamples/request-samples.html
@@ -4,7 +4,7 @@
-
+
diff --git a/lib/components/ResponsesList/responses-list.html b/lib/components/ResponsesList/responses-list.html
index 9fd2d762..15d643ca 100644
--- a/lib/components/ResponsesList/responses-list.html
+++ b/lib/components/ResponsesList/responses-list.html
@@ -1,11 +1,11 @@
-
|