@@ -5,17 +5,17 @@ type ViewUtil = ɵViewUtil.ViewUtil;
5
5
6
6
class TestView extends View implements NgView {
7
7
public meta : ViewClassMeta = { skipAddToDom : false } ;
8
- public nodeType : number = 1 ;
9
- public nodeName : string = 'TestView' ;
8
+ public nodeType = 1 ;
9
+ public nodeName = 'TestView' ;
10
10
public parentNode : NgView = null ;
11
11
public previousSibling : NgView ;
12
12
public nextSibling : NgView ;
13
13
public firstChild : NgView ;
14
14
public lastChild : NgView ;
15
15
public ngCssClasses : Map < string , boolean > = new Map < string , boolean > ( ) ;
16
16
17
- public stringValue : string = '' ;
18
- public numValue : number = 0 ;
17
+ public stringValue = '' ;
18
+ public numValue = 0 ;
19
19
public boolValue : boolean = undefined ;
20
20
public anyValue : any = undefined ;
21
21
public nested : { property : string } = { property : 'untouched' } ;
@@ -34,13 +34,13 @@ describe('setting View properties', () => {
34
34
} ) ;
35
35
36
36
it ( 'preserves string values' , ( ) => {
37
- let view = new TestView ( ) ;
37
+ const view = new TestView ( ) ;
38
38
viewUtil . setProperty ( view , 'stringValue' , 'blah' ) ;
39
39
expect ( view . stringValue ) . toBe ( 'blah' ) ;
40
40
} ) ;
41
41
42
42
it ( "doesn't convert number values" , ( ) => {
43
- let view = new TestView ( ) ;
43
+ const view = new TestView ( ) ;
44
44
viewUtil . setProperty ( view , 'numValue' , '42' ) ;
45
45
expect ( view . numValue ) . toBe ( < any > '42' ) ;
46
46
@@ -52,70 +52,70 @@ describe('setting View properties', () => {
52
52
} ) ;
53
53
54
54
it ( "doesn't convert boolean values" , ( ) => {
55
- let view = new TestView ( ) ;
55
+ const view = new TestView ( ) ;
56
56
viewUtil . setProperty ( view , 'boolValue' , 'true' ) ;
57
57
expect ( view . boolValue ) . toBe ( < any > 'true' ) ;
58
58
viewUtil . setProperty ( view , 'boolValue' , 'false' ) ;
59
59
expect ( view . boolValue ) . toBe ( < any > 'false' ) ;
60
60
} ) ;
61
61
62
62
it ( 'sets style values' , ( ) => {
63
- let view = new TestView ( ) ;
63
+ const view = new TestView ( ) ;
64
64
viewUtil . setProperty ( view , 'style' , 'color: red' ) ;
65
65
expect ( view . style . color . hex ) . toBe ( new Color ( 'red' ) . hex ) ;
66
66
} ) ;
67
67
68
68
it ( "doesn't convert blank strings" , ( ) => {
69
- let view = new TestView ( ) ;
69
+ const view = new TestView ( ) ;
70
70
viewUtil . setProperty ( view , 'stringValue' , '' ) ;
71
71
expect ( view . stringValue ) . toBe ( '' ) ;
72
72
} ) ;
73
73
74
74
it ( "doesn't convert booleans" , ( ) => {
75
- let view = new TestView ( ) ;
75
+ const view = new TestView ( ) ;
76
76
viewUtil . setProperty ( view , 'boolValue' , true ) ;
77
77
expect ( view . boolValue ) . toBe ( true ) ;
78
78
viewUtil . setProperty ( view , 'boolValue' , false ) ;
79
79
expect ( view . boolValue ) . toBe ( false ) ;
80
80
} ) ;
81
81
82
82
it ( 'preserves objects' , ( ) => {
83
- let value = { name : 'Jim' , age : 23 } ;
84
- let view = new TestView ( ) ;
83
+ const value = { name : 'Jim' , age : 23 } ;
84
+ const view = new TestView ( ) ;
85
85
viewUtil . setProperty ( view , 'anyValue' , value ) ;
86
86
expect ( value ) . toEqual ( view . anyValue ) ;
87
87
} ) ;
88
88
89
89
it ( 'sets nested properties' , ( ) => {
90
- let view = new TestView ( ) ;
90
+ const view = new TestView ( ) ;
91
91
viewUtil . setProperty ( view , 'nested.property' , 'blah' ) ;
92
92
expect ( view . nested . property ) . toBe ( 'blah' ) ;
93
93
} ) ;
94
94
95
95
it ( 'sets ios property in ios' , ( ) => {
96
- let view = new TestView ( ) ;
97
- let testUtil = createViewUtil ( iosDevice ) ;
96
+ const view = new TestView ( ) ;
97
+ const testUtil = createViewUtil ( iosDevice ) ;
98
98
testUtil . setProperty ( view , 'anyValue' , 'blah' , 'ios' ) ;
99
99
expect ( view . anyValue ) . toBe ( 'blah' ) ;
100
100
} ) ;
101
101
102
102
it ( "doesn't set android property in ios" , ( ) => {
103
- let view = new TestView ( ) ;
104
- let testUtil = createViewUtil ( iosDevice ) ;
103
+ const view = new TestView ( ) ;
104
+ const testUtil = createViewUtil ( iosDevice ) ;
105
105
testUtil . setProperty ( view , 'anyValue' , 'blah' , 'android' ) ;
106
106
expect ( view . anyValue ) . toBeUndefined ( ) ;
107
107
} ) ;
108
108
109
109
it ( 'sets android property in android' , ( ) => {
110
- let view = new TestView ( ) ;
111
- let testUtil = createViewUtil ( androidDevice ) ;
110
+ const view = new TestView ( ) ;
111
+ const testUtil = createViewUtil ( androidDevice ) ;
112
112
testUtil . setProperty ( view , 'anyValue' , 'blah' , 'android' ) ;
113
113
expect ( view . anyValue ) . toBe ( 'blah' ) ;
114
114
} ) ;
115
115
116
116
it ( "doesn't set ios property in android" , ( ) => {
117
- let view = new TestView ( ) ;
118
- let testUtil = createViewUtil ( androidDevice ) ;
117
+ const view = new TestView ( ) ;
118
+ const testUtil = createViewUtil ( androidDevice ) ;
119
119
testUtil . setProperty ( view , 'anyValue' , 'blah' , 'ios' ) ;
120
120
expect ( view . anyValue ) . toBeUndefined ( ) ;
121
121
} ) ;
0 commit comments