зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1244265 - Show file picker when save button clicked within the JSONView component. r=Honza
MozReview-Commit-ID: 70q35AbSBgO --HG-- extra : amend_source : a749a55a82bb220016ca682f594e65b0d372566f extra : transplant_source : 6%D2%200%82%2CtN%F6%9E4%7B%91%16%0A%DFa%21%FEs
This commit is contained in:
Родитель
f387cfc0da
Коммит
2c4851f151
|
@ -12,7 +12,7 @@ const Services = require("Services");
|
||||||
|
|
||||||
const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
|
const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "JsonViewService", function () {
|
XPCOMUtils.defineLazyGetter(this, "JsonViewUtils", function() {
|
||||||
return require("devtools/client/jsonview/utils");
|
return require("devtools/client/jsonview/utils");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -22,3 +22,4 @@ support-files =
|
||||||
[browser_jsonview_filter.js]
|
[browser_jsonview_filter.js]
|
||||||
[browser_jsonview_invalid_json.js]
|
[browser_jsonview_invalid_json.js]
|
||||||
[browser_jsonview_valid_json.js]
|
[browser_jsonview_valid_json.js]
|
||||||
|
[browser_jsonview_save_json.js]
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||||
|
/* vim: set ts=2 et sw=2 tw=80: */
|
||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const TEST_JSON_URL = URL_ROOT + "valid_json.json";
|
||||||
|
|
||||||
|
let { MockFilePicker } = SpecialPowers;
|
||||||
|
|
||||||
|
MockFilePicker.init(window);
|
||||||
|
MockFilePicker.returnValue = MockFilePicker.returnCancel;
|
||||||
|
|
||||||
|
registerCleanupFunction(function() {
|
||||||
|
MockFilePicker.cleanup();
|
||||||
|
});
|
||||||
|
|
||||||
|
add_task(function* () {
|
||||||
|
info("Test save JSON started");
|
||||||
|
|
||||||
|
yield addJsonViewTab(TEST_JSON_URL);
|
||||||
|
|
||||||
|
let promise = new Promise((resolve) => {
|
||||||
|
MockFilePicker.showCallback = () => {
|
||||||
|
MockFilePicker.showCallback = null;
|
||||||
|
ok(true, "File picker was opened");
|
||||||
|
resolve();
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
let browser = gBrowser.selectedBrowser;
|
||||||
|
yield BrowserTestUtils.synthesizeMouseAtCenter(
|
||||||
|
".jsonPanelBox button.save",
|
||||||
|
{}, browser);
|
||||||
|
|
||||||
|
yield promise;
|
||||||
|
});
|
Загрузка…
Ссылка в новой задаче