File tree 5 files changed +25
-6
lines changed
5 files changed +25
-6
lines changed Original file line number Diff line number Diff line change 9
9
< script src ="bower_components/angular-route/angular-route.js "> </ script >
10
10
< script src ="js/app.js "> </ script >
11
11
< script src ="js/controllers.js "> </ script >
12
+ < script src ="js/filters.js "> </ script >
12
13
</ head >
13
14
< body >
14
15
Original file line number Diff line number Diff line change 4
4
5
5
var phonecatApp = angular . module ( 'phonecatApp' , [
6
6
'ngRoute' ,
7
- 'phonecatControllers'
7
+ 'phonecatControllers' ,
8
+ 'phonecatFilters'
8
9
] ) ;
9
10
10
11
phonecatApp . config ( [ '$routeProvider' ,
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
3
/* Filters */
4
+
5
+ angular . module ( 'phonecatFilters' , [ ] ) . filter ( 'checkmark' , function ( ) {
6
+ return function ( input ) {
7
+ return input ? '\u2713' : '\u2718' ;
8
+ } ;
9
+ } ) ;
Original file line number Diff line number Diff line change @@ -48,9 +48,9 @@ <h1>{{phone.name}}</h1>
48
48
< dt > Bluetooth</ dt >
49
49
< dd > {{phone.connectivity.bluetooth}}</ dd >
50
50
< dt > Infrared</ dt >
51
- < dd > {{phone.connectivity.infrared}}</ dd >
51
+ < dd > {{phone.connectivity.infrared | checkmark }}</ dd >
52
52
< dt > GPS</ dt >
53
- < dd > {{phone.connectivity.gps}}</ dd >
53
+ < dd > {{phone.connectivity.gps | checkmark }}</ dd >
54
54
</ dl >
55
55
</ li >
56
56
< li >
@@ -79,7 +79,7 @@ <h1>{{phone.name}}</h1>
79
79
< dt > Screen resolution</ dt >
80
80
< dd > {{phone.display.screenResolution}}</ dd >
81
81
< dt > Touch screen</ dt >
82
- < dd > {{phone.display.touchScreen}}</ dd >
82
+ < dd > {{phone.display.touchScreen | checkmark }}</ dd >
83
83
</ dl >
84
84
</ li >
85
85
< li >
@@ -92,9 +92,9 @@ <h1>{{phone.name}}</h1>
92
92
< dt > Audio / headphone jack</ dt >
93
93
< dd > {{phone.hardware.audioJack}}</ dd >
94
94
< dt > FM Radio</ dt >
95
- < dd > {{phone.hardware.fmRadio}}</ dd >
95
+ < dd > {{phone.hardware.fmRadio | checkmark }}</ dd >
96
96
< dt > Accelerometer</ dt >
97
- < dd > {{phone.hardware.accelerometer}}</ dd >
97
+ < dd > {{phone.hardware.accelerometer | checkmark }}</ dd >
98
98
</ dl >
99
99
</ li >
100
100
< li >
Original file line number Diff line number Diff line change 4
4
5
5
describe ( 'filter' , function ( ) {
6
6
7
+ beforeEach ( module ( 'phonecatFilters' ) ) ;
8
+
9
+
10
+ describe ( 'checkmark' , function ( ) {
11
+
12
+ it ( 'should convert boolean values to unicode checkmark or cross' ,
13
+ inject ( function ( checkmarkFilter ) {
14
+ expect ( checkmarkFilter ( true ) ) . toBe ( '\u2713' ) ;
15
+ expect ( checkmarkFilter ( false ) ) . toBe ( '\u2718' ) ;
16
+ } ) ) ;
17
+ } ) ;
7
18
} ) ;
You can’t perform that action at this time.
0 commit comments