@@ -27,11 +27,17 @@ function getContext(
27
27
done : DoneFn ,
28
28
{ resolveMap, expectedDeps, expectedRegs, assureNoDeps, ignore, expectError } : TestSetup ) {
29
29
const actualDeps : string [ ] = [ ] ;
30
+ let callbackCalled = false ;
30
31
31
32
const loaderContext = {
32
33
rootContext : "app" ,
33
34
context : "app/component" ,
34
35
async : ( ) => ( error , source : string ) => {
36
+ if ( callbackCalled ) {
37
+ done . fail ( "Callback called more than once!" ) ;
38
+ }
39
+ callbackCalled = true ;
40
+
35
41
expectedDeps . forEach ( expectedDep => expect ( actualDeps ) . toContain ( expectedDep ) ) ;
36
42
37
43
expectedRegs . forEach ( ( { name, path } ) => {
@@ -221,4 +227,54 @@ describe("XmlNamespaceLoader", () => {
221
227
222
228
xmlNsLoader . call ( loaderContext , testXml ) ;
223
229
} )
230
+
231
+ it ( "doesn't throw with ios and android platform namespaces" , ( done ) => {
232
+ const resolveMap = { } ;
233
+ const expectedDeps = [ ] ;
234
+ const expectedRegs = [ ] ;
235
+
236
+ const testXml = `
237
+ <Page xmlns="http://www.nativescript.org/tns.xsd">
238
+ <ios:GridLayout />
239
+ <android:GridLayout />
240
+ </Page>` ;
241
+
242
+ const loaderContext = getContext ( done , { resolveMap, expectedDeps, expectedRegs, assureNoDeps : true } ) ;
243
+
244
+ xmlNsLoader . call ( loaderContext , testXml ) ;
245
+ } )
246
+
247
+ it ( "doesn't throw with ios and android platform namespaces" , ( done ) => {
248
+ const resolveMap = { } ;
249
+ const expectedDeps = [ ] ;
250
+ const expectedRegs = [ ] ;
251
+
252
+ const testXml = `
253
+ <Page xmlns="http://www.nativescript.org/tns.xsd">
254
+ <ios:GridLayout />
255
+ <ios:GridLayout></ios:GridLayout>
256
+ <android:GridLayout />
257
+ <android:GridLayout></android:GridLayout>
258
+ </Page>` ;
259
+
260
+ const loaderContext = getContext ( done , { resolveMap, expectedDeps, expectedRegs, assureNoDeps : true } ) ;
261
+
262
+ xmlNsLoader . call ( loaderContext , testXml ) ;
263
+ } )
264
+
265
+ it ( "throws with unbound namespace namespaces" , ( done ) => {
266
+ const resolveMap = { } ;
267
+ const expectedDeps = [ ] ;
268
+ const expectedRegs = [ ] ;
269
+
270
+ const testXml = `
271
+ <Page xmlns="http://www.nativescript.org/tns.xsd">
272
+ <custom1:CustomComponent />
273
+ <custom2:CustomComponent />
274
+ </Page>` ;
275
+
276
+ const loaderContext = getContext ( done , { resolveMap, expectedDeps, expectedRegs, expectError : true } ) ;
277
+
278
+ xmlNsLoader . call ( loaderContext , testXml ) ;
279
+ } )
224
280
} ) ;
0 commit comments