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

Commit

Permalink
Merge pull request #1114 from erikvold/768388v2
Browse files Browse the repository at this point in the history
Bug 768388: support hidden pref type r=@Gozala
  • Loading branch information
erikvold committed Jul 17, 2013
2 parents 90cd0e2 + cb5d206 commit 2a40cf4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions python-lib/cuddlefish/options_xul.py
Expand Up @@ -52,6 +52,9 @@ def parse_options(options, jetpack_id):
doc.appendChild(root)

for pref in options:
if ("hidden" in pref and pref["hidden"] == True):
continue;

setting = doc.createElement("setting")
setting.setAttribute("pref-name", pref["name"])
setting.setAttribute("data-jetpack-id", jetpack_id)
Expand Down
10 changes: 9 additions & 1 deletion test/addons/simple-prefs/lib/main.js
Expand Up @@ -12,6 +12,7 @@ const tabs = require('sdk/tabs');
const { AddonManager } = Cu.import('resource://gre/modules/AddonManager.jsm', {});

exports.testDefaultValues = function (assert) {
assert.equal(sp.prefs.myHiddenInt, 5, 'myHiddenInt default is 5');
assert.equal(sp.prefs.myInteger, 8, 'myInteger default is 8');
assert.equal(sp.prefs.somePreference, 'TEST', 'somePreference default is correct');
}
Expand All @@ -35,7 +36,8 @@ if (app.is('Firefox')) {
'setTimeout(function() {\n' + // TODO: figure out why this is necessary..
'self.postMessage({\n' +
'somePreference: getAttributes(unsafeWindow.document.querySelector("setting[title=\'some-title\']")),\n' +
'myInteger: getAttributes(unsafeWindow.document.querySelector("setting[title=\'my-int\']"))\n' +
'myInteger: getAttributes(unsafeWindow.document.querySelector("setting[title=\'my-int\']")),\n' +
'myHiddenInt: getAttributes(unsafeWindow.document.querySelector("setting[title=\'hidden-int\']"))\n' +
'});\n' +
'}, 250);\n' +
'}, false);\n' +
Expand Down Expand Up @@ -63,6 +65,12 @@ if (app.is('Firefox')) {
assert.equal(msg.myInteger.title, 'my-int', 'myInteger title is correct');
assert.equal(msg.myInteger.desc, 'How many of them we have.', 'myInteger desc is correct');

// test myHiddenInt
assert.equal(msg.myHiddenInt.type, undefined, 'myHiddenInt was not displayed');
assert.equal(msg.myHiddenInt.pref, undefined, 'myHiddenInt was not displayed');
assert.equal(msg.myHiddenInt.title, undefined, 'myHiddenInt was not displayed');
assert.equal(msg.myHiddenInt.desc, undefined, 'myHiddenInt was not displayed');

tab.close(done);
}
});
Expand Down
6 changes: 6 additions & 0 deletions test/addons/simple-prefs/package.json
Expand Up @@ -13,5 +13,11 @@
"type": "integer",
"value": 8,
"title": "my-int"
}, {
"name": "myHiddenInt",
"type": "integer",
"hidden": true,
"value": 5,
"title": "hidden-int"
}]
}

0 comments on commit 2a40cf4

Please sign in to comment.