Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Commit

Permalink
fix(preferences): Use plain DOM instead of XBL appendItem (#4042)
Browse files Browse the repository at this point in the history
Followup to bug 1404890
  • Loading branch information
Mardak committed Mar 15, 2018
1 parent a69232d commit dc6b52e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion system-addon/lib/AboutPreferences.jsm
Expand Up @@ -204,9 +204,12 @@ this.AboutPreferences = class AboutPreferences {

// Add appropriate number of localized entries to the dropdown
const menulist = createAppend("menulist", detailHbox);
const menupopup = createAppend("menupopup", menulist);
for (let num = 1; num <= maxRows; num++) {
const plurals = formatString({id: "prefs_section_rows_option", values: {num}});
menulist.appendItem(PluralForm.get(num, plurals), num);
const item = createAppend("menuitem", menupopup);
item.setAttribute("label", PluralForm.get(num, plurals));
item.setAttribute("value", num);
}
linkPref(menulist, rowsPref, "int");
}
Expand Down
5 changes: 3 additions & 2 deletions system-addon/test/unit/lib/AboutPreferences.test.js
Expand Up @@ -133,7 +133,6 @@ describe("AboutPreferences Feed", () => {
beforeEach(() => {
node = {
appendChild: sandbox.stub().returnsArg(0),
appendItem: sandbox.stub(),
classList: {add: sandbox.stub()},
cloneNode: sandbox.stub().returnsThis(),
insertAdjacentElement: sandbox.stub().returnsArg(1),
Expand Down Expand Up @@ -238,7 +237,9 @@ describe("AboutPreferences Feed", () => {

testRender();

assert.calledThrice(node.appendItem);
assert.calledWith(node.setAttribute, "value", 1);
assert.calledWith(node.setAttribute, "value", 2);
assert.calledWith(node.setAttribute, "value", 3);
});
});
describe("nested prefs", () => {
Expand Down

0 comments on commit dc6b52e

Please sign in to comment.