mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-27 15:30:34 +03:00
minor methods semantic fix
This commit is contained in:
parent
50d9213c6e
commit
ef968f61f2
|
@ -4,7 +4,7 @@
|
||||||
<a class="share-link" href="#{{tag}}{{pointer}}"></a>{{data.methodInfo.summary}}
|
<a class="share-link" href="#{{tag}}{{pointer}}"></a>{{data.methodInfo.summary}}
|
||||||
</h2>
|
</h2>
|
||||||
<h3 class="method-endpoint">
|
<h3 class="method-endpoint">
|
||||||
<span class="http-method" [ngClass]="data.method">{{data.method}}</span>
|
<span class="http-method" [ngClass]="data.httpMethod">{{data.httpMethod}}</span>
|
||||||
<span class="api-url">{{data.apiUrl}}</span> <span class="path">{{data.path}}</span>
|
<span class="api-url">{{data.apiUrl}}</span> <span class="path">{{data.path}}</span>
|
||||||
</h3>
|
</h3>
|
||||||
<div class="method-tags" *ngIf="data.methodInfo.tags.length">
|
<div class="method-tags" *ngIf="data.methodInfo.tags.length">
|
||||||
|
|
|
@ -22,7 +22,7 @@ export default class Method extends BaseComponent {
|
||||||
prepareModel() {
|
prepareModel() {
|
||||||
this.data = {};
|
this.data = {};
|
||||||
this.data.apiUrl = this.schemaMgr.apiUrl;
|
this.data.apiUrl = this.schemaMgr.apiUrl;
|
||||||
this.data.method = JsonPointer.baseName(this.pointer);
|
this.data.httpMethod = JsonPointer.baseName(this.pointer);
|
||||||
this.data.path = JsonPointer.baseName(this.pointer, 2);
|
this.data.path = JsonPointer.baseName(this.pointer, 2);
|
||||||
this.data.methodInfo = this.componentSchema;
|
this.data.methodInfo = this.componentSchema;
|
||||||
this.data.methodInfo.tags = this.filterMainTags(this.data.methodInfo.tags);
|
this.data.methodInfo.tags = this.filterMainTags(this.data.methodInfo.tags);
|
||||||
|
|
60
lib/components/Method/method.spec.js
Normal file
60
lib/components/Method/method.spec.js
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import { getChildDebugElement } from 'tests/helpers';
|
||||||
|
import {Component, View, provide} from 'angular2/core';
|
||||||
|
|
||||||
|
import {
|
||||||
|
TestComponentBuilder,
|
||||||
|
injectAsync,
|
||||||
|
beforeEach,
|
||||||
|
beforeEachProviders,
|
||||||
|
it
|
||||||
|
} from 'angular2/testing';
|
||||||
|
|
||||||
|
import Method from 'lib/components/Method/method';
|
||||||
|
import SchemaManager from 'lib/utils/SchemaManager';
|
||||||
|
|
||||||
|
|
||||||
|
describe('jjj Component', () => {
|
||||||
|
let builder;
|
||||||
|
beforeEachProviders(() => [
|
||||||
|
provide(SchemaManager, {useValue: new SchemaManager()})
|
||||||
|
]);
|
||||||
|
beforeEach(injectAsync([TestComponentBuilder, SchemaManager], (tcb, schemaMgr) => {
|
||||||
|
builder = tcb;
|
||||||
|
return schemaMgr.load('/tests/schemas/extended-petstore.json').then(() => null, (err) => { throw err; });
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
it('should init component', (done) => {
|
||||||
|
builder.createAsync(TestApp).then(fixture => {
|
||||||
|
let component = getChildDebugElement(fixture.debugElement, 'method').componentInstance;
|
||||||
|
expect(component).not.toBeNull();
|
||||||
|
done();
|
||||||
|
}, err => done.fail(err));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should init basic component data', (done) => {
|
||||||
|
builder.createAsync(TestApp).then(fixture => {
|
||||||
|
let component = getChildDebugElement(fixture.debugElement, 'method').componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
component.data.apiUrl.should.be.equal('http://petstore.swagger.io/v2');
|
||||||
|
component.data.httpMethod.should.be.equal('put');
|
||||||
|
component.data.path.should.be.equal('/user/{username}');
|
||||||
|
done();
|
||||||
|
}, err => done.fail(err));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/** Test component that contains an MdButton. */
|
||||||
|
@Component({selector: 'test-app'})
|
||||||
|
@View({
|
||||||
|
directives: [Method],
|
||||||
|
providers: [SchemaManager],
|
||||||
|
template:
|
||||||
|
`<method pointer='#/paths/~1user~1{username}/put'></method>`
|
||||||
|
})
|
||||||
|
class TestApp {
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user