use the more portable $(obj).text() instead obj.text, MKWS-77
authorWolfram Schneider <wosch@indexdata.dk>
Fri, 24 Jan 2014 14:15:20 +0000 (14:15 +0000)
committerWolfram Schneider <wosch@indexdata.dk>
Fri, 24 Jan 2014 14:15:20 +0000 (14:15 +0000)
jquery xpath match returns a list of HTML object, so we need to convert the
object back to jquery, and run the .text() method on it instead .text property

test/spec/mkws-pazpar2.js

index e52e0f8..657b5dd 100644 (file)
@@ -212,7 +212,7 @@ describe("Check Termlist", function () {
         // do not click on author names without a comma, e.g.: "Joe Barbara"
         var terms = $("div#mkwsFacetAuthors div.term a");
         for (var i = 0; i < terms.length; i++) {
-            var term = terms[i].text;
+            var term = $(terms[i]).text();
             if (term.match(/[0-9].+[0-9]/i) || !term.match(/,/)) {
                 debug("ignore author facet: " + term);
                 author_number++;
@@ -239,11 +239,13 @@ describe("Check Termlist", function () {
     it("limit search to first source", function () {
         var hits_all_targets = get_hit_counter();
         var source_number = 2; // 2=first source
+
         // do not click on wikipedia link - no author or subject facets possible
         var terms = $("div#mkwsFacetSources div.term a");
         for (var i = 0; i < terms.length; i++) {
-            if (terms[i].text.match(/wikipedia/i)) {
-                debug("ignore source facet: " + terms[i].text);
+            var term = $(terms[i]).text();
+            if (term.match(/wikipedia/i)) {
+                debug("ignore source facet: " + term);
                 source_number++;
             } else {
                 break;