Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Bug 1074903 - Fall back to url if title doesnt exist. r=kgrandon
Browse files Browse the repository at this point in the history
  • Loading branch information
daleharvey committed Oct 2, 2014
1 parent ca05b8a commit d711d1e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/search/js/providers/places.js
Expand Up @@ -250,7 +250,7 @@
function formatTopResult(result) {
var div = document.createElement('div');
var span = document.createElement('span');
span.textContent = result.title;
span.textContent = result.title || result.url;
div.dataset.url = result.url;
div.classList.add('top-site');
div.appendChild(span);
Expand Down
26 changes: 26 additions & 0 deletions apps/search/test/marionette/browser_test.js
Expand Up @@ -4,6 +4,8 @@ var Home2 = require('../../../verticalhome/test/marionette/lib/home2');
var System = require('../../../system/test/marionette/lib/system');
var Search = require('./lib/search');

var assert = require('chai').assert;

marionette('Browser test', function() {

var client = marionette.client(Home2.clientOptions);
Expand Down Expand Up @@ -56,4 +58,28 @@ marionette('Browser test', function() {
});
});

test('Ensure fallback to url when no place title', function() {

client.executeAsyncScript(function() {
var settings = window.wrappedJSObject.navigator.mozSettings;
var result = settings.createLock().set({
'operatorResources.data.topsites': {
'topSites': [{url: 'http://example1.org'}]
}
});
result.onsuccess = function() {
marionetteScriptFinished();
};
});

client.apps.launch(Search.URL);
client.apps.switchToApp(Search.URL);

client.waitFor(function() {
return search.getTopSites().length == 1;
});

var topSite = search.getTopSites()[0];
assert.equal(topSite.text(), 'http://example1.org');
});
});

0 comments on commit d711d1e

Please sign in to comment.