You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/wepy/src/util.js
+20-16Lines changed: 20 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -1,27 +1,27 @@
1
1
/**
2
2
* Tencent is pleased to support the open source community by making WePY available.
3
3
* Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4
-
*
4
+
*
5
5
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
6
6
* http://opensource.org/licenses/MIT
7
7
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copy file name to clipboardExpand all lines: packages/wepy/test/index.js
+24-4Lines changed: 24 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
/**
2
2
* Tencent is pleased to support the open source community by making WePY available.
3
3
* Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4
-
*
4
+
*
5
5
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
6
6
* http://opensource.org/licenses/MIT
7
7
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
8
*/
9
9
10
-
10
+
varImmutable=require('immutable')
11
11
varassert=require('assert');
12
12
varwepy=require('../lib/wepy.js').default;
13
13
@@ -22,8 +22,19 @@ describe('index.js', () => {
22
22
it('wepy.$isDeepEqual',()=>{
23
23
leta={a:{b:{c:{d:1}}}};
24
24
letb={a:{b:{c:{d:2}}}};
25
+
leta$=Immutable.fromJS(a);
26
+
leta1$=Immutable.fromJS(a);
27
+
leta2$=a$.setIn(['a','b','c','d'],2222)
28
+
25
29
assert.strictEqual(wepy.$isDeepEqual(a,b),false);
26
30
31
+
assert.equal(wepy.$isDeepEqual(a,a$),true,'compare with a immutable variable that has same values');
32
+
33
+
assert.equal(wepy.$isDeepEqual(b,a$),false,'compare with a immutable variable that has different values');
34
+
35
+
assert.equal(wepy.$isDeepEqual(a$,a1$),true,'compare two immutable variable that has same values');
36
+
37
+
assert.equal(wepy.$isDeepEqual(a1$,a2$),false,'compare two immutable variable that has different values');
Copy file name to clipboardExpand all lines: packages/wepy/test/util.js
+12-7Lines changed: 12 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,12 @@
1
1
/**
2
2
* Tencent is pleased to support the open source community by making WePY available.
3
3
* Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4
-
*
4
+
*
5
5
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
6
6
* http://opensource.org/licenses/MIT
7
7
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
8
*/
9
-
10
-
9
+
varImmutable=require('immutable')
11
10
varassert=require('assert');
12
11
varutil=require('../lib/util.js').default;
13
12
@@ -58,9 +57,6 @@ describe('util.js', () => {
58
57
59
58
});
60
59
61
-
62
-
63
-
64
60
it('$getParams',()=>{
65
61
66
62
letp;
@@ -80,4 +76,13 @@ describe('util.js', () => {
80
76
81
77
});
82
78
83
-
});
79
+
it('isImmutable',()=>{
80
+
leta$=Immutable.fromJS({a: 1111});
81
+
letb='a string';
82
+
83
+
assert.strictEqual(util.isImmutable(a$),true,'is a immutable variable');
84
+
85
+
assert.strictEqual(util.isImmutable(b),false,'is not a immutable variable');
0 commit comments