Backed out 8 changesets (bug 1917532, bug 1575506, bug 1917530) for causing node newtab failures CLOSED TREE
Backed out changeset 8d6f7bc74d08 (bug 1917532) Backed out changeset 7c963e72cf06 (bug 1575506) Backed out changeset d5e110187781 (bug 1917530) Backed out changeset 1d2325ffded6 (bug 1917530) Backed out changeset 8a361e37e32c (bug 1917530) Backed out changeset c4011d92c7f7 (bug 1917530) Backed out changeset 1a45047dfb3c (bug 1917530) Backed out changeset ed6b35444c45 (bug 1917530)
This commit is contained in:
@@ -141,6 +141,7 @@ module.exports = {
|
||||
"no-prototype-builtins": "error",
|
||||
"no-return-assign": ["error", "except-parens"],
|
||||
"no-script-url": "error",
|
||||
"no-shadow": "error",
|
||||
"no-template-curly-in-string": "error",
|
||||
"no-undef-init": "error",
|
||||
"no-unmodified-loop-condition": "error",
|
||||
|
||||
@@ -243,22 +243,22 @@ export class BaseContent extends React.PureComponent {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { name: authorDetails, webpage } = selected.attribution;
|
||||
if (activeWallpaper && wallpaperList && authorDetails.url) {
|
||||
const { name, webpage } = selected.attribution;
|
||||
if (activeWallpaper && wallpaperList && name.url) {
|
||||
return (
|
||||
<p
|
||||
className={`wallpaper-attribution`}
|
||||
key={authorDetails.string}
|
||||
key={name.string}
|
||||
data-l10n-id="newtab-wallpaper-attribution"
|
||||
data-l10n-args={JSON.stringify({
|
||||
author_string: authorDetails.string,
|
||||
author_url: authorDetails.url,
|
||||
author_string: name.string,
|
||||
author_url: name.url,
|
||||
webpage_string: webpage.string,
|
||||
webpage_url: webpage.url,
|
||||
})}
|
||||
>
|
||||
<a data-l10n-name="name-link" href={authorDetails.url}>
|
||||
{authorDetails.string}
|
||||
<a data-l10n-name="name-link" href={name.url}>
|
||||
{name.string}
|
||||
</a>
|
||||
<a data-l10n-name="webpage-link" href={webpage.url}>
|
||||
{webpage.string}
|
||||
|
||||
@@ -95,16 +95,16 @@ export class _ContextMenuItem extends React.PureComponent {
|
||||
|
||||
// This selects the correct node based on the key pressed
|
||||
focusSibling(target, key) {
|
||||
const { parentNode } = target;
|
||||
const parent = target.parentNode;
|
||||
const closestSiblingSelector =
|
||||
key === "ArrowUp" ? "previousSibling" : "nextSibling";
|
||||
if (!parentNode[closestSiblingSelector]) {
|
||||
if (!parent[closestSiblingSelector]) {
|
||||
return;
|
||||
}
|
||||
if (parentNode[closestSiblingSelector].firstElementChild) {
|
||||
parentNode[closestSiblingSelector].firstElementChild.focus();
|
||||
if (parent[closestSiblingSelector].firstElementChild) {
|
||||
parent[closestSiblingSelector].firstElementChild.focus();
|
||||
} else {
|
||||
parentNode[closestSiblingSelector][
|
||||
parent[closestSiblingSelector][
|
||||
closestSiblingSelector
|
||||
].firstElementChild.focus();
|
||||
}
|
||||
|
||||
@@ -18,12 +18,12 @@ export class ContentSection extends React.PureComponent {
|
||||
this.pocketDrawerRef = React.createRef();
|
||||
}
|
||||
|
||||
inputUserEvent(eventSource, eventValue) {
|
||||
inputUserEvent(eventSource, status) {
|
||||
this.props.dispatch(
|
||||
ac.UserEvent({
|
||||
event: "PREF_CHANGED",
|
||||
source: eventSource,
|
||||
value: { status: eventValue, menu_source: "CUSTOMIZE_MENU" },
|
||||
value: { status, menu_source: "CUSTOMIZE_MENU" },
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import { ContentSection } from "content-src/components/CustomizeMenu/ContentSection/ContentSection";
|
||||
import { connect } from "react-redux";
|
||||
import React from "react";
|
||||
// eslint-disable-next-line no-shadow
|
||||
import { CSSTransition } from "react-transition-group";
|
||||
|
||||
export class _CustomizeMenu extends React.PureComponent {
|
||||
|
||||
@@ -137,11 +137,11 @@ export class DiscoveryStreamAdminUI extends React.PureComponent {
|
||||
};
|
||||
}
|
||||
|
||||
setConfigValue(configName, configValue) {
|
||||
setConfigValue(name, value) {
|
||||
this.props.dispatch(
|
||||
ac.OnlyToMain({
|
||||
type: at.DISCOVERY_STREAM_CONFIG_SET_VALUE,
|
||||
data: { name: configName, value: configValue },
|
||||
data: { name, value },
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -149,7 +149,6 @@ export function OnboardingExperience({ dispatch, windowObj = globalThis }) {
|
||||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
export function IntersectionObserver({
|
||||
children,
|
||||
windowObj = window,
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
import { cardContextTypes } from "../../Card/types.mjs";
|
||||
import { SponsoredContentHighlight } from "../FeatureHighlight/SponsoredContentHighlight";
|
||||
// eslint-disable-next-line no-shadow
|
||||
import { CSSTransition, TransitionGroup } from "react-transition-group";
|
||||
import { FluentOrText } from "../../FluentOrText/FluentOrText.jsx";
|
||||
import React from "react";
|
||||
|
||||
@@ -30,14 +30,14 @@ export class Topic extends React.PureComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { url, name: topicName } = this.props;
|
||||
const { url, name } = this.props;
|
||||
return (
|
||||
<SafeAnchor
|
||||
onLinkClick={this.onLinkClick}
|
||||
className={this.props.className}
|
||||
url={url}
|
||||
>
|
||||
{topicName}
|
||||
{name}
|
||||
</SafeAnchor>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import React, { useEffect, useCallback, useRef } from "react";
|
||||
|
||||
function ModalOverlayWrapper({
|
||||
// eslint-disable-next-line no-shadow
|
||||
document = globalThis.document,
|
||||
unstyled,
|
||||
innerClassName,
|
||||
|
||||
@@ -68,10 +68,10 @@ export class SearchShortcutsForm extends React.PureComponent {
|
||||
|
||||
handleChange(event) {
|
||||
const { target } = event;
|
||||
const { name: targetName, checked } = target;
|
||||
const { name, checked } = target;
|
||||
this.setState(prevState => {
|
||||
const shortcuts = prevState.shortcuts.slice();
|
||||
let shortcut = shortcuts.find(({ keyword }) => keyword === targetName);
|
||||
let shortcut = shortcuts.find(({ keyword }) => keyword === name);
|
||||
shortcut.isSelected = checked;
|
||||
return { shortcuts };
|
||||
});
|
||||
|
||||
@@ -6,11 +6,11 @@ import React from "react";
|
||||
|
||||
export class Topic extends React.PureComponent {
|
||||
render() {
|
||||
const { url, name: topicName } = this.props;
|
||||
const { url, name } = this.props;
|
||||
return (
|
||||
<li>
|
||||
<a key={topicName} href={url}>
|
||||
{topicName}
|
||||
<a key={name} href={url}>
|
||||
{name}
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { actionCreators as ac, actionTypes as at } from "common/Actions.mjs";
|
||||
// eslint-disable-next-line no-shadow
|
||||
import { CSSTransition } from "react-transition-group";
|
||||
|
||||
export class _WallpaperCategories extends React.PureComponent {
|
||||
|
||||
@@ -108,10 +108,10 @@ function LocationSearch({ outerClassName }) {
|
||||
/>
|
||||
<button className="close-icon" onClick={handleCloseSearch} />
|
||||
<datalist id="merino-location-list">
|
||||
{(suggestedLocations || []).map(merinoLcation => (
|
||||
<option value={merinoLcation.key} key={merinoLcation.key}>
|
||||
{merinoLcation.localized_name},{" "}
|
||||
{merinoLcation.administrative_area.localized_name}
|
||||
{(suggestedLocations || []).map(location => (
|
||||
<option value={location.key} key={location.key}>
|
||||
{location.localized_name},{" "}
|
||||
{location.administrative_area.localized_name}
|
||||
</option>
|
||||
))}
|
||||
</datalist>
|
||||
|
||||
@@ -694,12 +694,12 @@ class DiscoveryStreamAdminUI extends (external_React_default()).PureComponent {
|
||||
weatherQuery: ""
|
||||
};
|
||||
}
|
||||
setConfigValue(configName, configValue) {
|
||||
setConfigValue(name, value) {
|
||||
this.props.dispatch(actionCreators.OnlyToMain({
|
||||
type: actionTypes.DISCOVERY_STREAM_CONFIG_SET_VALUE,
|
||||
data: {
|
||||
name: configName,
|
||||
value: configValue
|
||||
name,
|
||||
value
|
||||
}
|
||||
}));
|
||||
}
|
||||
@@ -1401,17 +1401,15 @@ class _ContextMenuItem extends (external_React_default()).PureComponent {
|
||||
|
||||
// This selects the correct node based on the key pressed
|
||||
focusSibling(target, key) {
|
||||
const {
|
||||
parentNode
|
||||
} = target;
|
||||
const parent = target.parentNode;
|
||||
const closestSiblingSelector = key === "ArrowUp" ? "previousSibling" : "nextSibling";
|
||||
if (!parentNode[closestSiblingSelector]) {
|
||||
if (!parent[closestSiblingSelector]) {
|
||||
return;
|
||||
}
|
||||
if (parentNode[closestSiblingSelector].firstElementChild) {
|
||||
parentNode[closestSiblingSelector].firstElementChild.focus();
|
||||
if (parent[closestSiblingSelector].firstElementChild) {
|
||||
parent[closestSiblingSelector].firstElementChild.focus();
|
||||
} else {
|
||||
parentNode[closestSiblingSelector][closestSiblingSelector].firstElementChild.focus();
|
||||
parent[closestSiblingSelector][closestSiblingSelector].firstElementChild.focus();
|
||||
}
|
||||
}
|
||||
onKeyDown(event) {
|
||||
@@ -2595,7 +2593,6 @@ class FluentOrText extends (external_React_default()).PureComponent {
|
||||
|
||||
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
|
||||
|
||||
|
||||
@@ -3766,8 +3763,6 @@ function OnboardingExperience({
|
||||
className: "ds-onboarding-graphic"
|
||||
})))));
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
function CardGrid_IntersectionObserver({
|
||||
children,
|
||||
windowObj = window,
|
||||
@@ -4527,7 +4522,6 @@ class DSMessage extends (external_React_default()).PureComponent {
|
||||
|
||||
|
||||
function ModalOverlayWrapper({
|
||||
// eslint-disable-next-line no-shadow
|
||||
document = globalThis.document,
|
||||
unstyled,
|
||||
innerClassName,
|
||||
@@ -5609,12 +5603,12 @@ class Topic extends (external_React_default()).PureComponent {
|
||||
render() {
|
||||
const {
|
||||
url,
|
||||
name: topicName
|
||||
name
|
||||
} = this.props;
|
||||
return /*#__PURE__*/external_React_default().createElement("li", null, /*#__PURE__*/external_React_default().createElement("a", {
|
||||
key: topicName,
|
||||
key: name,
|
||||
href: url
|
||||
}, topicName));
|
||||
}, name));
|
||||
}
|
||||
}
|
||||
class Topics extends (external_React_default()).PureComponent {
|
||||
@@ -5705,14 +5699,14 @@ class SearchShortcutsForm extends (external_React_default()).PureComponent {
|
||||
target
|
||||
} = event;
|
||||
const {
|
||||
name: targetName,
|
||||
name,
|
||||
checked
|
||||
} = target;
|
||||
this.setState(prevState => {
|
||||
const shortcuts = prevState.shortcuts.slice();
|
||||
let shortcut = shortcuts.find(({
|
||||
keyword
|
||||
}) => keyword === targetName);
|
||||
}) => keyword === name);
|
||||
shortcut.isSelected = checked;
|
||||
return {
|
||||
shortcuts
|
||||
@@ -8664,13 +8658,13 @@ class Navigation_Topic extends (external_React_default()).PureComponent {
|
||||
render() {
|
||||
const {
|
||||
url,
|
||||
name: topicName
|
||||
name
|
||||
} = this.props;
|
||||
return /*#__PURE__*/external_React_default().createElement(SafeAnchor, {
|
||||
onLinkClick: this.onLinkClick,
|
||||
className: this.props.className,
|
||||
url: url
|
||||
}, topicName);
|
||||
}, name);
|
||||
}
|
||||
}
|
||||
class Navigation extends (external_React_default()).PureComponent {
|
||||
@@ -9482,7 +9476,6 @@ const WallpapersSection = (0,external_ReactRedux_namespaceObject.connect)(state
|
||||
|
||||
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
|
||||
class _WallpaperCategories extends (external_React_default()).PureComponent {
|
||||
constructor(props) {
|
||||
@@ -9686,12 +9679,12 @@ class ContentSection extends (external_React_default()).PureComponent {
|
||||
this.topSitesDrawerRef = /*#__PURE__*/external_React_default().createRef();
|
||||
this.pocketDrawerRef = /*#__PURE__*/external_React_default().createRef();
|
||||
}
|
||||
inputUserEvent(eventSource, eventValue) {
|
||||
inputUserEvent(eventSource, status) {
|
||||
this.props.dispatch(actionCreators.UserEvent({
|
||||
event: "PREF_CHANGED",
|
||||
source: eventSource,
|
||||
value: {
|
||||
status: eventValue,
|
||||
status,
|
||||
menu_source: "CUSTOMIZE_MENU"
|
||||
}
|
||||
}));
|
||||
@@ -9944,7 +9937,6 @@ class ContentSection extends (external_React_default()).PureComponent {
|
||||
|
||||
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
|
||||
class _CustomizeMenu extends (external_React_default()).PureComponent {
|
||||
constructor(props) {
|
||||
@@ -10325,10 +10317,10 @@ function LocationSearch({
|
||||
onClick: handleCloseSearch
|
||||
}), /*#__PURE__*/external_React_default().createElement("datalist", {
|
||||
id: "merino-location-list"
|
||||
}, (suggestedLocations || []).map(merinoLcation => /*#__PURE__*/external_React_default().createElement("option", {
|
||||
value: merinoLcation.key,
|
||||
key: merinoLcation.key
|
||||
}, merinoLcation.localized_name, ",", " ", merinoLcation.administrative_area.localized_name)))));
|
||||
}, (suggestedLocations || []).map(location => /*#__PURE__*/external_React_default().createElement("option", {
|
||||
value: location.key,
|
||||
key: location.key
|
||||
}, location.localized_name, ",", " ", location.administrative_area.localized_name)))));
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ./content-src/components/Weather/Weather.jsx
|
||||
@@ -11277,24 +11269,24 @@ class BaseContent extends (external_React_default()).PureComponent {
|
||||
return null;
|
||||
}
|
||||
const {
|
||||
name: authorDetails,
|
||||
name,
|
||||
webpage
|
||||
} = selected.attribution;
|
||||
if (activeWallpaper && wallpaperList && authorDetails.url) {
|
||||
if (activeWallpaper && wallpaperList && name.url) {
|
||||
return /*#__PURE__*/external_React_default().createElement("p", {
|
||||
className: `wallpaper-attribution`,
|
||||
key: authorDetails.string,
|
||||
key: name.string,
|
||||
"data-l10n-id": "newtab-wallpaper-attribution",
|
||||
"data-l10n-args": JSON.stringify({
|
||||
author_string: authorDetails.string,
|
||||
author_url: authorDetails.url,
|
||||
author_string: name.string,
|
||||
author_url: name.url,
|
||||
webpage_string: webpage.string,
|
||||
webpage_url: webpage.url
|
||||
})
|
||||
}, /*#__PURE__*/external_React_default().createElement("a", {
|
||||
"data-l10n-name": "name-link",
|
||||
href: authorDetails.url
|
||||
}, authorDetails.string), /*#__PURE__*/external_React_default().createElement("a", {
|
||||
href: name.url
|
||||
}, name.string), /*#__PURE__*/external_React_default().createElement("a", {
|
||||
"data-l10n-name": "webpage-link",
|
||||
href: webpage.url
|
||||
}, webpage.string));
|
||||
|
||||
@@ -85,13 +85,13 @@ let Agent = {
|
||||
|
||||
this._templates = {};
|
||||
|
||||
for (let [templateName, path] of templateResources) {
|
||||
for (let [name, path] of templateResources) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
// Using a synchronous XHR in a worker is fine.
|
||||
xhr.open("GET", path, false);
|
||||
xhr.responseType = "text";
|
||||
xhr.send(null);
|
||||
this._templates[templateName] = xhr.responseText;
|
||||
this._templates[name] = xhr.responseText;
|
||||
}
|
||||
|
||||
return this._templates;
|
||||
|
||||
@@ -94,7 +94,6 @@ describe("<Card>", () => {
|
||||
wrapper
|
||||
.find(".context-menu-button")
|
||||
.simulate("click", { preventDefault: () => {} });
|
||||
// eslint-disable-next-line no-shadow
|
||||
const { dispatch, source, onUpdate, site, options, index } = wrapper
|
||||
.find(LinkMenu)
|
||||
.props();
|
||||
@@ -113,17 +112,16 @@ describe("<Card>", () => {
|
||||
wrapper
|
||||
.find(".context-menu-button")
|
||||
.simulate("click", { preventDefault: () => {} });
|
||||
// eslint-disable-next-line no-shadow
|
||||
const { options } = wrapper.find(LinkMenu).props();
|
||||
assert.equal(options, link.contextMenuOptions);
|
||||
});
|
||||
it("should have a context based on type", () => {
|
||||
wrapper = shallow(<Card {...DEFAULT_PROPS} />);
|
||||
const cardContext = wrapper.find(".card-context");
|
||||
const context = wrapper.find(".card-context");
|
||||
const { icon, fluentID } = cardContextTypes[DEFAULT_PROPS.link.type];
|
||||
assert.isTrue(cardContext.childAt(0).hasClass(`icon-${icon}`));
|
||||
assert.isTrue(cardContext.childAt(1).hasClass("card-context-label"));
|
||||
assert.equal(cardContext.childAt(1).prop("data-l10n-id"), fluentID);
|
||||
assert.isTrue(context.childAt(0).hasClass(`icon-${icon}`));
|
||||
assert.isTrue(context.childAt(1).hasClass("card-context-label"));
|
||||
assert.equal(context.childAt(1).prop("data-l10n-id"), fluentID);
|
||||
});
|
||||
it("should support setting custom context", () => {
|
||||
const linkWithCustomContext = {
|
||||
@@ -137,16 +135,16 @@ describe("<Card>", () => {
|
||||
{...Object.assign({}, DEFAULT_PROPS, { link: linkWithCustomContext })}
|
||||
/>
|
||||
);
|
||||
const cardContext = wrapper.find(".card-context");
|
||||
const context = wrapper.find(".card-context");
|
||||
const { icon } = cardContextTypes[DEFAULT_PROPS.link.type];
|
||||
assert.isFalse(cardContext.childAt(0).hasClass(`icon-${icon}`));
|
||||
assert.isFalse(context.childAt(0).hasClass(`icon-${icon}`));
|
||||
assert.equal(
|
||||
cardContext.childAt(0).props().style.backgroundImage,
|
||||
context.childAt(0).props().style.backgroundImage,
|
||||
"url('icon-url')"
|
||||
);
|
||||
|
||||
assert.isTrue(cardContext.childAt(1).hasClass("card-context-label"));
|
||||
assert.equal(cardContext.childAt(1).text(), linkWithCustomContext.context);
|
||||
assert.isTrue(context.childAt(1).hasClass("card-context-label"));
|
||||
assert.equal(context.childAt(1).text(), linkWithCustomContext.context);
|
||||
});
|
||||
it("should parse args for fluent correctly", () => {
|
||||
const title = '"fluent"';
|
||||
|
||||
@@ -22,14 +22,14 @@ const DEFAULT_PROPS = {
|
||||
describe("CollapsibleSection", () => {
|
||||
let wrapper;
|
||||
|
||||
function testSetup(props = {}) {
|
||||
function setup(props = {}) {
|
||||
const customProps = Object.assign({}, DEFAULT_PROPS, props);
|
||||
wrapper = mount(
|
||||
<CollapsibleSection {...customProps}>foo</CollapsibleSection>
|
||||
);
|
||||
}
|
||||
|
||||
beforeEach(() => testSetup());
|
||||
beforeEach(() => setup());
|
||||
|
||||
it("should render the component", () => {
|
||||
assert.ok(wrapper.exists());
|
||||
@@ -46,7 +46,7 @@ describe("CollapsibleSection", () => {
|
||||
let dispatch;
|
||||
beforeEach(() => {
|
||||
dispatch = sinon.stub();
|
||||
testSetup({ collapsed: undefined, dispatch });
|
||||
setup({ collapsed: undefined, dispatch });
|
||||
});
|
||||
it("should render the section uncollapsed", () => {
|
||||
assert.isFalse(
|
||||
|
||||
@@ -28,7 +28,6 @@ const FakeMenu = props => {
|
||||
};
|
||||
|
||||
describe("<ContextMenuButton>", () => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
function mountWithProps(options) {
|
||||
const store = createStore(combineReducers(reducers), INITIAL_STATE);
|
||||
return mount(
|
||||
@@ -90,7 +89,6 @@ describe("<ContextMenuButton>", () => {
|
||||
assert.equal(wrapper.find(ContextMenu).prop("keyboardAccess"), true);
|
||||
});
|
||||
it("should call focusFirst when keyboardAccess is true", () => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
const options = [{ label: "item1", first: true }];
|
||||
const wrapper = mountWithProps(options);
|
||||
const focusFirst = sandbox.spy(_ContextMenuItem.prototype, "focusFirst");
|
||||
@@ -112,7 +110,6 @@ describe("<ContextMenu>", () => {
|
||||
}
|
||||
|
||||
it("should render all the options provided", () => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
const options = [
|
||||
{ label: "item1" },
|
||||
{ type: "separator" },
|
||||
@@ -124,7 +121,6 @@ describe("<ContextMenu>", () => {
|
||||
assert.lengthOf(wrapper.find(".context-menu-list").children(), 3);
|
||||
});
|
||||
it("should not add a link for a separator", () => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
const options = [{ label: "item1" }, { type: "separator" }];
|
||||
const wrapper = shallow(
|
||||
<ContextMenu {...DEFAULT_PROPS} options={options} />
|
||||
@@ -132,7 +128,6 @@ describe("<ContextMenu>", () => {
|
||||
assert.lengthOf(wrapper.find(".separator"), 1);
|
||||
});
|
||||
it("should add a link for all types that are not separators", () => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
const options = [{ label: "item1" }, { type: "separator" }];
|
||||
const wrapper = shallow(
|
||||
<ContextMenu {...DEFAULT_PROPS} options={options} />
|
||||
@@ -176,7 +171,6 @@ describe("<ContextMenu>", () => {
|
||||
assert.lengthOf(wrapper.find(".context-menu-item a.disabled"), 0);
|
||||
});
|
||||
it("should add disabled className to any disabled options", () => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
const options = [
|
||||
{ label: "item1", icon: "icon1", disabled: true },
|
||||
{ type: "separator" },
|
||||
@@ -186,7 +180,6 @@ describe("<ContextMenu>", () => {
|
||||
assert.lengthOf(wrapper.find(".context-menu-item button.disabled"), 1);
|
||||
});
|
||||
it("should have the context-menu-item class", () => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
const options = [{ label: "item1", icon: "icon1" }];
|
||||
const props = Object.assign({}, DEFAULT_PROPS, { options });
|
||||
const wrapper = mountWithProps(props);
|
||||
|
||||
@@ -163,14 +163,14 @@ describe("DiscoveryStreamAdmin", () => {
|
||||
);
|
||||
});
|
||||
it("should fire setConfigValue with DISCOVERY_STREAM_CONFIG_SET_VALUE", () => {
|
||||
const configName = "name";
|
||||
const configValue = "value";
|
||||
wrapper.instance().setConfigValue(configName, configValue);
|
||||
const name = "name";
|
||||
const value = "value";
|
||||
wrapper.instance().setConfigValue(name, value);
|
||||
assert.calledWith(
|
||||
dispatch,
|
||||
ac.OnlyToMain({
|
||||
type: at.DISCOVERY_STREAM_CONFIG_SET_VALUE,
|
||||
data: { name: configName, value: configValue },
|
||||
data: { name, value },
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {
|
||||
_CardGrid as CardGrid,
|
||||
// eslint-disable-next-line no-shadow
|
||||
IntersectionObserver,
|
||||
RecentSavesContainer,
|
||||
OnboardingExperience,
|
||||
|
||||
@@ -125,7 +125,6 @@ describe("<DSCard>", () => {
|
||||
});
|
||||
|
||||
it("should render Sponsored Context for a spoc element", () => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
const context = "Sponsored by Foo";
|
||||
wrapper = mount(
|
||||
<DSCard context_type="bookmark" context={context} {...DEFAULT_PROPS} />
|
||||
|
||||
@@ -13,7 +13,6 @@ describe("<DSContextFooter>", () => {
|
||||
let sandbox;
|
||||
const bookmarkBadge = "bookmark";
|
||||
const removeBookmarkBadge = "removedBookmark";
|
||||
// eslint-disable-next-line no-shadow
|
||||
const context = "Sponsored by Babel";
|
||||
const sponsored_by_override = "Sponsored override";
|
||||
const engagement = "Popular";
|
||||
|
||||
@@ -310,7 +310,6 @@ describe("<ImpressionStats>", () => {
|
||||
);
|
||||
});
|
||||
it("should unobserve the intersection observer when the wrapper is removed", () => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
const IntersectionObserver =
|
||||
buildIntersectionObserver(ZeroIntersectEntries);
|
||||
const spy = sinon.spy(IntersectionObserver.prototype, "unobserve");
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-shadow */
|
||||
import { ContextMenu } from "content-src/components/ContextMenu/ContextMenu";
|
||||
import { _LinkMenu as LinkMenu } from "content-src/components/LinkMenu/LinkMenu";
|
||||
import React from "react";
|
||||
|
||||
@@ -559,7 +559,6 @@ describe("<TopSiteLink>", () => {
|
||||
});
|
||||
it("should prevent dragging with sponsored_position from dragstart", () => {
|
||||
const preventDefault = sinon.stub();
|
||||
// eslint-disable-next-line no-shadow
|
||||
const blur = sinon.stub();
|
||||
wrapper.setProps({ link: { sponsored_position: 1 } });
|
||||
wrapper.instance().onDragEvent({
|
||||
@@ -573,7 +572,6 @@ describe("<TopSiteLink>", () => {
|
||||
});
|
||||
it("should prevent dragging with link.shim from dragstart", () => {
|
||||
const preventDefault = sinon.stub();
|
||||
// eslint-disable-next-line no-shadow
|
||||
const blur = sinon.stub();
|
||||
wrapper.setProps({ link: { type: "SPOC" } });
|
||||
wrapper.instance().onDragEvent({
|
||||
@@ -956,7 +954,7 @@ describe("<TopSiteForm>", () => {
|
||||
let wrapper;
|
||||
let sandbox;
|
||||
|
||||
function testSetup(props = {}) {
|
||||
function setup(props = {}) {
|
||||
sandbox = sinon.createSandbox();
|
||||
const customProps = Object.assign(
|
||||
{},
|
||||
@@ -967,7 +965,7 @@ describe("<TopSiteForm>", () => {
|
||||
}
|
||||
|
||||
describe("validateForm", () => {
|
||||
beforeEach(() => testSetup({ site: { url: "http://foo" } }));
|
||||
beforeEach(() => setup({ site: { url: "http://foo" } }));
|
||||
|
||||
it("should return true for a correct URL", () => {
|
||||
wrapper.setState({ url: "foo" });
|
||||
@@ -1009,7 +1007,7 @@ describe("<TopSiteForm>", () => {
|
||||
|
||||
describe("#previewButton", () => {
|
||||
beforeEach(() =>
|
||||
testSetup({
|
||||
setup({
|
||||
site: { customScreenshotURL: "http://foo.com" },
|
||||
previewResponse: null,
|
||||
})
|
||||
@@ -1037,7 +1035,7 @@ describe("<TopSiteForm>", () => {
|
||||
|
||||
describe("preview request", () => {
|
||||
beforeEach(() => {
|
||||
testSetup({
|
||||
setup({
|
||||
site: { customScreenshotURL: "http://foo.com", url: "http://foo.com" },
|
||||
previewResponse: null,
|
||||
});
|
||||
@@ -1075,7 +1073,7 @@ describe("<TopSiteForm>", () => {
|
||||
|
||||
describe("#TopSiteLink", () => {
|
||||
beforeEach(() => {
|
||||
testSetup();
|
||||
setup();
|
||||
});
|
||||
|
||||
it("should display a TopSiteLink preview", () => {
|
||||
@@ -1115,7 +1113,7 @@ describe("<TopSiteForm>", () => {
|
||||
});
|
||||
|
||||
describe("#addMode", () => {
|
||||
beforeEach(() => testSetup());
|
||||
beforeEach(() => setup());
|
||||
|
||||
it("should render the component", () => {
|
||||
assert.ok(wrapper.find(TopSiteForm).exists());
|
||||
@@ -1206,7 +1204,7 @@ describe("<TopSiteForm>", () => {
|
||||
|
||||
describe("edit existing Topsite", () => {
|
||||
beforeEach(() =>
|
||||
testSetup({
|
||||
setup({
|
||||
site: {
|
||||
url: "https://foo.bar",
|
||||
label: "baz",
|
||||
@@ -1352,7 +1350,7 @@ describe("<TopSiteForm>", () => {
|
||||
});
|
||||
|
||||
describe("#previewMode", () => {
|
||||
beforeEach(() => testSetup({ previewResponse: null }));
|
||||
beforeEach(() => setup({ previewResponse: null }));
|
||||
|
||||
it("should transition from save to preview", () => {
|
||||
wrapper.setProps({
|
||||
@@ -1404,7 +1402,7 @@ describe("<TopSiteForm>", () => {
|
||||
|
||||
describe("#validateUrl", () => {
|
||||
it("should properly validate URLs", () => {
|
||||
testSetup();
|
||||
setup();
|
||||
assert.ok(wrapper.instance().validateUrl("mozilla.org"));
|
||||
assert.ok(wrapper.instance().validateUrl("https://mozilla.org"));
|
||||
assert.ok(wrapper.instance().validateUrl("http://mozilla.org"));
|
||||
@@ -1424,7 +1422,7 @@ describe("<TopSiteForm>", () => {
|
||||
|
||||
describe("#cleanUrl", () => {
|
||||
it("should properly prepend http:// to URLs when required", () => {
|
||||
testSetup();
|
||||
setup();
|
||||
assert.equal(
|
||||
"http://mozilla.org",
|
||||
wrapper.instance().cleanUrl("mozilla.org")
|
||||
|
||||
@@ -135,7 +135,6 @@ describe("<TopSiteImpressionWrapper>", () => {
|
||||
);
|
||||
});
|
||||
it("should unobserve the intersection observer when the wrapper is removed", () => {
|
||||
// eslint-disable-next-line no-shadow
|
||||
const IntersectionObserver =
|
||||
buildIntersectionObserver(ZeroIntersectEntries);
|
||||
const spy = sinon.spy(IntersectionObserver.prototype, "unobserve");
|
||||
|
||||
Reference in New Issue
Block a user