[extensions-web] js: Clean up findHighestNextVersion a bit
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] js: Clean up findHighestNextVersion a bit
- Date: Thu, 8 Dec 2011 20:24:48 +0000 (UTC)
commit f5e930c48a5ee69a11f35befeaed49966dff589a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Dec 8 15:22:57 2011 -0500
js: Clean up findHighestNextVersion a bit
currentParts[2] will never be undefined, so we can clean up
the code here a bit.
sweettooth/static/js/extensionUtils.js | 4 ++--
sweettooth/static/js/test/extensions.js | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/sweettooth/static/js/extensionUtils.js b/sweettooth/static/js/extensionUtils.js
index 2c85edf..9309dad 100644
--- a/sweettooth/static/js/extensionUtils.js
+++ b/sweettooth/static/js/extensionUtils.js
@@ -80,8 +80,8 @@ define([], function() {
if (parts[0] >= currentParts[0] &&
parts[1] >= currentParts[1] &&
- ((parts[2] !== undefined && currentParts[2] !== undefined && parts[2] >= currentParts[2])
- || parts[2] === undefined || currentParts[2] === undefined) &&
+ ((parts[2] !== undefined && parts[2] >= currentParts[2])
+ || parts[2] === undefined) &&
parts[0] < nextHighestParts[0] &&
parts[1] < nextHighestParts[1] &&
((parts[2] !== undefined && parts[2] < nextHighestParts[2]) || parts[2] === undefined))
diff --git a/sweettooth/static/js/test/extensions.js b/sweettooth/static/js/test/extensions.js
index eebf8b3..7bc0cad 100644
--- a/sweettooth/static/js/test/extensions.js
+++ b/sweettooth/static/js/test/extensions.js
@@ -32,10 +32,10 @@ require(['extensionUtils', 'jquery', 'test/qunit'], function(extensionUtils) {
var findNextHighestVersion = extensionUtils.findNextHighestVersion;
test("findNextHighestVersion", function() {
- equal(findNextHighestVersion({ "3.2": true }, "3.0"), "3.2");
+ equal(findNextHighestVersion({ "3.2": true }, "3.0"), "3.2.0");
equal(findNextHighestVersion({ "3.2.1": true }, "3.0"), "3.2.1");
equal(findNextHighestVersion({ "3.2.1": true, "3.0": true }, "3.2"), "3.2.1");
- equal(findNextHighestVersion({ "3.3": true, "3.0": true }, "3.2"), "3.3");
+ equal(findNextHighestVersion({ "3.3": true, "3.0": true }, "3.2"), "3.3.0");
equal(findNextHighestVersion({ "3.2.1": true, "3.0": true, "3.3.1": true }, "3.2"), "3.2.1");
});
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]