1
1
import * as utils from 'renderer/utils'
2
2
3
- jest . mock ( 'ui/core/view' , ( ) => {
3
+ jest . mock ( 'tns-core-modules/ ui/core/view' , ( ) => {
4
4
return {
5
5
View ( ) {
6
6
}
7
7
}
8
8
} , { virtual : true } )
9
- jest . mock ( 'ui/content-view' , ( ) => {
9
+ jest . mock ( 'tns-core-modules/ ui/content-view' , ( ) => {
10
10
return {
11
11
ContentView ( ) {
12
12
}
13
13
}
14
14
} , { virtual : true } )
15
- jest . mock ( 'ui/layouts/layout-base' , ( ) => {
15
+ jest . mock ( 'tns-core-modules/ ui/layouts/layout-base' , ( ) => {
16
16
return {
17
17
LayoutBase ( ) {
18
18
}
@@ -34,7 +34,7 @@ const getParentAndChild = (parentType) => {
34
34
35
35
describe ( 'utils' , ( ) => {
36
36
test ( 'isView' , ( ) => {
37
- const View = require ( 'ui/core/view' ) . View ;
37
+ const View = require ( 'tns-core-modules/ ui/core/view' ) . View ;
38
38
39
39
expect ( utils . isView ( ) ) . toEqual ( false )
40
40
expect ( utils . isView ( 'a' ) ) . toEqual ( false )
@@ -43,7 +43,7 @@ describe('utils', () => {
43
43
} )
44
44
45
45
test ( 'isLayout' , ( ) => {
46
- const LayoutBase = require ( 'ui/layouts/layout-base' ) . LayoutBase ;
46
+ const LayoutBase = require ( 'tns-core-modules/ ui/layouts/layout-base' ) . LayoutBase ;
47
47
48
48
expect ( utils . isLayout ( ) ) . toEqual ( false )
49
49
expect ( utils . isLayout ( 'a' ) ) . toEqual ( false )
@@ -52,7 +52,7 @@ describe('utils', () => {
52
52
} )
53
53
54
54
test ( 'isContentView' , ( ) => {
55
- const ContentView = require ( 'ui/content-view' ) . ContentView ;
55
+ const ContentView = require ( 'tns-core-modules/ ui/content-view' ) . ContentView ;
56
56
57
57
expect ( utils . isContentView ( ) ) . toEqual ( false )
58
58
expect ( utils . isContentView ( 'a' ) ) . toEqual ( false )
@@ -73,7 +73,7 @@ describe('utils', () => {
73
73
74
74
75
75
test ( 'insertChild adds childNode to Layout parent' , ( ) => {
76
- const LayoutBase = require ( 'ui/layouts/layout-base' ) . LayoutBase ;
76
+ const LayoutBase = require ( 'tns-core-modules/ ui/layouts/layout-base' ) . LayoutBase ;
77
77
const { parentNode, childNode} = getParentAndChild ( LayoutBase ) ;
78
78
parentNode . nativeView . addChild = jest . fn ( ) ;
79
79
childNode . nativeView . parent = null ;
@@ -84,7 +84,7 @@ describe('utils', () => {
84
84
85
85
86
86
test ( 'insertChild adds childNode at index to Layout parent' , ( ) => {
87
- const LayoutBase = require ( 'ui/layouts/layout-base' ) . LayoutBase ;
87
+ const LayoutBase = require ( 'tns-core-modules/ ui/layouts/layout-base' ) . LayoutBase ;
88
88
const { parentNode, childNode} = getParentAndChild ( LayoutBase ) ;
89
89
parentNode . nativeView . insertChild = jest . fn ( ) ;
90
90
childNode . nativeView . parent = null ;
@@ -94,7 +94,7 @@ describe('utils', () => {
94
94
} )
95
95
96
96
test ( 'insertChild removes childNode if the parent is the same Layout parent' , ( ) => {
97
- const LayoutBase = require ( 'ui/layouts/layout-base' ) . LayoutBase ;
97
+ const LayoutBase = require ( 'tns-core-modules/ ui/layouts/layout-base' ) . LayoutBase ;
98
98
const { parentNode, childNode} = getParentAndChild ( LayoutBase ) ;
99
99
parentNode . nativeView . getChildIndex = jest . fn ( ) . mockReturnValueOnce ( 1 ) . mockReturnValueOnce ( - 1 ) ;
100
100
parentNode . nativeView . removeChild = jest . fn ( ) ;
@@ -112,7 +112,7 @@ describe('utils', () => {
112
112
} )
113
113
114
114
test ( 'insertChild adds comment node to ContentView parent' , ( ) => {
115
- const ContentView = require ( 'ui/content-view' ) . ContentView ;
115
+ const ContentView = require ( 'tns-core-modules/ ui/content-view' ) . ContentView ;
116
116
const { parentNode, childNode} = getParentAndChild ( ContentView ) ;
117
117
childNode . nodeType = 8 ;
118
118
parentNode . nativeView . _addView = jest . fn ( ) ;
@@ -122,7 +122,7 @@ describe('utils', () => {
122
122
} )
123
123
124
124
test ( 'insertChild sets content of ContentView parent' , ( ) => {
125
- const ContentView = require ( 'ui/content-view' ) . ContentView ;
125
+ const ContentView = require ( 'tns-core-modules/ ui/content-view' ) . ContentView ;
126
126
const { parentNode, childNode} = getParentAndChild ( ContentView ) ;
127
127
128
128
utils . insertChild ( parentNode , childNode ) ;
0 commit comments