@@ -20,13 +20,15 @@ interface TestSetup {
20
20
expectedRegs : { name : string , path : string } [ ] ,
21
21
ignore ?: RegExp ,
22
22
assureNoDeps ?: boolean ,
23
- expectError ?: boolean
23
+ expectError ?: boolean ,
24
+ expectWarnings ?: number
24
25
}
25
26
26
27
function getContext (
27
28
done : DoneFn ,
28
- { resolveMap, expectedDeps, expectedRegs, assureNoDeps, ignore, expectError } : TestSetup ) {
29
+ { resolveMap, expectedDeps, expectedRegs, assureNoDeps, ignore, expectError, expectWarnings } : TestSetup ) {
29
30
const actualDeps : string [ ] = [ ] ;
31
+ const actualWarnings : Error [ ] = [ ]
30
32
let callbackCalled = false ;
31
33
32
34
const loaderContext = {
@@ -50,6 +52,10 @@ function getContext(
50
52
expect ( source ) . not . toContain ( "global.registerModule" ) ;
51
53
}
52
54
55
+ if ( expectWarnings ) {
56
+ expect ( actualWarnings . length ) . toEqual ( expectWarnings ) ;
57
+ }
58
+
53
59
if ( error && ! expectError ) {
54
60
done . fail ( error )
55
61
} else if ( ! error && expectError ) {
@@ -69,6 +75,9 @@ function getContext(
69
75
addDependency : ( dep : string ) => {
70
76
actualDeps . push ( dep ) ;
71
77
} ,
78
+ emitWarning : ( err : Error ) => {
79
+ actualWarnings . push ( err ) ;
80
+ } ,
72
81
query : { ignore }
73
82
}
74
83
@@ -277,4 +286,30 @@ describe("XmlNamespaceLoader", () => {
277
286
278
287
xmlNsLoader . call ( loaderContext , testXml ) ;
279
288
} )
289
+
290
+
291
+ it ( "with '&&', '||', '<=' and '>=' in binding expression, emits warnings, but does not fail" , ( done ) => {
292
+ const resolveMap = {
293
+ "nativescript-ui-chart" : "node_module/nativescript-ui-chart/ui-chart.js" ,
294
+ }
295
+
296
+ const expectedDeps = [ ] ;
297
+
298
+ const expectedRegs = [
299
+ { name : "nativescript-ui-chart" , path : "nativescript-ui-chart" } ,
300
+ { name : "nativescript-ui-chart/RadCartesianChart" , path : "nativescript-ui-chart" } ,
301
+ ] ;
302
+
303
+ const testXml = `
304
+ <Page xmlns="http://www.nativescript.org/tns.xsd">
305
+ <StackLayout xmlns:chart="nativescript-ui-chart">
306
+ <TextField text="{{ var1 && var2 || var1 >= var2 || var2 <= var1 }}" />
307
+ <chart:RadCartesianChart></chart:RadCartesianChart>
308
+ </StackLayout>
309
+ </Page>` ;
310
+
311
+ const loaderContext = getContext ( done , { resolveMap, expectedDeps, expectedRegs, expectWarnings : 1 } ) ;
312
+
313
+ xmlNsLoader . call ( loaderContext , testXml ) ;
314
+ } )
280
315
} ) ;
0 commit comments