From 2e41dc229b068d13c0d5a7451d2bd73e17eff6c1 Mon Sep 17 00:00:00 2001 From: Guillaume Marty Date: Thu, 17 Sep 2015 15:49:31 +0100 Subject: [PATCH] Bug 1202740 - [new homescreen] 'Enter search or address' is replaced by 'New home screen' when switching locales --- apps/system/js/app_chrome.js | 6 +++++- apps/system/test/unit/app_chrome_test.js | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/system/js/app_chrome.js b/apps/system/js/app_chrome.js index 458d241eb11c..422259554029 100644 --- a/apps/system/js/app_chrome.js +++ b/apps/system/js/app_chrome.js @@ -687,7 +687,11 @@ if (this._fixedTitle) { return; } - this.title.textContent = this.app.name; + if (!this.app.isHomescreen && !this.isSearchApp()) { + this.title.textContent = this.app.name; + } else { + this.title.setAttribute('data-l10n-id', 'search-or-enter-address'); + } }; AppChrome.prototype.handleScrollAreaChanged = function(evt) { diff --git a/apps/system/test/unit/app_chrome_test.js b/apps/system/test/unit/app_chrome_test.js index cc26a49fc59d..4f42f2cb0d10 100644 --- a/apps/system/test/unit/app_chrome_test.js +++ b/apps/system/test/unit/app_chrome_test.js @@ -520,6 +520,19 @@ suite('system/AppChrome', function() { assert.equal(chrome.title.textContent, 'Phone2'); }); + test('should not update the name of homescreen on change', function() { + var app = new AppWindow(cloneConfig(fakeWebSite)); + app.isHomescreen = true; + app.name = 'Home Screen'; + var chrome = new AppChrome(app); + assert.equal(chrome.title.textContent, ''); + + app.name = 'Home Screen 2'; + var evt = new CustomEvent('_namechanged'); + app.element.dispatchEvent(evt); + assert.equal(chrome.title.textContent, ''); + }); + test('localized app is not immediately overridden by titlechange event', function() { var app = new AppWindow(cloneConfig(fakeWebSite));