@@ -20,13 +20,15 @@ interface TestSetup {
2020 expectedRegs : { name : string , path : string } [ ] ,
2121 ignore ?: RegExp ,
2222 assureNoDeps ?: boolean ,
23- expectError ?: boolean
23+ expectError ?: boolean ,
24+ expectWarnings ?: number
2425}
2526
2627function getContext (
2728 done : DoneFn ,
28- { resolveMap, expectedDeps, expectedRegs, assureNoDeps, ignore, expectError } : TestSetup ) {
29+ { resolveMap, expectedDeps, expectedRegs, assureNoDeps, ignore, expectError, expectWarnings } : TestSetup ) {
2930 const actualDeps : string [ ] = [ ] ;
31+ const actualWarnings : Error [ ] = [ ]
3032 let callbackCalled = false ;
3133
3234 const loaderContext = {
@@ -50,6 +52,10 @@ function getContext(
5052 expect ( source ) . not . toContain ( "global.registerModule" ) ;
5153 }
5254
55+ if ( expectWarnings ) {
56+ expect ( actualWarnings . length ) . toEqual ( expectWarnings ) ;
57+ }
58+
5359 if ( error && ! expectError ) {
5460 done . fail ( error )
5561 } else if ( ! error && expectError ) {
@@ -69,6 +75,9 @@ function getContext(
6975 addDependency : ( dep : string ) => {
7076 actualDeps . push ( dep ) ;
7177 } ,
78+ emitWarning : ( err : Error ) => {
79+ actualWarnings . push ( err ) ;
80+ } ,
7281 query : { ignore }
7382 }
7483
@@ -277,4 +286,30 @@ describe("XmlNamespaceLoader", () => {
277286
278287 xmlNsLoader . call ( loaderContext , testXml ) ;
279288 } )
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+ } )
280315} ) ;
0 commit comments