2015-12-19 18:19:18 +03:00
|
|
|
'use strict';
|
|
|
|
|
2016-07-01 16:30:35 +03:00
|
|
|
import { Component } from '@angular/core';
|
2015-12-19 18:19:18 +03:00
|
|
|
import {
|
2016-04-30 00:45:53 +03:00
|
|
|
inject,
|
|
|
|
async,
|
2016-07-01 15:53:16 +03:00
|
|
|
TestComponentBuilder
|
2016-05-06 00:48:41 +03:00
|
|
|
} from '@angular/core/testing';
|
2015-12-19 18:19:18 +03:00
|
|
|
|
2016-06-12 20:44:34 +03:00
|
|
|
import { getChildDebugElement } from '../../../tests/helpers';
|
2016-05-09 22:55:16 +03:00
|
|
|
|
2016-06-12 20:44:34 +03:00
|
|
|
|
|
|
|
import { MethodsList } from './methods-list';
|
2016-06-22 21:17:48 +03:00
|
|
|
import { SpecManager } from '../../utils/SpecManager';
|
2015-12-19 18:19:18 +03:00
|
|
|
|
2015-12-19 20:36:28 +03:00
|
|
|
describe('Redoc components', () => {
|
2016-02-16 16:31:12 +03:00
|
|
|
describe('MethodsList Component', () => {
|
2015-12-19 20:36:28 +03:00
|
|
|
let builder;
|
|
|
|
let component;
|
|
|
|
let fixture;
|
2016-07-01 15:53:16 +03:00
|
|
|
|
2016-06-23 17:36:38 +03:00
|
|
|
beforeEach(async(inject([TestComponentBuilder, SpecManager], (tcb, specMgr) => {
|
2015-12-19 20:36:28 +03:00
|
|
|
builder = tcb;
|
2016-06-23 17:36:38 +03:00
|
|
|
return specMgr.load('/tests/schemas/methods-list-component.json');
|
2016-04-30 00:45:53 +03:00
|
|
|
})));
|
2016-07-01 15:53:16 +03:00
|
|
|
beforeEach(() => {
|
|
|
|
fixture = builder.createSync(TestAppComponent);
|
|
|
|
component = getChildDebugElement(fixture.debugElement, 'methods-list').componentInstance;
|
|
|
|
fixture.detectChanges();
|
2015-12-19 20:36:28 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should init component and component data', () => {
|
|
|
|
expect(component).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should get correct tags list', () => {
|
|
|
|
expect(component.data.tags).not.toBeNull();
|
|
|
|
component.data.tags.should.have.lengthOf(2);
|
|
|
|
component.data.tags[0].name.should.be.equal('traitTag');
|
2016-06-13 20:54:24 +03:00
|
|
|
component.data.tags[0].methods.should.be.empty();
|
2015-12-19 20:36:28 +03:00
|
|
|
component.data.tags[1].name.should.be.equal('tag1');
|
|
|
|
component.data.tags[1].methods.should.have.lengthOf(2);
|
|
|
|
});
|
2015-12-19 18:19:18 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-03-27 18:25:46 +03:00
|
|
|
@Component({
|
|
|
|
selector: 'test-app',
|
2016-05-09 22:55:16 +03:00
|
|
|
directives: [ MethodsList ],
|
2015-12-19 18:19:18 +03:00
|
|
|
template:
|
|
|
|
`<methods-list></methods-list>`
|
|
|
|
})
|
2016-06-13 20:54:24 +03:00
|
|
|
class TestAppComponent {
|
2015-12-19 18:19:18 +03:00
|
|
|
}
|