Skip to content

Commit 83f3c79

Browse files
committed
(#12) modified core functionalities for more performance.
1 parent ddb5ca2 commit 83f3c79

File tree

4 files changed

+210
-209
lines changed

4 files changed

+210
-209
lines changed

src/app/components/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {appPipes} from '../pipes/pipes';
2727
// We use a folder if we want separate files
2828
import {Home} from './home/home';
2929
// Otherwise we only use one file for a component
30-
import {Dashboard} from './dashboard';
30+
import {Dashboard} from './dashboard/dashboard';
3131

3232
// Example modules
3333
import {ExampleModules} from './example-modules/example-modules';
Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
/// <reference path="../../../typings/_custom.d.ts" />
2-
3-
// Angular 2
4-
import {Component, View, CSSClass} from 'angular2/angular2';
5-
import {RouteConfig, routerDirectives} from 'angular2/router';
6-
// Modules
7-
import {Tictactoe} from './tictactoe-module/tictactoe';
8-
// View
9-
let template = require('./example-modules.html');
10-
let styles = require('./example-modules.css')
11-
@Component({
12-
selector: 'example-modules'
13-
})
14-
@RouteConfig([
15-
{ path: '/', redirectTo: '/search' },
16-
{ path: '/search', as: 'search', component: Search },
17-
{ path: '/tictactoe', as: 'tictactoe', component: Tictactoe }
18-
])
19-
@View({
20-
directives: [ routerDirectives, CSSClass ],
21-
// include our .css file
22-
styles: [ styles ], // Use webpack's `require` to get files as a raw string using raw-loader
23-
template: template
24-
})
25-
export class ExampleModules {
26-
active: number = 0;
27-
}
1+
/// <reference path="../../../typings/_custom.d.ts" />
2+
3+
// Angular 2
4+
import {Component, View, CSSClass} from 'angular2/angular2';
5+
import {RouteConfig, routerDirectives} from 'angular2/router';
6+
// Modules
7+
import {Tictactoe} from './tictactoe-module/tictactoe';
8+
import {Search} from '.search-module/search';
9+
// View
10+
let template = require('./example-modules.html');
11+
let styles = require('./example-modules.css')
12+
@Component({
13+
selector: 'example-modules'
14+
})
15+
@RouteConfig([
16+
{ path: '/', redirectTo: '/search' },
17+
{ path: '/search', as: 'search', component: Search },
18+
{ path: '/tictactoe', as: 'tictactoe', component: Tictactoe }
19+
])
20+
@View({
21+
directives: [ routerDirectives, CSSClass ],
22+
// include our .css file
23+
styles: [ styles ], // Use webpack's `require` to get files as a raw string using raw-loader
24+
template: template
25+
})
26+
export class ExampleModules {
27+
active: number = 0;
28+
}
Lines changed: 138 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,138 @@
1-
/// <reference path="../../../typings/_custom.d.ts" />
2-
import {CapitalizePipe, CapitalizeFactory} from './Capitalize-Pipe';
3-
4-
describe('Capitalize', () => {
5-
6-
describe('CapitalizePipe', () => {
7-
var subject;
8-
var result;
9-
var pipe;
10-
11-
beforeEach(() => {
12-
pipe = new CapitalizePipe();
13-
});
14-
afterEach(() => {
15-
expect(subject).toEqual(result);
16-
});
17-
18-
describe('#support', () => {
19-
20-
it('should support string', () => {
21-
subject = pipe.supports('yolo');
22-
result = true;
23-
});
24-
25-
it('should not support null', () => {
26-
subject = pipe.supports(null);
27-
result = false;
28-
});
29-
30-
it('should not support NaN', () => {
31-
subject = pipe.supports(NaN);
32-
result = false;
33-
});
34-
35-
it('should not support new Object()', () => {
36-
subject = pipe.supports(new Object());
37-
result = false;
38-
});
39-
40-
it('should not support function(){}', () => {
41-
subject = pipe.supports(function(){});
42-
result = false;
43-
});
44-
45-
});
46-
47-
describe('#transform', () => {
48-
it('should transform string to Capitalized versions', () => {
49-
subject = pipe.transform('yolo');
50-
result = 'Yolo';
51-
});
52-
53-
it('should transform all strings to Capitalized versions', () => {
54-
var str = 'what does the scouter say about its power level';
55-
56-
subject = pipe.transform(str, true);
57-
result = 'What Does The Scouter Say About Its Power Level';
58-
});
59-
60-
});
61-
62-
63-
describe('#capitalizeWord', () => {
64-
it('should capitalized a word', () => {
65-
subject = pipe.capitalizeWord('something');
66-
result = 'Something';
67-
});
68-
69-
it('should only capitalized first char', () => {
70-
subject = pipe.capitalizeWord('something something something');
71-
result = 'Something something something';
72-
});
73-
74-
});
75-
76-
77-
});
78-
79-
describe('CapitalizeFactory', () => {
80-
var subject;
81-
var result;
82-
var factory;
83-
84-
beforeEach(() => {
85-
factory = new CapitalizeFactory();
86-
});
87-
88-
afterEach(() => {
89-
expect(subject).toEqual(result);
90-
});
91-
92-
it('should exist', () => {
93-
subject = Boolean(factory);
94-
result = true;
95-
});
96-
97-
describe('#support', () => {
98-
it('should support string', () => {
99-
subject = factory.supports('yolo');
100-
result = true;
101-
});
102-
103-
it('should not support null', () => {
104-
subject = factory.supports(null);
105-
result = false;
106-
});
107-
108-
it('should not support NaN', () => {
109-
subject = factory.supports(NaN);
110-
result = false;
111-
});
112-
113-
it('should not support new Object()', () => {
114-
subject = factory.supports(new Object());
115-
result = false;
116-
});
117-
118-
it('should not support function(){}', () => {
119-
subject = factory.supports(function(){});
120-
result = false;
121-
});
122-
123-
124-
});
125-
126-
describe('#create', () => {
127-
it('should be instance of CapitalizePipe', () => {
128-
subject = factory.create() instanceof CapitalizePipe;
129-
result = true;
130-
});
131-
132-
});
133-
134-
135-
});
136-
137-
138-
});
1+
/// <reference path="../../../typings/_custom.d.ts" />
2+
import {CapitalizePipe, CapitalizeFactory} from './Capitalize-Pipe';
3+
4+
describe('Capitalize', () => {
5+
6+
describe('CapitalizePipe', () => {
7+
var subject;
8+
var result;
9+
var pipe;
10+
11+
beforeEach(() => {
12+
pipe = new CapitalizePipe();
13+
});
14+
afterEach(() => {
15+
expect(subject).toEqual(result);
16+
});
17+
18+
describe('#support', () => {
19+
20+
it('should support string', () => {
21+
subject = pipe.supports('yolo');
22+
result = true;
23+
});
24+
25+
it('should not support null', () => {
26+
subject = pipe.supports(null);
27+
result = false;
28+
});
29+
30+
it('should not support NaN', () => {
31+
subject = pipe.supports(NaN);
32+
result = false;
33+
});
34+
35+
it('should not support new Object()', () => {
36+
subject = pipe.supports({});
37+
result = false;
38+
});
39+
40+
it('should not support function(){}', () => {
41+
subject = pipe.supports(function(){});
42+
result = false;
43+
});
44+
45+
});
46+
47+
describe('#transform', () => {
48+
it('should transform string to Capitalized versions', () => {
49+
subject = pipe.transform('yolo');
50+
result = 'Yolo';
51+
});
52+
53+
it('should transform all strings to Capitalized versions', () => {
54+
var str = 'what does the scouter say about its power level';
55+
56+
subject = pipe.transform(str, true);
57+
result = 'What Does The Scouter Say About Its Power Level';
58+
});
59+
60+
});
61+
62+
63+
describe('#capitalizeWord', () => {
64+
it('should capitalized a word', () => {
65+
subject = CapitalizePipe.capitalizeWord('something');
66+
result = 'Something';
67+
});
68+
69+
it('should only capitalized first char', () => {
70+
subject = CapitalizePipe.capitalizeWord('something something something');
71+
result = 'Something something something';
72+
});
73+
74+
});
75+
76+
77+
});
78+
79+
describe('CapitalizeFactory', () => {
80+
var subject;
81+
var result;
82+
var factory;
83+
84+
beforeEach(() => {
85+
factory = new CapitalizeFactory();
86+
});
87+
88+
afterEach(() => {
89+
expect(subject).toEqual(result);
90+
});
91+
92+
it('should exist', () => {
93+
subject = Boolean(factory);
94+
result = true;
95+
});
96+
97+
describe('#support', () => {
98+
it('should support string', () => {
99+
subject = factory.supports('yolo');
100+
result = true;
101+
});
102+
103+
it('should not support null', () => {
104+
subject = factory.supports(null);
105+
result = false;
106+
});
107+
108+
it('should not support NaN', () => {
109+
subject = factory.supports(NaN);
110+
result = false;
111+
});
112+
113+
it('should not support new Object()', () => {
114+
subject = factory.supports({});
115+
result = false;
116+
});
117+
118+
it('should not support function(){}', () => {
119+
subject = factory.supports(function(){});
120+
result = false;
121+
});
122+
123+
124+
});
125+
126+
describe('#create', () => {
127+
it('should be instance of CapitalizePipe', () => {
128+
subject = factory.create() instanceof CapitalizePipe;
129+
result = true;
130+
});
131+
132+
});
133+
134+
135+
});
136+
137+
138+
});

0 commit comments

Comments
 (0)