mardi 8 décembre 2015

why is the children of this singleNodeValue undefined when running a unit test using jamine + karma + phantomJS

var xmlS="<entity><book><title>tt</title><price>2</price></book></entity>";
var dom=new DOMParser().parseFromString(xmlS, 'text/xml');
var t=dom.evaluate("/entity/book", dom, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;

The result of the above code in a browser console/angular app I'm developing is:

[title, price]

However when running the same code in a Jasmine unit test using Karma and protractor t.children is undefined.

Can anyone tell me what the issue is?

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire