зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset c3a651718270 (bug 1784138
) for causing python py3 failures. CLOSED TREE
This commit is contained in:
Родитель
1a4b224273
Коммит
4cbc2911be
|
@ -376,19 +376,34 @@ async function _addScriptsAndRender(container) {
|
|||
}
|
||||
|
||||
function _observeRender(container) {
|
||||
RENDER_OBSERVER?.observe(container, { childList: true });
|
||||
RENDER_OBSERVER.observe(container, { childList: true });
|
||||
}
|
||||
|
||||
async function _loadConfig(messageId) {
|
||||
let content = MESSAGES.find(m => m.id === messageId);
|
||||
const screenId = lazy.featureTourProgress.screen;
|
||||
let screenIndex;
|
||||
if (content?.screens && screenId) {
|
||||
// Update the message to reflect screens the user has seen
|
||||
screenIndex = content.screens.findIndex(s => s.id === screenId);
|
||||
content.startScreen = screenIndex;
|
||||
// If the parent element a screen describes doesn't exist, remove screen
|
||||
// and ensure last screen displays the final primary CTA
|
||||
// (for example, when there are no active colorways in about:firefoxview)
|
||||
// If a user has seen a screen, remove it
|
||||
function _getRelevantScreens(screens, index) {
|
||||
const finalCTA = screens[screens.length - 1].content.primary_button;
|
||||
screens = screens.filter((s, i) => {
|
||||
return i >= index && document.querySelector(s.parent_selector);
|
||||
});
|
||||
screens[screens.length - 1].content.primary_button = finalCTA;
|
||||
return screens;
|
||||
}
|
||||
CURRENT_SCREEN = content?.screens?.[screenIndex || 0];
|
||||
|
||||
let content = MESSAGES.find(m => m.id === messageId);
|
||||
if (!content?.screens) {
|
||||
return;
|
||||
}
|
||||
|
||||
const screenIndex = content.screens.findIndex(
|
||||
s => s.id === lazy.featureTourProgress.screen
|
||||
);
|
||||
content.screens = _getRelevantScreens(content.screens, screenIndex);
|
||||
|
||||
CURRENT_SCREEN = content?.screens[0];
|
||||
CONFIG = content;
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ const MultiStageAboutWelcome = props => {
|
|||
let {
|
||||
screens
|
||||
} = props;
|
||||
const [index, setScreenIndex] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(props.startScreen);
|
||||
const [index, setScreenIndex] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(0);
|
||||
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
||||
// Send impression ping when respective screen first renders
|
||||
screens.forEach((screen, order) => {
|
||||
|
@ -1742,7 +1742,6 @@ class AboutWelcome extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCom
|
|||
utm_term: props.UTMTerm,
|
||||
transitions: props.transitions,
|
||||
backdrop: props.backdrop,
|
||||
startScreen: props.startScreen || 0,
|
||||
appAndSystemLocaleInfo: props.appAndSystemLocaleInfo
|
||||
});
|
||||
}
|
||||
|
|
|
@ -44,11 +44,7 @@ input {
|
|||
background-color: transparent;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
.onboardingContainer.featureCallout .screen[pos=callout] .logo-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.onboardingContainer.featureCallout .screen[pos=callout] .logo-container .brand-logo {
|
||||
.onboardingContainer.featureCallout .screen[pos=callout] .brand-logo {
|
||||
margin: 30px 45px 0;
|
||||
}
|
||||
.onboardingContainer.featureCallout .screen[pos=callout] .welcome-text {
|
||||
|
|
|
@ -76,7 +76,6 @@ class AboutWelcome extends React.PureComponent {
|
|||
utm_term={props.UTMTerm}
|
||||
transitions={props.transitions}
|
||||
backdrop={props.backdrop}
|
||||
startScreen={props.startScreen || 0}
|
||||
appAndSystemLocaleInfo={props.appAndSystemLocaleInfo}
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -18,7 +18,7 @@ const TRANSITION_OUT_TIME = 1000;
|
|||
export const MultiStageAboutWelcome = props => {
|
||||
let { screens } = props;
|
||||
|
||||
const [index, setScreenIndex] = useState(props.startScreen);
|
||||
const [index, setScreenIndex] = useState(0);
|
||||
useEffect(() => {
|
||||
// Send impression ping when respective screen first renders
|
||||
screens.forEach((screen, order) => {
|
||||
|
|
|
@ -131,10 +131,6 @@
|
|||
"disableHistoryUpdates": {
|
||||
"type": "boolean",
|
||||
"description": "Don't alter the browser session's history stack - used with messaging surfaces like Feature Callouts"
|
||||
},
|
||||
"startScreen": {
|
||||
"type": "number",
|
||||
"description": "Index of first screen to show from message, defaulting to 0"
|
||||
}
|
||||
},
|
||||
"additionalProperties": true,
|
||||
|
|
|
@ -18,13 +18,8 @@ $max-z-index: 2147483647;
|
|||
background-color: transparent;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
|
||||
|
||||
.logo-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
.brand-logo {
|
||||
margin: 30px 45px 0;
|
||||
}
|
||||
.brand-logo {
|
||||
margin: 30px 45px 0;
|
||||
}
|
||||
|
||||
.welcome-text {
|
||||
|
|
|
@ -4,10 +4,6 @@ const { ExperimentFakes } = ChromeUtils.import(
|
|||
"resource://testing-common/NimbusTestUtils.jsm"
|
||||
);
|
||||
|
||||
const { AboutWelcomeTelemetry } = ChromeUtils.import(
|
||||
"resource://activity-stream/aboutwelcome/lib/AboutWelcomeTelemetry.jsm"
|
||||
);
|
||||
|
||||
const BASE_SCREEN_CONTENT = {
|
||||
title: "Step 1",
|
||||
primary_button: {
|
||||
|
@ -543,61 +539,3 @@ add_task(async function test_aboutwelcome_with_dark_mode_logo() {
|
|||
|
||||
await doExperimentCleanup();
|
||||
});
|
||||
|
||||
/**
|
||||
* Test rendering a message that starts on a specific screen
|
||||
*/
|
||||
add_task(async function test_aboutwelcome_start_screen_configured() {
|
||||
let startScreen = 1;
|
||||
let screens = [];
|
||||
// we need at least two screens to test
|
||||
for (let i = 1; i < 3; i++) {
|
||||
screens.push(makeTestContent(`TEST_START_STEP_${i}`));
|
||||
}
|
||||
let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
|
||||
featureId: "aboutwelcome",
|
||||
value: {
|
||||
enabled: true,
|
||||
startScreen,
|
||||
screens,
|
||||
},
|
||||
});
|
||||
|
||||
let sandbox = sinon.createSandbox();
|
||||
|
||||
let stub = sandbox.stub(AboutWelcomeTelemetry.prototype, "sendTelemetry");
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
let browser = await openAboutWelcome(JSON.stringify(screens));
|
||||
|
||||
let secondScreenShown = await SpecialPowers.spawn(browser, [], async () => {
|
||||
// Ensure screen has rendered
|
||||
await ContentTaskUtils.waitForCondition(() =>
|
||||
content.document.querySelector(".TEST_START_STEP_2")
|
||||
);
|
||||
return true;
|
||||
});
|
||||
|
||||
ok(
|
||||
secondScreenShown,
|
||||
`Starts on second screen when configured with startScreen index equal to ${startScreen}`
|
||||
);
|
||||
|
||||
Assert.equal(
|
||||
stub.secondCall.args[0].event,
|
||||
"IMPRESSION",
|
||||
"An impression event is sent with start screen configured"
|
||||
);
|
||||
|
||||
Assert.equal(
|
||||
stub.secondCall.args[0].message_id,
|
||||
`DEFAULT_ABOUTWELCOME_PROTON_${startScreen}_TEST_START_STEP_${startScreen +
|
||||
1}`,
|
||||
"Impression events have the correct message id with start screen configured"
|
||||
);
|
||||
|
||||
await doExperimentCleanup();
|
||||
});
|
||||
|
|
|
@ -20,7 +20,6 @@ describe("MultiStageAboutWelcome module", () => {
|
|||
metricsFlowUri: "http://localhost/",
|
||||
message_id: "DEFAULT_ABOUTWELCOME",
|
||||
utm_term: "default",
|
||||
startScreen: 0,
|
||||
};
|
||||
|
||||
beforeEach(async () => {
|
||||
|
@ -134,7 +133,6 @@ describe("MultiStageAboutWelcome module", () => {
|
|||
metricsFlowUri: "http://localhost/",
|
||||
message_id: "DEFAULT_ABOUTWELCOME",
|
||||
utm_term: "default",
|
||||
startScreen: 0,
|
||||
};
|
||||
const wrapper = mount(<MultiStageAboutWelcome {...AUTO_ADVANCE_PROPS} />);
|
||||
wrapper.update();
|
||||
|
@ -169,7 +167,6 @@ describe("MultiStageAboutWelcome module", () => {
|
|||
messageId: `${DEFAULT_PROPS.message_id}_${startScreen.id}`,
|
||||
UTMTerm: DEFAULT_PROPS.utm_term,
|
||||
flowParams: null,
|
||||
startScreen: 0,
|
||||
};
|
||||
|
||||
it("should render GetStarted Screen", () => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче