Skip to content

Commit

Permalink
Adding DOM test skeleton for clickerList
Browse files Browse the repository at this point in the history
  • Loading branch information
lathonez committed Mar 17, 2016
1 parent 29e16ba commit 65bf5d5
Showing 1 changed file with 48 additions and 4 deletions.
52 changes: 48 additions & 4 deletions app/pages/clickerList/clickerList.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,62 @@
import { ClickerList } from './clickerList';
import {
beforeEach,
beforeEachProviders,
ComponentFixture,
describe,
expect,
injectAsync,
it,
TestComponentBuilder,
} from 'angular2/testing';
import { provide } from 'angular2/core';
import { ClickerList } from './clickerList';
import { Utils } from '../../services/utils';
import {
Config,
Form,
IonicApp,
NavController,
NavParams,
Platform,
} from 'ionic-angular';

class MockClass {
public get(): any {
return {};
}
};

let clickerList: ClickerList = null;
let clickerListFixture: ComponentFixture = null;

export function main(): void {
'use strict';

describe('ClickerList', () => {

beforeEach(() => {
clickerList = new ClickerList(null, null);
});
beforeEachProviders(() => [
Form,
provide(NavController, {useClass: MockClass}),
provide(NavParams, {useClass: MockClass}),
provide(Config, {useClass: MockClass}),
provide(IonicApp, {useClass: MockClass}),
provide(Platform, {useClass: MockClass}),
]);

beforeEach(injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb
.createAsync(ClickerList)
.then((componentFixture: ComponentFixture) => {
clickerListFixture = componentFixture;
clickerList = componentFixture.componentInstance;
clickerListFixture.detectChanges();
})
.catch(Utils.promiseCatchHandler);
}));

it('initialises', () => {
expect(clickerList).not.toBeNull();
expect(clickerListFixture).not.toBeNull();
});
});
}

0 comments on commit 65bf5d5

Please sign in to comment.