зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1315794 - migrate aboutdebugging to React 15.3.2;r=linclark
Use ReactDOM.render instead of React.render (same for unmountComponentAtNode) Update tests to observe both childList and characterData mutations when expecting only text changes. MozReview-Commit-ID: ILTgypkpZRz --HG-- extra : rebase_source : 0f6ac42b6828428d2606d9f52fcbf176bab949d3
This commit is contained in:
Родитель
25ccec6cf2
Коммит
88fe750648
|
@ -24,8 +24,8 @@ const { require } = BrowserLoader({
|
|||
window
|
||||
});
|
||||
|
||||
const { createFactory, render, unmountComponentAtNode } =
|
||||
require("devtools/client/shared/vendor/react");
|
||||
const { createFactory } = require("devtools/client/shared/vendor/react");
|
||||
const { render, unmountComponentAtNode } = require("devtools/client/shared/vendor/react-dom");
|
||||
|
||||
const AboutDebuggingApp = createFactory(require("./components/aboutdebugging"));
|
||||
|
||||
|
|
|
@ -170,8 +170,8 @@ add_task(function* reloadButtonRefreshesMetadata() {
|
|||
|
||||
// Wait for the add-on list to be updated with the reloaded name.
|
||||
const onReInstall = promiseAddonEvent("onInstalled");
|
||||
const onAddonReloaded = waitForMutation(getAddonList(document),
|
||||
{ childList: true, subtree: true });
|
||||
const onAddonReloaded = waitForContentMutation(getAddonList(document));
|
||||
|
||||
const reloadButton = getReloadButton(document, manifestBase.name);
|
||||
reloadButton.click();
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ add_task(function* () {
|
|||
// Then wait for title update, but on slow test runner, the title may already
|
||||
// be set to the expected value
|
||||
if (newTabTarget.textContent != "foo") {
|
||||
yield waitForMutation(newTabTarget, { childList: true });
|
||||
yield waitForContentMutation(newTabTarget);
|
||||
}
|
||||
|
||||
// Check that the new tab appears in the UI
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/* eslint-env browser */
|
||||
/* exported openAboutDebugging, changeAboutDebuggingHash, closeAboutDebugging,
|
||||
installAddon, uninstallAddon, waitForMutation, assertHasTarget,
|
||||
installAddon, uninstallAddon, waitForMutation, waitForContentMutation, assertHasTarget,
|
||||
getServiceWorkerList, getTabList, openPanel, waitForInitialAddonList,
|
||||
waitForServiceWorkerRegistered, unregisterServiceWorker,
|
||||
waitForDelayedStartupFinished, setupTestAboutDebuggingWebExtension,
|
||||
|
@ -229,6 +229,22 @@ function waitForMutation(target, mutationOptions) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise that will resolve after receiving a mutation in the subtree of the
|
||||
* provided target. Depending on the current React implementation, a text change might be
|
||||
* observable as a childList mutation or a characterData mutation.
|
||||
*
|
||||
* @param {Node} target
|
||||
* @return {Promise}
|
||||
*/
|
||||
function waitForContentMutation(target) {
|
||||
return waitForMutation(target, {
|
||||
characterData: true,
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an about:debugging TargetList element contains a Target element
|
||||
* corresponding to the specified name.
|
||||
|
|
Загрузка…
Ссылка в новой задаче