diff --git a/tests/tests.js b/tests/tests.js index 15dc7b1e..a9e25028 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -76,8 +76,6 @@ define(function (require) { localArchive.findTitlesWithPrefix("Am", callbackFunction); }); - //TODO check findTitlesWithPrefix - // Create a title instance for the Article 'Abraham' var titleAbraham = new evopedia.Title(); titleAbraham.archive = localArchive; @@ -89,7 +87,23 @@ define(function (require) { titleAbraham.titleOffset = 57; // TODO check parseTitle for Abraham, and for another one with escape characters - // TODO check getTitleByName + + asyncTest("check getTitleByName with accents : Diego Velázquez", function() { + var callbackFunction = function(titleList) { + ok (titleList && titleList.length==1,"One title found"); + equal(titleList[0].name,"Diego_Velázquez","Name of the title is correct"); + start(); + }; + localArchive.getTitleByName("Diego Velázquez",callbackFunction); + }); + asyncTest("check getTitleByName with quote : Hundred Years' War", function() { + var callbackFunction = function(titleList) { + ok (titleList && titleList.length==1,"One title found"); + equal(titleList[0].name,"Hundred_Years'_War","Name of the title is correct"); + start(); + }; + localArchive.getTitleByName("Hundred Years' War",callbackFunction); + }); test("check parseTitleFromId", function() { var titleId = "small|2010-08-14|0|57|Abraham|2364940|127640|10071"; diff --git a/www/js/app.js b/www/js/app.js index 504bd9d4..96c82807 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -127,6 +127,8 @@ define(function(require) { */ function populateDropDownListOfTitles(titleList) { var comboTitleList = document.getElementById('titleList'); + // Remove previous results + comboTitleList.options.length = 0; for (var i=0; i