diff --git a/src/findNodes.spec.ts b/src/findNodes.spec.ts index 9225abd..98c9dd6 100644 --- a/src/findNodes.spec.ts +++ b/src/findNodes.spec.ts @@ -158,14 +158,8 @@ describe('findnode', () => { await program.transpile([], stagingDir); expect( - undent( - fsExtra.readFileSync(s`${stagingDir}/components/ZombieKeyboard-findnode.brs`).toString() - ) - ).to.equal(undent` - sub init() - m.helloZombieText = m.top.findNode("helloZombieText") - end sub - `); + fsExtra.readFileSync(s`${stagingDir}/components/ZombieKeyboard-findnode.brs`).toString() + ).to.equal(`sub init()\n m.helloZombieText = m.top.findNode("helloZombieText")\nend sub`); //make sure the import to this new file is present in the xml file expect( @@ -181,7 +175,7 @@ describe('findnode', () => { `); }); - it('it works when no init was found, but codebehind file doesbs file is present', async () => { + it('it works when no init was found', async () => { program.setFile('components/ZombieKeyboard.xml', ` @@ -235,7 +229,7 @@ describe('findnode', () => { await program.transpile([], stagingDir); expect( - undent(fsExtra.readFileSync(s`${stagingDir}/components/ZombieKeyboard-findnode.brs`).toString()) + fsExtra.readFileSync(s`${stagingDir}/components/ZombieKeyboard-findnode.brs`).toString() ).to.equal(undent` sub init() m.helloZombieText = m.top.findNode("helloZombieText") @@ -261,10 +255,11 @@ describe('findnode', () => { await program.transpile([], stagingDir); expect( - undent(fsExtra.readFileSync(s`${stagingDir}/components/ZombieKeyboard-findnode.brs`).toString()) + fsExtra.readFileSync(s`${stagingDir}/components/ZombieKeyboard-findnode.brs`).toString() ).to.equal(undent`'original contents`); + expect( - undent(fsExtra.readFileSync(s`${stagingDir}/components/ZombieKeyboard-findnode-2.brs`).toString()) + fsExtra.readFileSync(s`${stagingDir}/components/ZombieKeyboard-findnode-2.brs`).toString() ).to.equal(undent` sub init() m.helloZombieText = m.top.findNode("helloZombieText") @@ -290,7 +285,7 @@ describe('findnode', () => { await program.transpile([], stagingDir); expect( - undent(fsExtra.readFileSync(s`${stagingDir}/components/ZombieKeyboard-findnode.brs`).toString()) + fsExtra.readFileSync(s`${stagingDir}/components/ZombieKeyboard-findnode.brs`).toString() ).to.equal(undent`'original contents`); expect( undent(fsExtra.readFileSync(s`${stagingDir}/components/ZombieKeyboard-findnode-2.brs`).toString()) @@ -420,6 +415,29 @@ describe('findnode', () => { }]); }); + + it('it does not warn for findnode IDs NOT in the current xml file', () => { + program.setFile('components/ZombieKeyboard.bs', ` + sub init() + m.helloZombieText2 = m.top.findNode("notInMyXml") + end sub + `); + + program.setFile('components/ZombieKeyboard.xml', ` + +