mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 491638 - Clear recent history dialog should persist details expansion, r=johnath
This commit is contained in:
parent
215e46a212
commit
77de5bc58b
@ -169,13 +169,14 @@
|
||||
<button type="image"
|
||||
id="detailsExpander"
|
||||
class="expander-down"
|
||||
persist="class"
|
||||
oncommand="gSanitizePromptDialog.toggleItemList();"/>
|
||||
<label id="detailsExpanderLabel"
|
||||
value="&detailsProgressiveDisclosure.label;"
|
||||
accesskey="&detailsProgressiveDisclosure.accesskey;"
|
||||
control="detailsExpander"/>
|
||||
</hbox>
|
||||
<listbox id="itemList" rows="4" collapsed="true">
|
||||
<listbox id="itemList" rows="4" collapsed="true" persist="collapsed">
|
||||
<listitem label="&itemHistoryAndDownloads.label;"
|
||||
type="checkbox"
|
||||
accesskey="&itemHistoryAndDownloads.accesskey;"
|
||||
|
@ -255,14 +255,14 @@ var gSanitizePromptDialog = {
|
||||
// Showing item list
|
||||
if (itemList.collapsed) {
|
||||
expanderButton.className = "expander-up";
|
||||
itemList.collapsed = false;
|
||||
itemList.setAttribute("collapsed", "false");
|
||||
window.resizeBy(0, itemList.boxObject.height);
|
||||
}
|
||||
// Hiding item list
|
||||
else {
|
||||
expanderButton.className = "expander-down";
|
||||
window.resizeBy(0, -itemList.boxObject.height);
|
||||
itemList.collapsed = true;
|
||||
itemList.setAttribute("collapsed", "true");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,9 +85,15 @@ var gAllTests = [
|
||||
wh.onload = function () {
|
||||
this.selectDuration(Sanitizer.TIMESPAN_HOUR);
|
||||
this.checkPrefCheckbox("history", false);
|
||||
this.checkDetails();
|
||||
this.checkDetails(false);
|
||||
|
||||
// Show details
|
||||
this.toggleDetails();
|
||||
this.checkDetails();
|
||||
this.checkDetails(true);
|
||||
|
||||
// Hide details
|
||||
this.toggleDetails();
|
||||
this.checkDetails(false);
|
||||
this.cancelDialog();
|
||||
|
||||
ensureHistoryClearedState(uris, false);
|
||||
@ -226,9 +232,16 @@ var gAllTests = [
|
||||
"with a predefined timespan");
|
||||
this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
|
||||
this.checkPrefCheckbox("history", true);
|
||||
this.checkDetails();
|
||||
this.checkDetails(false);
|
||||
|
||||
// Show details
|
||||
this.toggleDetails();
|
||||
this.checkDetails();
|
||||
this.checkDetails(true);
|
||||
|
||||
// Hide details
|
||||
this.toggleDetails();
|
||||
this.checkDetails(false);
|
||||
|
||||
this.acceptDialog();
|
||||
|
||||
intPrefIs("sanitize.timeSpan", Sanitizer.TIMESPAN_EVERYTHING,
|
||||
@ -266,6 +279,32 @@ var gAllTests = [
|
||||
ensureHistoryClearedState(uris, true);
|
||||
};
|
||||
wh.open();
|
||||
},
|
||||
|
||||
/**
|
||||
* Ensures that toggling details persists across dialog openings.
|
||||
*/
|
||||
function () {
|
||||
let wh = new WindowHelper();
|
||||
|
||||
wh.onload = function () {
|
||||
// Show details
|
||||
this.toggleDetails();
|
||||
this.checkDetails(true);
|
||||
this.cancelDialog();
|
||||
};
|
||||
wh.open();
|
||||
|
||||
wh.onload = function () {
|
||||
// Details should have remained open
|
||||
this.checkDetails(true);
|
||||
|
||||
// Hide details
|
||||
this.toggleDetails();
|
||||
this.checkDetails(false);
|
||||
this.cancelDialog();
|
||||
};
|
||||
wh.open();
|
||||
}
|
||||
];
|
||||
|
||||
@ -313,11 +352,17 @@ WindowHelper.prototype = {
|
||||
* Ensures that the details progressive disclosure button and the item list
|
||||
* hidden by it match up. Also makes sure the height of the dialog is
|
||||
* sufficient for the item list and warning panel.
|
||||
*
|
||||
* @param aShouldBeShown
|
||||
* True if you expect the details to be shown and false if hidden
|
||||
*/
|
||||
checkDetails: function () {
|
||||
checkDetails: function (aShouldBeShown) {
|
||||
let button = this.getDetailsButton();
|
||||
let list = this.getItemList();
|
||||
let hidden = list.hidden || list.collapsed;
|
||||
is(hidden, !aShouldBeShown,
|
||||
"Details should be " + (aShouldBeShown ? "shown" : "hidden") +
|
||||
" but were actually " + (hidden ? "hidden" : "shown"));
|
||||
let dir = hidden ? "down" : "up";
|
||||
is(button.className, "expander-" + dir,
|
||||
"Details button should be " + dir + " because item list is " +
|
||||
|
Loading…
Reference in New Issue
Block a user