mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-25 22:29:07 +00:00
Bug 617493: Support no contribution amount. r=Unfocused, a=blocks-betaN
This commit is contained in:
parent
7c6599530e
commit
eb11e25625
@ -945,7 +945,7 @@ var AddonRepository = {
|
||||
case "contribution_data":
|
||||
let meetDevelopers = this._getDescendantTextContent(node, "meet_developers");
|
||||
let suggestedAmount = this._getDescendantTextContent(node, "suggested_amount");
|
||||
if (meetDevelopers != null && suggestedAmount != null) {
|
||||
if (meetDevelopers != null) {
|
||||
addon.contributionURL = meetDevelopers;
|
||||
addon.contributionAmount = suggestedAmount;
|
||||
}
|
||||
|
@ -2251,9 +2251,14 @@ var gDetailView = {
|
||||
if ("contributionURL" in aAddon && aAddon.contributionURL) {
|
||||
contributions.hidden = false;
|
||||
var amount = document.getElementById("detail-contrib-suggested");
|
||||
amount.value = gStrings.ext.formatStringFromName("contributionAmount2",
|
||||
[aAddon.contributionAmount],
|
||||
1);
|
||||
if (aAddon.contributionAmount) {
|
||||
amount.value = gStrings.ext.formatStringFromName("contributionAmount2",
|
||||
[aAddon.contributionAmount],
|
||||
1);
|
||||
amount.hidden = false;
|
||||
} else {
|
||||
amount.hidden = true;
|
||||
}
|
||||
} else {
|
||||
contributions.hidden = true;
|
||||
}
|
||||
|
@ -76,6 +76,8 @@ function test() {
|
||||
creator: { name: "Mozilla", url: null },
|
||||
type: "extension",
|
||||
iconURL: "chrome://foo/skin/icon.png",
|
||||
contributionURL: "http://foo.com",
|
||||
contributionAmount: null,
|
||||
updateDate: gDate,
|
||||
permissions: 0,
|
||||
screenshots: [{url: "http://example.com/screenshot"}],
|
||||
@ -153,6 +155,7 @@ add_test(function() {
|
||||
is(get("detail-desc").textContent, "Longer description", "Description should be correct");
|
||||
|
||||
is_element_visible(get("detail-contributions"), "Contributions section should be visible");
|
||||
is_element_visible(get("detail-contrib-suggested"), "Contributions amount should be visible");
|
||||
ok(get("detail-contrib-suggested").value, "$0.99");
|
||||
|
||||
is_element_hidden(get("detail-dateUpdated"), "Update date should be hidden");
|
||||
@ -256,7 +259,8 @@ add_test(function() {
|
||||
is(get("detail-screenshot").src, "http://example.com/screenshot", "Should be showing the full sized screenshot");
|
||||
is(get("detail-desc").textContent, "Short description", "Description should be correct");
|
||||
|
||||
is_element_hidden(get("detail-contributions"), "Contributions section should be hidden");
|
||||
is_element_visible(get("detail-contributions"), "Contributions section should be visible");
|
||||
is_element_hidden(get("detail-contrib-suggested"), "Contributions amount should be hidden");
|
||||
|
||||
is_element_visible(get("detail-dateUpdated"), "Update date should not be hidden");
|
||||
is(Date.parse(get("detail-dateUpdated").value), gDate.getTime(), "Update date should be correct");
|
||||
|
@ -82,7 +82,6 @@
|
||||
<support>http://localhost:4444/support2.html</support>
|
||||
<contribution_data>
|
||||
<link>http://localhost:4444/contribution2.html</link>
|
||||
<suggested_amount currency="USD">$11.11</suggested_amount>
|
||||
<meet_developers>http://localhost:4444/meetDevelopers2.html</meet_developers>
|
||||
</contribution_data>
|
||||
<reviews num="NaN">http://localhost:4444/review2.html</reviews>
|
||||
|
@ -86,7 +86,6 @@
|
||||
<support>http://localhost:4444/repo/2/support.html</support>
|
||||
<contribution_data>
|
||||
<link>http://localhost:4444/repo/2/contribution.html</link>
|
||||
<suggested_amount currency="USD">$11.12</suggested_amount>
|
||||
<meet_developers>http://localhost:4444/repo/2/meetDevelopers.html</meet_developers>
|
||||
</contribution_data>
|
||||
<reviews num="1112">http://localhost:4444/repo/2/review.html</reviews>
|
||||
|
@ -124,7 +124,7 @@ var SEARCH_RESULTS = [{
|
||||
homepageURL: BASE_URL + "/learnmore2.html",
|
||||
supportURL: BASE_URL + "/support2.html",
|
||||
contributionURL: BASE_URL + "/meetDevelopers2.html",
|
||||
contributionAmount: "$11.11",
|
||||
contributionAmount: null,
|
||||
repositoryStatus: 4,
|
||||
sourceURI: BASE_URL + "/test2.xpi"
|
||||
}, {
|
||||
|
@ -123,7 +123,7 @@ const REPOSITORY_ADDONS = [{
|
||||
homepageURL: BASE_URL + "/repo/2/homepage.html",
|
||||
supportURL: BASE_URL + "/repo/2/support.html",
|
||||
contributionURL: BASE_URL + "/repo/2/meetDevelopers.html",
|
||||
contributionAmount: "$11.12",
|
||||
contributionAmount: null,
|
||||
averageRating: 2,
|
||||
reviewCount: 1112,
|
||||
reviewURL: BASE_URL + "/repo/2/review.html",
|
||||
@ -255,7 +255,7 @@ const WITH_CACHE = [{
|
||||
homepageURL: BASE_URL + "/repo/2/homepage.html",
|
||||
supportURL: BASE_URL + "/repo/2/support.html",
|
||||
contributionURL: BASE_URL + "/repo/2/meetDevelopers.html",
|
||||
contributionAmount: "$11.12",
|
||||
contributionAmount: null,
|
||||
averageRating: 2,
|
||||
reviewCount: 1112,
|
||||
reviewURL: BASE_URL + "/repo/2/review.html",
|
||||
|
Loading…
x
Reference in New Issue
Block a user