Skip to content

Commit 20483c0

Browse files
author
Seth Davenport
committed
Initial revision
0 parents  commit 20483c0

25 files changed

+3876
-0
lines changed

.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
12+
[*.md]
13+
max_line_length = 0
14+
trim_trailing_whitespace = false
15+
16+
# Indentation override
17+
#[lib/**.js]
18+
#[{package.json,.travis.yml}]
19+
#[**/**.js]

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.idea
2+
node_modules
3+
jspm_packages
4+
npm-debug.*
5+
link-checker-results.txt
6+
app/**/*.js
7+
*.js.map
8+
e2e/**/*.js
9+
e2e/**/*.js.map
10+
_test-output
11+
_temp

.travis.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
dist: trusty
2+
sudo: required
3+
language: node_js
4+
node_js:
5+
- "5"
6+
os:
7+
- linux
8+
env:
9+
global:
10+
- DBUS_SESSION_BUS_ADDRESS=/dev/null
11+
- DISPLAY=:99.0
12+
- CHROME_BIN=chromium-browser
13+
before_script:
14+
- sh -e /etc/init.d/xvfb start
15+
install:
16+
- npm install
17+
script:
18+
- npm run lint
19+
- npm run test-once
20+
- npm run e2e

CHANGELOG.md

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
## Angular Documentation QuickStart Changelog
2+
Upgraders: for a fresh start, consider running these commands
3+
* `git clean -xdf`
4+
* `npm install`
5+
6+
<a name="0.2.21"></a>
7+
# 0.2.20 (2016-12-14)
8+
* Update to in-memory-web-api v.0.2.1
9+
10+
<a name="0.2.20"></a>
11+
# 0.2.20 (2016-12-07)
12+
* Update to Angular 2.3.0
13+
14+
<a name="0.2.19"></a>
15+
# 0.2.19 (2016-11-30)
16+
* remove upgrade mappings from `systemjs.config.js` PR #301
17+
18+
<a name="0.2.18"></a>
19+
# 0.2.18 (2016-11-30)
20+
* remove `exclude` clause from `tsconfig.json`; it was just confusing people
21+
* karma.config + karma-test-shim can handle multiple spec source paths (issue #294)
22+
* cosmetic `app.component.spec.ts` changes
23+
* cosmetic `karma.config.js` changes
24+
25+
<a name="0.2.17"></a>
26+
# 0.2.17 (2016-11-16)
27+
* Conform to updated QuickStart advice
28+
* removed docker everywhere (was nice but not necessary)
29+
* removed wallaby
30+
* shrink styles.css
31+
* refine tsconfig.json
32+
* `AppComponent` uses interpolation
33+
34+
<a name="0.2.16"></a>
35+
# 0.2.16 (2016-11-14)
36+
* Update to Angular 2.2.0
37+
38+
<a name="0.2.15"></a>
39+
# 0.2.15 (2016-10-29)
40+
* Revert to Jasmine 2.4.1 because bug in 2.5.x (see [jasmine issue #1231](https://github.com/jasmine/jasmine/issues/1231))
41+
42+
<a name="0.2.14"></a>
43+
# 0.2.14 (2016-10-29)
44+
* Remove bootstrap.css install
45+
* Angular v2.1.2
46+
47+
<a name="0.2.13"></a>
48+
# 0.2.13 (2016-10-20)
49+
* Protractor 4
50+
* Move from `typings` to `@types`. See `tsconfig.json` changes.
51+
* Angular v2.1.1
52+
53+
<a name="0.2.12"></a>
54+
# 0.2.12 (2016-10-06)
55+
* Angular v2.1.0
56+
57+
<a name="0.2.11"></a>
58+
# 0.2.11 (2016-10-06)
59+
* Angular v2.0.2
60+
* License is MIT
61+
* Current testing configuration
62+
* No code changes
63+
64+
<a name="0.2.10"></a>
65+
# 0.2.10 (2016-09-19)
66+
* All "Angular 2" references become just "Angular"
67+
* No code changes
68+
69+
<a name="0.2.9"></a>
70+
# 0.2.9 (2016-09-14)
71+
* Angular 2.0.0 version
72+
* Update to Typescript 2.0.2
73+
* Fix e2e test missing dir
74+
75+
<a name="0.2.8"></a>
76+
# 0.2.8 (2016-09-01)
77+
* remove @angular test libraries from system.js (now in shim)
78+
* update test related files
79+
* wallaby doesn't completely work. Researching.
80+
81+
<a name="0.2.7"></a>
82+
# 0.2.7 (2016-08-31)
83+
* Angular 2 RC6 version
84+
* Updated new forms, router, angular2-in-memory-web-api, karma, core-js, rxjs and zone.js packages
85+
* Removed router-deprecated package
86+
* Updated karma.conf.js and systemjs.config.js
87+
88+
<a name="0.2.6"></a>
89+
# 0.2.6 (2016-08-09)
90+
* Angular 2 RC5 version
91+
* Updated new forms, router and angular2-in-memory-web-api
92+
93+
<a name="0.2.5"></a>
94+
# 0.2.5 (2016-06-30)
95+
* Angular 2 RC4 version
96+
* Updated new forms and router
97+
98+
<a name="0.2.4"></a>
99+
# 0.2.4 (2016-06-21)
100+
* Angular 2 RC3 version
101+
* Add new forms and router
102+
* Add support for TS e2e tests
103+
104+
<a name="0.2.3"></a>
105+
# 0.2.3 (2016-06-15)
106+
* Angular 2 RC2 version
107+
108+
<a name="0.2.2"></a>
109+
# 0.2.2 (2016-05-21)
110+
* Update to Typings 1.x
111+
112+
<a name="0.2.1"></a>
113+
# 0.2.1 (2016-05-03)
114+
* Angular 2 RC01 version
115+
116+
<a name="0.2.0"></a>
117+
# 0.2.0 (2016-05-02)
118+
* Angular 2 RC0 version
119+
120+
<a name="0.1.17"></a>
121+
# 0.1.17 (2016-04-29)
122+
* update packages
123+
* Angular 2 beta 17
124+
* RxJS 5.0.0-beta.6
125+
* a2-in-memory-web-api 0.1.17
126+
127+
<a name="0.1.16"></a>
128+
# 0.1.16 (2016-04-26)
129+
* update packages
130+
* Angular 2 beta 16
131+
* a2-in-memory-web-api 0.1.6
132+
* protractor 3.3.0
133+
* typings 0.8.1
134+
* zone.js 0.6.12
135+
136+
* added favicon.ico
137+
138+
* testing
139+
- updated wallaby.js and karma.conf.js
140+
- updated app.component.spec.ts
141+
142+
143+
<a name="0.1.15"></a>
144+
# 0.1.15 (2016-04-13)
145+
* Add testing support
146+
* npm scripts
147+
* karma/jasmine
148+
* protractor
149+
150+
* update packages
151+
* Angular 2 beta 15
152+
* lite-server 2.2.0
153+
* systemjs 0.19.26
154+
* typescript 1.8.10
155+
* typings 0.7.12
156+
157+
* add run packages
158+
* a2-in-memory-web-api
159+
160+
* add testing dev-dependency packages
161+
* canonical-path: 0.0.2,
162+
* http-server: ^0.9.0,
163+
* jasmine-core: ~2.4.1,
164+
* karma: ^0.13.22,
165+
* karma-chrome-launcher: ^0.2.3,
166+
* karma-cli: ^0.1.2,
167+
* karma-htmlfile-reporter: ^0.2.2,
168+
* karma-jasmine: ^0.3.8,
169+
* protractor: ^3.2.2,
170+
* rimraf: ^2.5.2
171+
172+
<a name="0.1.14"></a>
173+
# 0.1.14 (2016-04-07)
174+
* update packages
175+
* Angular 2 beta 14
176+
* lite-server 2.2.0
177+
* typings 0.7.12
178+
179+
<a name="0.1.13"></a>
180+
# 0.1.13 (2016-03-31)
181+
* update packages
182+
* Angular 2 beta 13
183+
184+
<a name="0.1.12"></a>
185+
# 0.1.12 (2016-03-23)
186+
* update packages
187+
* Angular 2 beta 12
188+
* zones 0.6.6
189+
* remove es6-promise because no longer needed.
190+
191+
<a name="0.1.11"></a>
192+
# 0.1.11 (2016-03-18)
193+
* update packages
194+
* Angular 2 beta 11
195+
* zones 0.6.4
196+
* typescript 1.8.9
197+
* typings 0.7.9

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) 2014-2016 Google, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Simple Ng2-Redux with SystemJS Config
2+
3+
This repo was cloned from the Angular2 quickstart example:
4+
https://angular.io/docs/ts/latest/guide/setup.html
5+
6+
It's a trivial counter built with
7+
[Ng2-Redux](https://npmjs.org/packages/ng2-redux); it's main purpose is to show
8+
how to set up Ng2-Redux in a SystemJS/TypeScript/LiveServer environment.
9+
10+
# How to Run It
11+
12+
The usual steps:
13+
14+
```
15+
npm install
16+
npm start
17+
```
18+
19+
Point your browser at http://localhost:3000

app/actions.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Injectable } from '@angular/core';
2+
import { NgRedux } from 'ng2-redux';
3+
import { AppState } from './store';
4+
5+
@Injectable()
6+
export class CounterActions {
7+
static INCREMENT = "INCREMENT";
8+
static DECREMENT = "DECREMENT";
9+
10+
constructor(private ngRedux: NgRedux<AppState>) {}
11+
12+
increment() {
13+
this.ngRedux.dispatch({ type: CounterActions.INCREMENT });
14+
}
15+
16+
decrement() {
17+
this.ngRedux.dispatch({ type: CounterActions.DECREMENT });
18+
}
19+
}

app/app.component.spec.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { By } from '@angular/platform-browser';
3+
import { DebugElement } from '@angular/core';
4+
import { Observable } from 'rxjs/Observable';
5+
import 'rxjs/add/observable/of';
6+
import { NgRedux } from 'ng2-redux';
7+
8+
import { AppComponent } from './app.component';
9+
import { CounterActions } from './actions';
10+
11+
// I follow a 'mock all dependencies' strategy when unit testing.
12+
const mockNgRedux = {
13+
configureStore: () => {},
14+
dispatch: () => {},
15+
select: () => Observable.of(null),
16+
};
17+
NgRedux.instance = mockNgRedux;
18+
19+
const mockCounterActions = {
20+
increment: () => {},
21+
decrement: () => {},
22+
};
23+
24+
describe('AppComponent', function () {
25+
let de: DebugElement;
26+
let comp: AppComponent;
27+
let fixture: ComponentFixture<AppComponent>;
28+
29+
beforeEach(async(() => {
30+
TestBed.configureTestingModule({
31+
declarations: [ AppComponent ],
32+
providers: [
33+
{ provide: NgRedux, useValue: mockNgRedux },
34+
{ provide: CounterActions, useValue: mockCounterActions },
35+
],
36+
})
37+
.compileComponents();
38+
}));
39+
40+
beforeEach(() => {
41+
fixture = TestBed.createComponent(AppComponent);
42+
comp = fixture.componentInstance;
43+
de = fixture.debugElement.query(By.css('h1'));
44+
});
45+
46+
it('should create component', () => expect(comp).toBeDefined() );
47+
48+
it('should have expected <h1> text', () => {
49+
fixture.detectChanges();
50+
const h1 = de.nativeElement;
51+
expect(h1.innerText).toMatch(/NG2-Redux/i,
52+
'<h1> should say something about "Redux"');
53+
});
54+
});

app/app.component.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Component } from '@angular/core';
2+
import { NgRedux, select } from 'ng2-redux';
3+
import { Observable } from 'rxjs/Observable';
4+
5+
import { CounterActions } from './actions';
6+
import { AppState, INITIAL_STATE, rootReducer } from './store';
7+
8+
@Component({
9+
selector: 'my-app',
10+
template: `
11+
<h1>Hello NG2-Redux!</h1>
12+
<p>The counter value is {{ counter$ | async }}</p>
13+
<p>
14+
<button (click)="actions.increment()">+</button>
15+
<button (click)="actions.decrement()">-</button>
16+
</p>
17+
`
18+
})
19+
export class AppComponent {
20+
@select() counter$: Observable<number>;
21+
22+
constructor(
23+
private ngRedux: NgRedux<any>,
24+
private actions: CounterActions) {
25+
ngRedux.configureStore(rootReducer, INITIAL_STATE);
26+
}
27+
}

0 commit comments

Comments
 (0)