Skip to content

Commit

Permalink
Merge branch 'shadiakiki1986-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
JLRishe committed Feb 25, 2016
2 parents 2ec3a73 + 74b29be commit cada2aa
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,29 @@ module.exports = {
test.done();
},

'select attribute multiple by tag': function (test) {
var xml = '<author name="J. K. Rowling"></author><author name="Saeed Akl"></author>';
var doc = new dom().parseFromString(xml);

var authors = xpath.select('/author', doc);
assert.equal(2, authors.length);

test.done();
},

'select attribute multiple by attribute': function (test) {
var xml = '<author name="J. K. Rowling"></author><author name="Saeed Akl"></author>';
var doc = new dom().parseFromString(xml);

var authors = xpath.select('/author/@name', doc);
// The following works
//var authors = xpath.select('/author', doc);
//authors=authors.map(function(x) { return x.getAttribute("name"); });
assert.equal(2, authors.length);

test.done();
},

'XPathException acts like Error': function (test) {
try {
xpath.evaluate('1', null, null, null);
Expand Down

0 comments on commit cada2aa

Please sign in to comment.