Skip to content

Commit

Permalink
feat(): Migated to Angular 2 RC 5
Browse files Browse the repository at this point in the history
  • Loading branch information
akserg committed Aug 28, 2016
1 parent 6907b78 commit 1593ba6
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 68 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Angular2 component shows slim loading bar at the top of the page of your applica

Follow me [![twitter](https://img.shields.io/twitter/follow/akopkokhyants.svg?style=social&label=%20akopkokhyants)](https://twitter.com/akopkokhyants) to be notified about new releases.

_Some of these APIs and Components are not final and are subject to change!_

## Installation

```sh
Expand Down Expand Up @@ -76,4 +78,4 @@ bootstrap(AppComponent);
[MIT](/LICENSE)

# Credits
Inspired by [ngProgress.js](https://github.com/VictorBjelkholm/ngProgress)
Inspired by [ngProgress.js](https://github.com/VictorBjelkholm/ngProgress)
4 changes: 3 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ module.exports = function(config) {
// list of files / patterns to load in the browser
files: [
// for Travis
'node_modules/es6-shim/es6-shim.js',
'node_modules/core-js/client/core.js',

// zone-microtask must be included first as it contains a Promise monkey patch
'node_modules/zone.js/dist/zone.js',
'node_modules/zone.js/dist/long-stack-trace-zone.js',
'node_modules/zone.js/dist/proxy.js',
'node_modules/zone.js/dist/sync-test.js',
'node_modules/zone.js/dist/jasmine-patch.js',
'node_modules/zone.js/dist/async-test.js',
'node_modules/zone.js/dist/fake-async-test.js',
Expand Down
22 changes: 10 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,28 @@
"typings": "index",
"homepage": "https://github.com/akserg/ng2-slim-loading-bar",
"dependencies": {
"es6-promise": "~3.1.2",
"es6-shim": "~0.35.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.6",
"zone.js": "~0.6.12"
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.11",
"zone.js": "^0.6.17"
},
"devDependencies": {
"@angular/common": "^2.0.0-rc.4",
"@angular/compiler": "^2.0.0-rc.4",
"@angular/core": "^2.0.0-rc.4",
"@angular/platform-browser": "^2.0.0-rc.4",
"@angular/platform-browser-dynamic": "^2.0.0-rc.4",
"@angular/common": "^2.0.0-rc.5",
"@angular/compiler": "^2.0.0-rc.5",
"@angular/core": "^2.0.0-rc.5",
"@angular/platform-browser": "^2.0.0-rc.5",
"@angular/platform-browser-dynamic": "^2.0.0-rc.5",
"commitizen": "^2.7.6",
"cz-conventional-changelog": "^1.1.5",
"jasmine-core": "~2.3.4",
"karma": "~0.13.15",
"karma": "~0.13.20",
"karma-chrome-launcher": "~0.2.2",
"karma-firefox-launcher": "~0.1.7",
"karma-jasmine": "~0.3.6",
"karma-typescript-preprocessor": "0.0.21",
"semantic-release": "^4.3.5",
"systemjs": "~0.19.6",
"systemjs-builder": "^0.15.6",
"tsd": "^0.6.5",
"typescript": "^1.8.7",
"typings": "^0.8.1",
"uglify-js": "^2.6.2"
Expand Down
59 changes: 25 additions & 34 deletions tests/component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
import {
describe,
expect,
beforeEach,
it,
inject,
//injectAsync,
beforeEachProviders,
fakeAsync,
tick,
async
} from '@angular/core/testing';
import { inject, async, tick, TestBed, ComponentFixture }
from '@angular/core/testing';

import {
TestComponentBuilder,
ComponentFixture
} from '@angular/compiler/testing';

import {TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS}
from '@angular/platform-browser-dynamic/testing';
BrowserDynamicTestingModule, platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';

import {Observable} from 'rxjs/Observable';
import {SlimLoadingBarService, SlimLoadingBarEvent, SlimLoadingBarEventType}
from '../src/slim-loading-bar.service';
import {SlimLoadingBarComponent}
from '../src/slim-loading-bar.component';

import {SlimLoadingBarService, SlimLoadingBarEvent, SlimLoadingBarEventType} from '../src/slim-loading-bar.service';
import {SlimLoadingBarComponent} from '../src/slim-loading-bar.component';
TestBed.resetTestEnvironment();
TestBed.initTestEnvironment(
BrowserDynamicTestingModule, platformBrowserDynamicTesting());

export function main() {
describe('SlimLoadingBar', () => {
Expand All @@ -32,21 +22,22 @@ export function main() {
let containerDiv:HTMLDivElement;
let progressDiv:HTMLDivElement;

beforeEachProviders(() => {
return [TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS, TestComponentBuilder, SlimLoadingBarService];
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [SlimLoadingBarComponent],
providers: [SlimLoadingBarService]
});
TestBed.compileComponents();
});

// beforeEach(injectAsync([TestComponentBuilder], (tcb:TestComponentBuilder) => {
beforeEach(async(inject([TestComponentBuilder], (tcb:TestComponentBuilder) => {
return tcb.createAsync(SlimLoadingBarComponent).then((cf:ComponentFixture<any>) => {
componentFixture = cf;
let element = componentFixture.elementRef.nativeElement;
containerDiv = element.querySelector('.slim-loading-bar');
progressDiv = element.querySelector('.slim-loading-bar-progress');
component = componentFixture.componentInstance;
componentFixture.detectChanges();
});
})));
beforeEach(() => {
componentFixture = TestBed.createComponent(SlimLoadingBarComponent);
let element = componentFixture.elementRef.nativeElement;
containerDiv = element.querySelector('.slim-loading-bar');
progressDiv = element.querySelector('.slim-loading-bar-progress');
component = componentFixture.componentInstance;
componentFixture.detectChanges();
});

it('should be defined', () => {
expect(containerDiv).toBeDefined();
Expand Down
39 changes: 19 additions & 20 deletions tests/service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
import {
describe,
expect,
beforeEach,
it,
inject,
//injectAsync,
beforeEachProviders,
fakeAsync,
tick
} from '@angular/core/testing';

import {Observable} from 'rxjs/Observable';

import {SlimLoadingBarService, SlimLoadingBarEvent, SlimLoadingBarEventType} from '../src/slim-loading-bar.service';
import { inject, fakeAsync, tick, TestBed }
from '@angular/core/testing';

import { BrowserDynamicTestingModule, platformBrowserDynamicTesting }
from '@angular/platform-browser-dynamic/testing';

import {SlimLoadingBarService, SlimLoadingBarEvent, SlimLoadingBarEventType}
from '../src/slim-loading-bar.service';

TestBed.resetTestEnvironment();
TestBed.initTestEnvironment(
BrowserDynamicTestingModule, platformBrowserDynamicTesting());

export function main() {
describe('SlimLoadingBarService', () => {

let service:SlimLoadingBarService;
let service: SlimLoadingBarService;

beforeEachProviders(() => {
return [ SlimLoadingBarService ];
beforeEach(() => {
TestBed.configureTestingModule({
providers: [SlimLoadingBarService]
});
});

beforeEach(inject([SlimLoadingBarService], (slbs:SlimLoadingBarService) => {
beforeEach(inject([SlimLoadingBarService], (slbs: SlimLoadingBarService) => {
service = slbs;
}));

Expand All @@ -41,7 +40,7 @@ export function main() {
expect(service.progress).toBe(30);
});

it('increaments over time after calling start()', <any>fakeAsync(():void => {
it('increaments over time after calling start()', <any>fakeAsync((): void => {
// var value, flag;
expect(service.progress).toBe(0);
service.start();
Expand Down

0 comments on commit 1593ba6

Please sign in to comment.