@@ -27,11 +27,17 @@ function getContext(
2727 done : DoneFn ,
2828 { resolveMap, expectedDeps, expectedRegs, assureNoDeps, ignore, expectError } : TestSetup ) {
2929 const actualDeps : string [ ] = [ ] ;
30+ let callbackCalled = false ;
3031
3132 const loaderContext = {
3233 rootContext : "app" ,
3334 context : "app/component" ,
3435 async : ( ) => ( error , source : string ) => {
36+ if ( callbackCalled ) {
37+ done . fail ( "Callback called more than once!" ) ;
38+ }
39+ callbackCalled = true ;
40+
3541 expectedDeps . forEach ( expectedDep => expect ( actualDeps ) . toContain ( expectedDep ) ) ;
3642
3743 expectedRegs . forEach ( ( { name, path } ) => {
@@ -221,4 +227,54 @@ describe("XmlNamespaceLoader", () => {
221227
222228 xmlNsLoader . call ( loaderContext , testXml ) ;
223229 } )
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+ } )
224280} ) ;
0 commit comments