From 50d9213c6e1490d388daf6ba005724e5bea6fd29 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sat, 19 Dec 2015 00:54:06 +0200 Subject: [PATCH] Very basic redoc component test --- lib/components/Redoc/redoc.spec.js | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 lib/components/Redoc/redoc.spec.js diff --git a/lib/components/Redoc/redoc.spec.js b/lib/components/Redoc/redoc.spec.js new file mode 100644 index 00000000..0161caa7 --- /dev/null +++ b/lib/components/Redoc/redoc.spec.js @@ -0,0 +1,47 @@ +'use strict'; + +import { getChildDebugElement } from 'tests/helpers'; +import {Component, View, provide} from 'angular2/core'; + +import { + TestComponentBuilder, + injectAsync, + beforeEach, + beforeEachProviders, + it +} from 'angular2/testing'; + +import Redoc from 'lib/components/Redoc/redoc'; +import SchemaManager from 'lib/utils/SchemaManager'; + + +describe('Redoc 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, 'redoc').componentInstance; + expect(component).not.toBeNull(); + done(); + }, err => done.fail(err)); + }); +}); + + +/** Test component that contains an MdButton. */ +@Component({selector: 'test-app'}) +@View({ + directives: [Redoc], + template: + `` +}) +class TestApp { +}