mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-07 21:40:32 +03:00
Update to latest Angular RC.6
This commit is contained in:
parent
dedf81caa0
commit
a14bde334b
|
@ -22,7 +22,7 @@ a.openapi-button {
|
|||
font-weight: normal;
|
||||
}
|
||||
|
||||
:host [section] {
|
||||
:host /deep/ [section] {
|
||||
padding-top: 60px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import { OptionsService } from '../../services/index';
|
|||
import {
|
||||
inject,
|
||||
async,
|
||||
TestComponentBuilder
|
||||
TestBed
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import { ApiInfo } from './api-info';
|
||||
|
@ -15,23 +15,23 @@ import { SpecManager } from '../../utils/SpecManager';
|
|||
|
||||
describe('Redoc components', () => {
|
||||
describe('ApiInfo Component', () => {
|
||||
let builder;
|
||||
let component;
|
||||
let fixture;
|
||||
let opts;
|
||||
|
||||
beforeEach(async(inject([TestComponentBuilder, SpecManager, OptionsService], (tcb, specMgr, _opts) => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({ declarations: [ TestAppComponent ] });
|
||||
});
|
||||
beforeEach(async(inject([SpecManager, OptionsService], (specMgr, _opts) => {
|
||||
opts = _opts;
|
||||
opts.options = {
|
||||
scrollYOffset: () => 0,
|
||||
$scrollParent: window
|
||||
};
|
||||
builder = tcb;
|
||||
return specMgr.load('/tests/schemas/api-info-test.json');
|
||||
})));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = builder.createSync(TestAppComponent);
|
||||
fixture = TestBed.createComponent(TestAppComponent);
|
||||
component = getChildDebugElement(fixture.debugElement, 'api-info').componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
@ -55,7 +55,6 @@ describe('Redoc components', () => {
|
|||
/** Test component that contains an ApiInfo. */
|
||||
@Component({
|
||||
selector: 'test-app',
|
||||
directives: [ApiInfo],
|
||||
template:
|
||||
`<api-info></api-info>`
|
||||
})
|
||||
|
|
|
@ -6,7 +6,7 @@ import { Component } from '@angular/core';
|
|||
import {
|
||||
inject,
|
||||
async,
|
||||
TestComponentBuilder
|
||||
TestBed
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import { ApiLogo } from './api-logo';
|
||||
|
@ -21,13 +21,15 @@ describe('Redoc components', () => {
|
|||
let specMgr;
|
||||
|
||||
let schemaUrl = '/tests/schemas/api-info-test.json';
|
||||
beforeEach(async(inject([TestComponentBuilder, SpecManager], (tcb, _specMgr) => {
|
||||
builder = tcb;
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({ declarations: [ TestAppComponent ] });
|
||||
});
|
||||
beforeEach(async(inject([SpecManager], ( _specMgr) => {
|
||||
specMgr = _specMgr;
|
||||
return specMgr.load(schemaUrl);
|
||||
})));
|
||||
beforeEach(() => {
|
||||
fixture = builder.createSync(TestAppComponent);
|
||||
fixture = TestBed.createComponent(TestAppComponent);
|
||||
component = getChildDebugElement(fixture.debugElement, 'api-logo').componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
@ -59,7 +61,6 @@ describe('Redoc components', () => {
|
|||
/** Test component that contains an ApiInfo. */
|
||||
@Component({
|
||||
selector: 'test-app',
|
||||
directives: [ApiLogo],
|
||||
providers: [SpecManager],
|
||||
template:
|
||||
`<api-logo></api-logo>`
|
||||
|
|
|
@ -5,22 +5,26 @@ import { Component } from '@angular/core';
|
|||
|
||||
import {
|
||||
inject,
|
||||
TestComponentBuilder
|
||||
TestBed
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import { JsonSchemaLazy } from './json-schema-lazy';
|
||||
|
||||
describe('Redoc components', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({ declarations: [ TestAppComponent ] });
|
||||
});
|
||||
|
||||
describe('JsonSchemaLazy Component', () => {
|
||||
let builder;
|
||||
let component;
|
||||
let fixture;
|
||||
|
||||
beforeEach(inject([TestComponentBuilder], (tcb) => {
|
||||
builder = tcb;
|
||||
beforeEach(inject([TestBed], (tcb) => {
|
||||
|
||||
}));
|
||||
beforeEach(() => {
|
||||
fixture = builder.createSync(TestAppComponent);
|
||||
fixture = TestBed.createComponent(TestAppComponent);
|
||||
let debugEl = getChildDebugElement(fixture.debugElement, 'json-schema-lazy');
|
||||
component = <JsonSchemaLazy>debugEl.componentInstance;
|
||||
spyOn(component, '_loadAfterSelf').and.stub();
|
||||
|
@ -47,7 +51,6 @@ describe('Redoc components', () => {
|
|||
/** Test component that contains a Method. */
|
||||
@Component({
|
||||
selector: 'test-app',
|
||||
directives: [JsonSchemaLazy],
|
||||
template:
|
||||
`<json-schema-lazy></json-schema-lazy>`
|
||||
})
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import { Component } from '@angular/core';
|
||||
import {
|
||||
inject,
|
||||
TestComponentBuilder
|
||||
TestBed
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import { getChildDebugElement } from '../../../tests/helpers';
|
||||
|
@ -13,19 +13,22 @@ import { JsonSchema } from './json-schema';
|
|||
import { SpecManager } from '../../utils/SpecManager';;
|
||||
|
||||
describe('Redoc components', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({ declarations: [ TestAppComponent ] });
|
||||
});
|
||||
describe('JsonSchema Component', () => {
|
||||
let builder;
|
||||
let component;
|
||||
let fixture;
|
||||
let specMgr;
|
||||
|
||||
beforeEach(inject([TestComponentBuilder, SpecManager], (tcb, _spec) => {
|
||||
builder = tcb;
|
||||
beforeEach(inject([SpecManager], ( _spec) => {
|
||||
|
||||
specMgr = _spec;
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = builder.createSync(TestAppComponent);
|
||||
fixture = TestBed.createComponent(TestAppComponent);
|
||||
let debugEl = getChildDebugElement(fixture.debugElement, 'json-schema');
|
||||
component = debugEl.componentInstance;
|
||||
});
|
||||
|
@ -59,7 +62,6 @@ describe('Redoc components', () => {
|
|||
/** Test component that contains a Method. */
|
||||
@Component({
|
||||
selector: 'test-app',
|
||||
directives: [JsonSchema],
|
||||
providers: [SpecManager],
|
||||
template:
|
||||
`<json-schema></json-schema>`
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Component } from '@angular/core';
|
|||
import {
|
||||
inject,
|
||||
async,
|
||||
TestComponentBuilder
|
||||
TestBed
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import { getChildDebugElement } from '../../../tests/helpers';
|
||||
|
@ -13,17 +13,20 @@ import { Method } from './method';
|
|||
import { SpecManager } from '../../utils/SpecManager';;
|
||||
|
||||
describe('Redoc components', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({ declarations: [ TestAppComponent ] });
|
||||
});
|
||||
describe('Method Component', () => {
|
||||
let builder;
|
||||
let component;
|
||||
|
||||
beforeEach(async(inject([TestComponentBuilder, SpecManager], (tcb, specMgr) => {
|
||||
builder = tcb;
|
||||
beforeEach(async(inject([SpecManager], ( specMgr) => {
|
||||
|
||||
return specMgr.load('/tests/schemas/extended-petstore.yml');
|
||||
})));
|
||||
|
||||
beforeEach(() => {
|
||||
let fixture = builder.createSync(TestAppComponent);
|
||||
let fixture = TestBed.createComponent(TestAppComponent);
|
||||
component = getChildDebugElement(fixture.debugElement, 'method').componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
@ -50,7 +53,6 @@ describe('Redoc components', () => {
|
|||
/** Test component that contains a Method. */
|
||||
@Component({
|
||||
selector: 'test-app',
|
||||
directives: [Method],
|
||||
providers: [SpecManager],
|
||||
template:
|
||||
`<method pointer='#/paths/~1user~1{username}/put'></method>`
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Component } from '@angular/core';
|
|||
import {
|
||||
inject,
|
||||
async,
|
||||
TestComponentBuilder
|
||||
TestBed
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import { getChildDebugElement } from '../../../tests/helpers';
|
||||
|
@ -14,17 +14,20 @@ import { MethodsList } from './methods-list';
|
|||
import { SpecManager } from '../../utils/SpecManager';
|
||||
|
||||
describe('Redoc components', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({ declarations: [ TestAppComponent ] });
|
||||
});
|
||||
describe('MethodsList Component', () => {
|
||||
let builder;
|
||||
let component;
|
||||
let fixture;
|
||||
|
||||
beforeEach(async(inject([TestComponentBuilder, SpecManager], (tcb, specMgr) => {
|
||||
builder = tcb;
|
||||
beforeEach(async(inject([SpecManager], ( specMgr) => {
|
||||
|
||||
return specMgr.load('/tests/schemas/methods-list-component.json');
|
||||
})));
|
||||
beforeEach(() => {
|
||||
fixture = builder.createSync(TestAppComponent);
|
||||
fixture = TestBed.createComponent(TestAppComponent);
|
||||
component = getChildDebugElement(fixture.debugElement, 'methods-list').componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
@ -47,7 +50,6 @@ describe('Redoc components', () => {
|
|||
|
||||
@Component({
|
||||
selector: 'test-app',
|
||||
directives: [ MethodsList ],
|
||||
template:
|
||||
`<methods-list></methods-list>`
|
||||
})
|
||||
|
|
|
@ -103,7 +103,7 @@ api-logo {
|
|||
/* global redoc styles */
|
||||
|
||||
@for $index from 1 through 5 {
|
||||
:host h#{$index}{
|
||||
:host /deep/ h#{$index}{
|
||||
margin-top: 0;
|
||||
font-family: $headers-font, $headers-font-family;
|
||||
color: $headers-color;
|
||||
|
@ -111,7 +111,7 @@ api-logo {
|
|||
}
|
||||
}
|
||||
|
||||
:host {
|
||||
:host /deep/ {
|
||||
h1 { font-size: $h1; }
|
||||
h2 { font-size: $h2; }
|
||||
h3 { font-size: $h3; }
|
||||
|
@ -168,7 +168,7 @@ footer {
|
|||
|
||||
/* markdown elements */
|
||||
|
||||
:host .redoc-markdown-block {
|
||||
:host /deep/ .redoc-markdown-block {
|
||||
pre {
|
||||
font-family: Courier, monospace;
|
||||
white-space: pre-wrap;
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
async
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import { TestComponentBuilder } from '@angular/core/testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { Redoc } from './redoc';
|
||||
import { SpecManager } from '../../utils/SpecManager';
|
||||
|
@ -17,28 +17,31 @@ import { OptionsService } from '../../services/index';
|
|||
let optsMgr:OptionsService;
|
||||
|
||||
describe('Redoc components', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({ declarations: [ TestAppComponent ] });
|
||||
});
|
||||
describe('Redoc Component', () => {
|
||||
let builder;
|
||||
let specMgr;
|
||||
|
||||
beforeEach(async(inject([TestComponentBuilder, SpecManager, OptionsService],
|
||||
(tcb, _specMgr, _optsMgr) => {
|
||||
beforeEach(async(inject([SpecManager, OptionsService],
|
||||
( _specMgr, _optsMgr) => {
|
||||
optsMgr = _optsMgr;
|
||||
builder = tcb;
|
||||
|
||||
specMgr = _specMgr;
|
||||
return specMgr.load('/tests/schemas/extended-petstore.yml');
|
||||
})));
|
||||
|
||||
|
||||
it('should init component', () => {
|
||||
let fixture = builder.createSync(TestAppComponent);
|
||||
let fixture = TestBed.createComponent(TestAppComponent);
|
||||
let component = getChildDebugElement(fixture.debugElement, 'redoc').componentInstance;
|
||||
expect(component).not.toBeNull();
|
||||
fixture.destroy();
|
||||
});
|
||||
|
||||
it('should init components tree without errors', () => {
|
||||
let fixture = builder.createSync(TestAppComponent);
|
||||
let fixture = TestBed.createComponent(TestAppComponent);
|
||||
(() => fixture.detectChanges()).should.not.throw();
|
||||
fixture.destroy();
|
||||
});
|
||||
|
@ -89,16 +92,16 @@ describe('Redoc components', () => {
|
|||
// let dom;
|
||||
// let destroySpy;
|
||||
//
|
||||
// beforeEach(async(inject([TestComponentBuilder, SpecManager, OptionsService, BrowserDomAdapter],
|
||||
// (tcb, specMgr, opts, _dom) => {
|
||||
// builder = tcb;
|
||||
// beforeEach(async(inject([SpecManager, OptionsService, BrowserDomAdapter],
|
||||
// ( specMgr, opts, _dom) => {
|
||||
//
|
||||
// optsMgr = opts;
|
||||
// dom = _dom;
|
||||
// return specMgr.load('/tests/schemas/extended-petstore.yml');
|
||||
// })));
|
||||
//
|
||||
// beforeEach(() => {
|
||||
// fixture = builder.createSync(TestAppComponent);
|
||||
// fixture = TestBed.createComponent(TestAppComponent);
|
||||
// element = getChildDebugElement(fixture.debugElement, 'methods-list').nativeElement;
|
||||
// destroySpy = jasmine.createSpy('spy');
|
||||
// Redoc.appRef = <ComponentRef<any>>{
|
||||
|
@ -165,7 +168,6 @@ describe('Redoc components', () => {
|
|||
/** Test component that contains a Redoc. */
|
||||
@Component({
|
||||
selector: 'test-app',
|
||||
directives: [Redoc],
|
||||
template:
|
||||
`<redoc disable-lazy-schemas></redoc>`
|
||||
})
|
||||
|
|
|
@ -46,7 +46,7 @@ header {
|
|||
font-weight: normal;
|
||||
}
|
||||
|
||||
:host > tabs > ul li {
|
||||
:host /deep/ > tabs > ul li {
|
||||
font-family: $headers-font;
|
||||
font-size: .9em;
|
||||
border-radius: $border-radius;
|
||||
|
@ -66,7 +66,7 @@ header {
|
|||
}
|
||||
}
|
||||
|
||||
:host tabs ul {
|
||||
:host /deep/ tabs ul {
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ pre {
|
|||
opacity: 1;
|
||||
}
|
||||
|
||||
:host {
|
||||
:host /deep/ {
|
||||
.property {
|
||||
//font-weight: bold;
|
||||
}
|
||||
|
|
|
@ -5,13 +5,11 @@ import { Component, ElementRef, Input, ChangeDetectionStrategy, OnInit } from '@
|
|||
import * as OpenAPISampler from 'openapi-sampler';
|
||||
|
||||
import { BaseComponent, SpecManager } from '../base';
|
||||
import { JsonFormatter } from '../../utils/JsonFormatterPipe';
|
||||
import { SchemaNormalizer } from '../../services/schema-normalizer.service';
|
||||
|
||||
@Component({
|
||||
selector: 'schema-sample',
|
||||
templateUrl: './schema-sample.html',
|
||||
pipes: [JsonFormatter],
|
||||
styleUrls: ['./schema-sample.css'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
async
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import { TestComponentBuilder } from '@angular/core/testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MethodsList, SideMenu } from '../index';
|
||||
|
||||
|
@ -18,14 +18,17 @@ import { SpecManager } from '../../utils/SpecManager';
|
|||
let testOptions;
|
||||
|
||||
describe('Redoc components', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({ declarations: [ TestAppComponent ] });
|
||||
});
|
||||
describe('SideMenu Component', () => {
|
||||
let builder;
|
||||
let component;
|
||||
let fixture;
|
||||
|
||||
beforeEach(async(inject([TestComponentBuilder, SpecManager, OptionsService],
|
||||
(tcb, specMgr, opts) => {
|
||||
builder = tcb;
|
||||
beforeEach(async(inject([SpecManager, OptionsService],
|
||||
( specMgr, opts) => {
|
||||
|
||||
testOptions = opts;
|
||||
testOptions.options = {
|
||||
scrollYOffset: () => 0,
|
||||
|
@ -35,7 +38,7 @@ describe('Redoc components', () => {
|
|||
})));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = builder.createSync(TestAppComponent);
|
||||
fixture = TestBed.createComponent(TestAppComponent);
|
||||
component = getChildDebugElement(fixture.debugElement, 'side-menu').componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
@ -54,7 +57,6 @@ describe('Redoc components', () => {
|
|||
/** Test component that contains an ApiInfo. */
|
||||
@Component({
|
||||
selector: 'test-app',
|
||||
directives: [MethodsList, SideMenu],
|
||||
template:
|
||||
`<side-menu></side-menu>
|
||||
<methods-list></methods-list>`
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
|
||||
import { Component, ElementRef, ChangeDetectorRef, OnInit } from '@angular/core';
|
||||
|
||||
import { global } from '@angular/core/src/facade/lang';
|
||||
//import { global } from '@angular/core/src/facade/lang';
|
||||
import { trigger, state, animate, transition, style } from '@angular/core';
|
||||
import { BaseComponent, SpecManager } from '../base';
|
||||
import { ScrollService, Hash, MenuService, OptionsService } from '../../services/index';
|
||||
import { BrowserDomAdapter as DOM } from '../../utils/browser-adapter';
|
||||
import { MenuCategory } from '../../services/schema-helper.service';
|
||||
|
||||
const global = window;
|
||||
|
||||
@Component({
|
||||
selector: 'side-menu',
|
||||
templateUrl: './side-menu.html',
|
||||
|
|
|
@ -3,32 +3,34 @@ import { Component } from '@angular/core';
|
|||
import {
|
||||
inject,
|
||||
async,
|
||||
TestComponentBuilder
|
||||
TestBed
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import { MenuService } from './menu.service';
|
||||
import { Hash } from './hash.service';
|
||||
import { ScrollService } from './scroll.service';
|
||||
import { MethodsList } from '../components/index';
|
||||
import { SpecManager } from '../utils/SpecManager';;
|
||||
|
||||
describe('Menu service', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({ declarations: [ TestAppComponent ] });
|
||||
});
|
||||
|
||||
let menu, hashService, scroll;
|
||||
let builder;
|
||||
let specMgr;
|
||||
|
||||
beforeEach(async(inject([TestComponentBuilder, SpecManager, Hash, ScrollService],
|
||||
(tcb, _specMgr, _hash, _scroll, _menu) => {
|
||||
beforeEach(async(inject([SpecManager, Hash, ScrollService],
|
||||
( _specMgr, _hash, _scroll, _menu) => {
|
||||
hashService = _hash;
|
||||
scroll = _scroll;
|
||||
builder = tcb;
|
||||
|
||||
specMgr = _specMgr;
|
||||
return specMgr.load('/tests/schemas/extended-petstore.yml');
|
||||
})));
|
||||
|
||||
beforeEach(() => {
|
||||
menu = new MenuService(hashService, scroll, specMgr);
|
||||
let fixture = builder.createSync(TestAppComponent);
|
||||
let fixture = TestBed.createComponent(TestAppComponent);
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
@ -91,7 +93,6 @@ describe('Menu service', () => {
|
|||
|
||||
@Component({
|
||||
selector: 'test-app',
|
||||
directives: [ MethodsList ],
|
||||
template:
|
||||
`<div id='parent' style='height: 500px; overflow:auto'>
|
||||
<methods-list></methods-list>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@import '../../styles/variables';
|
||||
|
||||
:host {
|
||||
:host /deep/ {
|
||||
.dk-select {
|
||||
max-width: 100%;
|
||||
font-family: $headers-font, $headers-font-family;
|
||||
|
|
|
@ -4,20 +4,23 @@ import { getChildDebugElementByType } from '../../../../tests/helpers';
|
|||
import { Component } from '@angular/core';
|
||||
import {
|
||||
inject,
|
||||
TestComponentBuilder
|
||||
TestBed
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import { StickySidebar } from '../index';
|
||||
|
||||
describe('Common components', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({ declarations: [ TestApp ] });
|
||||
});
|
||||
describe('StickySidebar Component', () => {
|
||||
let builder;
|
||||
let component;
|
||||
let fixture;
|
||||
|
||||
beforeEach(inject([TestComponentBuilder], (tcb) => {
|
||||
builder = tcb;
|
||||
fixture = builder.createSync(TestApp);
|
||||
beforeEach(inject([TestBed], (tcb) => {
|
||||
|
||||
fixture = TestBed.createComponent(TestApp);
|
||||
let debugEl = getChildDebugElementByType(fixture.debugElement, StickySidebar);
|
||||
component = debugEl.injector.get(StickySidebar);
|
||||
}));
|
||||
|
@ -64,7 +67,6 @@ describe('Common components', () => {
|
|||
/** Test component that contains an ApiInfo. */
|
||||
@Component({
|
||||
selector: 'test-app',
|
||||
directives: [StickySidebar],
|
||||
template:
|
||||
`<div style="padding-top: 20px">
|
||||
<div style="height: 20px; position: fixed; top: 0;"> </div>
|
||||
|
|
|
@ -5,12 +5,15 @@ import { Component } from '@angular/core';
|
|||
|
||||
import {
|
||||
inject,
|
||||
TestComponentBuilder
|
||||
TestBed
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import {Tabs, Tab} from '../index';
|
||||
|
||||
describe('Common components', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({ declarations: [ TestApp ] });
|
||||
});
|
||||
describe('Tabs Component', () => {
|
||||
let builder;
|
||||
let component;
|
||||
|
@ -19,9 +22,9 @@ describe('Common components', () => {
|
|||
let fixture;
|
||||
let hostComponent;
|
||||
|
||||
beforeEach(inject([TestComponentBuilder], (tcb) => {
|
||||
builder = tcb;
|
||||
fixture = builder.createSync(TestApp);
|
||||
beforeEach(inject([TestBed], (tcb) => {
|
||||
|
||||
fixture = TestBed.createComponent(TestApp);
|
||||
hostComponent = fixture.debugElement.componentInstance;
|
||||
debugEl = getChildDebugElement(fixture.debugElement, 'tabs');
|
||||
childDebugEls = getChildDebugElementAll(debugEl, 'tab');
|
||||
|
@ -131,7 +134,6 @@ describe('Common components', () => {
|
|||
/** Test component that contains an ApiInfo. */
|
||||
@Component({
|
||||
selector: 'test-app',
|
||||
directives: [Tabs, Tab],
|
||||
template:
|
||||
`<tabs (change)="onEvent($event)">
|
||||
<tab tabTitle="Tab1" tabStatus="test">Test</tab>
|
||||
|
|
|
@ -21,7 +21,7 @@ $zippy-redirect-bg-color: rgba($zippy-redirect-color, .08);
|
|||
.zippy-title {
|
||||
padding: 10px;
|
||||
border-radius: 2px;
|
||||
margin: 2px 0;
|
||||
margin-bottom: 4px;
|
||||
line-height: 1.5em;
|
||||
background-color: #f2f2f2;
|
||||
cursor: pointer;
|
||||
|
@ -46,16 +46,12 @@ $zippy-redirect-bg-color: rgba($zippy-redirect-color, .08);
|
|||
background-color: $zippy-info-bg-color;
|
||||
}
|
||||
}
|
||||
|
||||
.zippy-indicator svg {
|
||||
height: 1.2em;
|
||||
vertical-align: middle;
|
||||
transition: all 0.3s ease;
|
||||
transform: rotateZ(-180deg);
|
||||
}
|
||||
|
||||
.zippy-hidden > .zippy-title svg {
|
||||
transform: rotateZ(0);
|
||||
}
|
||||
|
||||
.zippy-title polygon {
|
||||
.zippy-success > & {
|
||||
|
|
|
@ -5,21 +5,23 @@ import { getChildDebugElement, mouseclick } from '../../../../tests/helpers';
|
|||
import { Component } from '@angular/core';
|
||||
import {
|
||||
inject,
|
||||
TestComponentBuilder
|
||||
TestBed
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import { Zippy } from '../index';
|
||||
|
||||
describe('Common components', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({ declarations: [ TestApp ] });
|
||||
});
|
||||
describe('Zippy Component', () => {
|
||||
let builder;
|
||||
let component;
|
||||
let nativeElement;
|
||||
let fixture;
|
||||
|
||||
beforeEach(inject([TestComponentBuilder], (tcb) => {
|
||||
builder = tcb;
|
||||
fixture = builder.createSync(TestApp);
|
||||
beforeEach(inject([TestBed], (tcb) => {
|
||||
fixture = TestBed.createComponent(TestApp);
|
||||
let debugEl = getChildDebugElement(fixture.debugElement, 'zippy');
|
||||
component = debugEl.componentInstance;
|
||||
nativeElement = debugEl.nativeElement;
|
||||
|
@ -92,7 +94,6 @@ describe('Common components', () => {
|
|||
/** Test component that contains an ApiInfo. */
|
||||
@Component({
|
||||
selector: 'test-app',
|
||||
directives: [Zippy],
|
||||
template:
|
||||
`<zippy title="Zippy" type="test" [visible]="true" [empty]="true" (open)="open()" (close)="close()">test</zippy>`
|
||||
})
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
'use strict';
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { isBlank } from '@angular/core/src/facade/lang';
|
||||
import { DomSanitizationService } from '@angular/platform-browser';
|
||||
//import { isBlank } from '@angular/core/src/facade/lang';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
|
||||
function isBlank(obj) {
|
||||
return obj === undefined || obj === null;
|
||||
}
|
||||
|
||||
var level = 1;
|
||||
const COLLAPSE_LEVEL = 2;
|
||||
|
||||
@Pipe({ name: 'jsonFormatter' })
|
||||
export class JsonFormatter implements PipeTransform {
|
||||
constructor(private sanitizer: DomSanitizationService) {}
|
||||
constructor(private sanitizer: DomSanitizer) {}
|
||||
transform(value) {
|
||||
if (isBlank(value)) return value;
|
||||
return this.sanitizer.bypassSecurityTrustHtml(jsonToHTML(value));
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
'use strict';
|
||||
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { DomSanitizationService } from '@angular/platform-browser';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { isString, stringify, isBlank } from '@angular/core/src/facade/lang';
|
||||
import { BaseException } from '@angular/core/src/facade/exceptions';
|
||||
import JsonPointer from './JsonPointer';
|
||||
import { renderMd } from './helpers';
|
||||
import { JsonFormatter } from './JsonFormatterPipe';
|
||||
|
||||
declare var Prism: any;
|
||||
|
||||
|
||||
class BaseException {
|
||||
message: string;
|
||||
constructor(message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
|
||||
class InvalidPipeArgumentException extends BaseException {
|
||||
constructor(type, value) {
|
||||
|
@ -52,7 +58,7 @@ export class JsonPointerEscapePipe implements PipeTransform {
|
|||
|
||||
@Pipe({ name: 'marked' })
|
||||
export class MarkedPipe implements PipeTransform {
|
||||
constructor(private sanitizer: DomSanitizationService) {}
|
||||
constructor(private sanitizer: DomSanitizer) {}
|
||||
transform(value:string) {
|
||||
if (isBlank(value)) return value;
|
||||
if (!isString(value)) {
|
||||
|
@ -67,7 +73,7 @@ export class MarkedPipe implements PipeTransform {
|
|||
|
||||
@Pipe({ name: 'safe' })
|
||||
export class SafePipe implements PipeTransform {
|
||||
constructor(private sanitizer: DomSanitizationService) {}
|
||||
constructor(private sanitizer: DomSanitizer) {}
|
||||
transform(value:string) {
|
||||
if (isBlank(value)) return value;
|
||||
if (!isString(value)) {
|
||||
|
@ -88,7 +94,7 @@ const langMap = {
|
|||
|
||||
@Pipe({ name: 'prism' })
|
||||
export class PrismPipe implements PipeTransform {
|
||||
constructor(private sanitizer: DomSanitizationService) {}
|
||||
constructor(private sanitizer: DomSanitizer) {}
|
||||
transform(value, args) {
|
||||
if (isBlank(args) || args.length === 0) {
|
||||
throw new BaseException('Prism pipe requires one argument');
|
||||
|
@ -119,5 +125,5 @@ export class EncodeURIComponentPipe implements PipeTransform {
|
|||
}
|
||||
|
||||
export const REDOC_PIPES = [
|
||||
JsonPointerEscapePipe, MarkedPipe, SafePipe, PrismPipe, EncodeURIComponentPipe
|
||||
JsonPointerEscapePipe, MarkedPipe, SafePipe, PrismPipe, EncodeURIComponentPipe, JsonFormatter
|
||||
];
|
||||
|
|
29
package.json
29
package.json
|
@ -40,6 +40,7 @@
|
|||
"author": "Roman Hotsiy",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@angular/compiler-cli": "^0.6.0",
|
||||
"@types/core-js": "^0.9.31",
|
||||
"@types/jasmine": "^2.2.32",
|
||||
"@types/requirejs": "^2.1.26",
|
||||
|
@ -71,29 +72,27 @@
|
|||
"karma-webpack": "^1.8.0",
|
||||
"node-sass": "^3.8.0",
|
||||
"phantomjs-prebuilt": "^2.1.7",
|
||||
"protractor": "^3.3.0",
|
||||
"protractor": "^4.0.4",
|
||||
"raw-loader": "^0.5.1",
|
||||
"shelljs": "^0.7.0",
|
||||
"should": "^9.0.2",
|
||||
"should": "^11.1.0",
|
||||
"sinon": "^1.17.2",
|
||||
"source-map-loader": "^0.1.5",
|
||||
"style-loader": "^0.13.1",
|
||||
"ts-helpers": "^1.1.1",
|
||||
"tslint": "^3.15.0-dev.0",
|
||||
"tslint-stylish": "^2.1.0-beta",
|
||||
"typescript": "^2.0.0",
|
||||
"typescript": "^2.0.2",
|
||||
"webpack": "^2.1.0-beta.21",
|
||||
"webpack-dev-server": "^1.15.0",
|
||||
"yargs": "^4.7.1"
|
||||
"webpack-dev-server": "^2.1.0-beta.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@angular/common": "^2.0.0-rc.5",
|
||||
"@angular/compiler": "^2.0.0-rc.5",
|
||||
"@angular/compiler-cli": "^0.5.0",
|
||||
"@angular/core": "^2.0.0-rc.5",
|
||||
"@angular/platform-browser": "^2.0.0-rc.5",
|
||||
"@angular/platform-browser-dynamic": "^2.0.0-rc.5",
|
||||
"@angular/platform-server": "^2.0.0-rc.5",
|
||||
"@angular/common": "^2.0.0-rc.6",
|
||||
"@angular/compiler": "^2.0.0-rc.6",
|
||||
"@angular/core": "^2.0.0-rc.6",
|
||||
"@angular/platform-browser": "^2.0.0-rc.6",
|
||||
"@angular/platform-browser-dynamic": "^2.0.0-rc.6",
|
||||
"@angular/platform-server": "^2.0.0-rc.6",
|
||||
"core-js": "^2.4.1",
|
||||
"dropkickjs": "^2.1.10",
|
||||
"hint.css": "^2.3.2",
|
||||
|
@ -102,10 +101,10 @@
|
|||
"openapi-sampler": "^0.3.0",
|
||||
"prismjs": "^1.5.1",
|
||||
"remarkable": "^1.6.2",
|
||||
"rxjs": "5.0.0-beta.6",
|
||||
"rxjs": "^5.0.0-beta.11",
|
||||
"scrollparent": "^1.0.0",
|
||||
"slugify": "^0.1.1",
|
||||
"slugify": "^1.0.2",
|
||||
"stream-http": "^2.3.1",
|
||||
"zone.js": "^0.6.15"
|
||||
"zone.js": "^0.6.17"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user