From 290b18b7229c7c24512d0a507ab14caca53ed9ea Mon Sep 17 00:00:00 2001 From: soulgalore Date: Tue, 1 Jul 2014 13:23:50 +0200 Subject: [PATCH] show better os names on Windows and nicer browser names --- lib/hb-helpers.js | 14 +++++++++----- templates/partials/browserMeasurements.hb | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/hb-helpers.js b/lib/hb-helpers.js index 9fd9310ff..8bfd77593 100644 --- a/lib/hb-helpers.js +++ b/lib/hb-helpers.js @@ -85,14 +85,18 @@ module.exports.registerHelpers = function registerHelpers() { }); hb.registerHelper('prettyOSName', function(name) { - // TODO make first character upper case and return one windows name + // Selenium is used when fetching OS names (for BrowserTime) + // and windows has the following names, change them to + // just Windows var windows = ['xp', 'windows', 'win8', 'win7']; - return name; + if (windows.indexOf(name)>-1) + return 'Windows'; + else + return name.substr(0, 1).toUpperCase() + name.substr(1); }); - hb.registerHelper('prettyBrowserName', function(name) { - // TODO upper case the browser name - return name; + hb.registerHelper('capitalize', function(word) { + return word.substr(0, 1).toUpperCase() + word.substr(1); }); hb.registerHelper('getPlural', function(value) { diff --git a/templates/partials/browserMeasurements.hb b/templates/partials/browserMeasurements.hb index 98af9937b..4c41e4f00 100644 --- a/templates/partials/browserMeasurements.hb +++ b/templates/partials/browserMeasurements.hb @@ -1,6 +1,6 @@
-

Page tested with {{prettyBrowserName pageData.browserName}} version {{pageData.browserVersion}} on +

Page tested with {{capitalize pageData.browserName}} version {{pageData.browserVersion}} on {{prettyOSName pageData.platform}} with {{timingRuns.length}} run{{getPlural timingRuns.length}}.