chore(lint): Enable and autofix object-curly-newline multiline with some exceptions.
This commit is contained in:
Родитель
ae2d186c06
Коммит
f5e6e9cc95
|
@ -215,6 +215,7 @@
|
|||
"no-warning-comments": 0, // TODO: Change to `1`?
|
||||
"no-whitespace-before-property": 2,
|
||||
"no-with": 2,
|
||||
"object-curly-newline": [2, {"multiline": true}],
|
||||
"object-curly-spacing": [2, "never"],
|
||||
"object-property-newline": [2, {"allowMultiplePropertiesPerLine": true}],
|
||||
"object-shorthand": [2, "always"],
|
||||
|
|
|
@ -33,8 +33,6 @@ module.exports = template;
|
|||
|
||||
if (require.main === module) {
|
||||
// called from command line
|
||||
const args = require("minimist")(process.argv.slice(2), {
|
||||
alias: {baseUrl: "b", title: "t"}
|
||||
});
|
||||
const args = require("minimist")(process.argv.slice(2), {alias: {baseUrl: "b", title: "t"}});
|
||||
process.stdout.write(template(args));
|
||||
}
|
||||
|
|
|
@ -24,9 +24,7 @@ const CALENDAR_HEADINGS = {
|
|||
|
||||
const ActivityFeedItem = React.createClass({
|
||||
getInitialState() {
|
||||
return {
|
||||
showContextMenu: false
|
||||
};
|
||||
return {showContextMenu: false};
|
||||
},
|
||||
getDefaultProps() {
|
||||
return {
|
||||
|
@ -104,9 +102,7 @@ ActivityFeedItem.propTypes = {
|
|||
type: React.PropTypes.string,
|
||||
dateDisplay: React.PropTypes.number,
|
||||
provider_display: React.PropTypes.string,
|
||||
parsedUrl: React.PropTypes.shape({
|
||||
hostname: React.PropTypes.string
|
||||
})
|
||||
parsedUrl: React.PropTypes.shape({hostname: React.PropTypes.string})
|
||||
};
|
||||
|
||||
function groupSitesByDate(sites) {
|
||||
|
|
|
@ -72,9 +72,7 @@ const DebugPage = React.createClass({
|
|||
<div>
|
||||
{this.state.component === "Spotlight" &&
|
||||
<div className="spotlight">
|
||||
{selectSpotlight({
|
||||
Highlights: this.props.raw[this.state.dataSource]
|
||||
}).rows.map((item, i) => {
|
||||
{selectSpotlight({Highlights: this.props.raw[this.state.dataSource]}).rows.map((item, i) => {
|
||||
return (<SpotlightItem key={i} {...item} />);
|
||||
})}
|
||||
</div>
|
||||
|
|
|
@ -8,8 +8,6 @@ const LinkMenuButton = React.createClass({
|
|||
}
|
||||
});
|
||||
|
||||
LinkMenuButton.propTypes = {
|
||||
onClick: React.PropTypes.func.isRequired
|
||||
};
|
||||
LinkMenuButton.propTypes = {onClick: React.PropTypes.func.isRequired};
|
||||
|
||||
module.exports = LinkMenuButton;
|
||||
|
|
|
@ -4,9 +4,7 @@ const {Link} = require("react-router");
|
|||
|
||||
const LoadMore = React.createClass({
|
||||
getDefaultProps() {
|
||||
return {
|
||||
label: "See more"
|
||||
};
|
||||
return {label: "See more"};
|
||||
},
|
||||
render() {
|
||||
const link = this.props.to ?
|
||||
|
|
|
@ -3,15 +3,11 @@ const classNames = require("classnames");
|
|||
|
||||
const MediaPreview = React.createClass({
|
||||
getInitialState() {
|
||||
return {
|
||||
showPlayer: false
|
||||
};
|
||||
return {showPlayer: false};
|
||||
},
|
||||
|
||||
getDefaultProps() {
|
||||
return {
|
||||
previewInfo: {}
|
||||
};
|
||||
return {previewInfo: {}};
|
||||
},
|
||||
|
||||
onPreviewClick(evt) {
|
||||
|
|
|
@ -15,9 +15,7 @@ const TimelineBookmarks = React.createClass({
|
|||
}
|
||||
});
|
||||
|
||||
TimelineBookmarks.propTypes = {
|
||||
Bookmarks: React.PropTypes.object.isRequired
|
||||
};
|
||||
TimelineBookmarks.propTypes = {Bookmarks: React.PropTypes.object.isRequired};
|
||||
|
||||
module.exports = connect(selectBookmarks)(TimelineBookmarks);
|
||||
|
||||
|
|
|
@ -84,6 +84,4 @@ class Channel {
|
|||
|
||||
Channel.DEFAULT_OPTIONS = DEFAULT_OPTIONS;
|
||||
|
||||
module.exports = {
|
||||
Channel
|
||||
};
|
||||
module.exports = {Channel};
|
||||
|
|
|
@ -16,13 +16,13 @@ module.exports = function() {
|
|||
dispatch({
|
||||
type: "TOP_FRECENT_SITES_RESPONSE",
|
||||
data: fakeData.TopSites.rows.map(site => {
|
||||
return Object.assign({}, site, {
|
||||
return Object.assign({}, site, { // eslint-disable-line object-curly-newline
|
||||
// images: [],
|
||||
// favicon: null,
|
||||
// favicon_url: null,
|
||||
// favicon_colors: null,
|
||||
// description: null
|
||||
});
|
||||
}); // eslint-disable-line object-curly-newline
|
||||
})
|
||||
});
|
||||
break;
|
||||
|
|
|
@ -161,10 +161,12 @@ describe("GroupedActivityFeed", function() {
|
|||
|
||||
describe("maxPreviews", () => {
|
||||
const sites = ["lDv68xYHFXM", "xDv68xYHFXM", "1Dv68xYHFXM", "0Dv68xYHFXM"].map(url => {
|
||||
return faker.createSite({override: {
|
||||
url: `https://www.youtube.com/watch?v=${url}`,
|
||||
media: {type: "video"}
|
||||
}});
|
||||
return faker.createSite({
|
||||
override: {
|
||||
url: `https://www.youtube.com/watch?v=${url}`,
|
||||
media: {type: "video"}
|
||||
}
|
||||
});
|
||||
});
|
||||
it("should create previews for all items by default", () => {
|
||||
const feed = renderWithProvider(<GroupedActivityFeed sites={sites} />);
|
||||
|
|
|
@ -8,9 +8,7 @@ const {FIRST_RUN_TYPE} = require("lib/first-run-data");
|
|||
|
||||
const DEFAULT_PROPS = {
|
||||
onUpdate: () => {},
|
||||
site: {
|
||||
url: "https://foo.com"
|
||||
},
|
||||
site: {url: "https://foo.com"},
|
||||
page: "NEW_TAB",
|
||||
source: "ACTIVITY_FEED",
|
||||
index: 3
|
||||
|
@ -83,22 +81,24 @@ describe("LinkMenu", () => {
|
|||
function checkOption(options) {
|
||||
it(`should ${options.ref}`, done => {
|
||||
let count = 0;
|
||||
setup(options.props || {}, {dispatch(action) {
|
||||
if (action.type === options.event) {
|
||||
assert.deepEqual(action.data, options.eventData, "event data");
|
||||
count++;
|
||||
setup(options.props || {}, {
|
||||
dispatch(action) {
|
||||
if (action.type === options.event) {
|
||||
assert.deepEqual(action.data, options.eventData, "event data");
|
||||
count++;
|
||||
}
|
||||
if (action.type === "NOTIFY_USER_EVENT") {
|
||||
assert.equal(action.data.event, options.userEvent);
|
||||
assert.equal(action.data.page, DEFAULT_PROPS.page);
|
||||
assert.equal(action.data.source, DEFAULT_PROPS.source);
|
||||
assert.equal(action.data.action_position, DEFAULT_PROPS.index);
|
||||
count++;
|
||||
}
|
||||
if (count === 2) {
|
||||
done();
|
||||
}
|
||||
}
|
||||
if (action.type === "NOTIFY_USER_EVENT") {
|
||||
assert.equal(action.data.event, options.userEvent);
|
||||
assert.equal(action.data.page, DEFAULT_PROPS.page);
|
||||
assert.equal(action.data.source, DEFAULT_PROPS.source);
|
||||
assert.equal(action.data.action_position, DEFAULT_PROPS.index);
|
||||
count++;
|
||||
}
|
||||
if (count === 2) {
|
||||
done();
|
||||
}
|
||||
}});
|
||||
});
|
||||
TestUtils.Simulate.click(contextMenu.refs[options.ref]);
|
||||
});
|
||||
}
|
||||
|
@ -145,24 +145,26 @@ describe("LinkMenu", () => {
|
|||
function checkBlockRecommendation(options) {
|
||||
it(`should ${options.ref} recommendation`, done => {
|
||||
let count = 0;
|
||||
setup({site: {url: "https://foo.com", recommender_type: "pocket-trending", recommended: true}}, {dispatch(action) {
|
||||
if (action.type === options.event) {
|
||||
assert.deepEqual(action.data, options.eventData, "event data");
|
||||
count++;
|
||||
setup({site: {url: "https://foo.com", recommender_type: "pocket-trending", recommended: true}}, {
|
||||
dispatch(action) {
|
||||
if (action.type === options.event) {
|
||||
assert.deepEqual(action.data, options.eventData, "event data");
|
||||
count++;
|
||||
}
|
||||
if (action.type === "NOTIFY_USER_EVENT") {
|
||||
assert.equal(action.data.event, options.userEvent);
|
||||
assert.equal(action.data.page, DEFAULT_PROPS.page);
|
||||
assert.equal(action.data.source, DEFAULT_PROPS.source);
|
||||
assert.equal(action.data.action_position, DEFAULT_PROPS.index);
|
||||
assert.equal(action.data.url, "https://foo.com");
|
||||
assert.equal(action.data.recommender_type, "pocket-trending");
|
||||
count++;
|
||||
}
|
||||
if (count === 2) {
|
||||
done();
|
||||
}
|
||||
}
|
||||
if (action.type === "NOTIFY_USER_EVENT") {
|
||||
assert.equal(action.data.event, options.userEvent);
|
||||
assert.equal(action.data.page, DEFAULT_PROPS.page);
|
||||
assert.equal(action.data.source, DEFAULT_PROPS.source);
|
||||
assert.equal(action.data.action_position, DEFAULT_PROPS.index);
|
||||
assert.equal(action.data.url, "https://foo.com");
|
||||
assert.equal(action.data.recommender_type, "pocket-trending");
|
||||
count++;
|
||||
}
|
||||
if (count === 2) {
|
||||
done();
|
||||
}
|
||||
}});
|
||||
});
|
||||
TestUtils.Simulate.click(contextMenu.refs[options.ref]);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -15,8 +15,10 @@ describe("LinkMenuButton", () => {
|
|||
assert.isTrue(preventDefaultCalled, "preventDefault was called");
|
||||
done();
|
||||
}} />);
|
||||
TestUtils.Simulate.click(ReactDOM.findDOMNode(instance), {preventDefault: () => {
|
||||
preventDefaultCalled = true;
|
||||
}});
|
||||
TestUtils.Simulate.click(ReactDOM.findDOMNode(instance), {
|
||||
preventDefault: () => {
|
||||
preventDefaultCalled = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -89,9 +89,7 @@ describe("Search", () => {
|
|||
});
|
||||
|
||||
it("should show the drop down when the input field has a string and it is focused", () => {
|
||||
const props = {
|
||||
searchString: "hello"
|
||||
};
|
||||
const props = {searchString: "hello"};
|
||||
setup(props);
|
||||
// in order to see the drop down, there must be a search string and focus
|
||||
// must be true
|
||||
|
@ -101,9 +99,7 @@ describe("Search", () => {
|
|||
});
|
||||
|
||||
it("should show form history if there is any", () => {
|
||||
const props = {
|
||||
formHistory: ["hello", "hi"]
|
||||
};
|
||||
const props = {formHistory: ["hello", "hi"]};
|
||||
setup(props);
|
||||
// add some form history and see that it gets added to the drop down's
|
||||
// list of suggestions
|
||||
|
@ -114,9 +110,7 @@ describe("Search", () => {
|
|||
});
|
||||
|
||||
it("should show suggestions if there are any", () => {
|
||||
const props = {
|
||||
suggestions: ["hello", "hi"]
|
||||
};
|
||||
const props = {suggestions: ["hello", "hi"]};
|
||||
setup(props);
|
||||
// add some suggestions and see that it gets added to the drop down's
|
||||
// list of suggestions
|
||||
|
|
|
@ -18,9 +18,7 @@ const {INFINITE_SCROLL_THRESHOLD, SCROLL_TOP_OFFSET} = require("common/constants
|
|||
|
||||
describe("Timeline", () => {
|
||||
describe("TimelinePage", () => {
|
||||
const fakeProps = {
|
||||
location: {pathname: "/timeline"}
|
||||
};
|
||||
const fakeProps = {location: {pathname: "/timeline"}};
|
||||
let instance;
|
||||
beforeEach(() => {
|
||||
instance = renderWithProvider(<TimelinePage {...fakeProps}>
|
||||
|
@ -99,9 +97,7 @@ describe("Timeline", () => {
|
|||
assert.ok(loader);
|
||||
});
|
||||
it("should show Loader if History.isLoading is true", () => {
|
||||
setup({
|
||||
Feed: Object.assign({}, fakeProps.Feed, {isLoading: true})
|
||||
});
|
||||
setup({Feed: Object.assign({}, fakeProps.Feed, {isLoading: true})});
|
||||
assert.equal(loaderEl.hidden, false);
|
||||
});
|
||||
});
|
||||
|
@ -151,9 +147,11 @@ describe("Timeline", () => {
|
|||
assert.equal(instance.windowHeight, window.innerHeight);
|
||||
});
|
||||
it("should not call loadMore if the scrollTop is before the threshold", () => {
|
||||
setup({loadMoreAction: () => {
|
||||
throw new Error("Should not call loadMore");
|
||||
}});
|
||||
setup({
|
||||
loadMoreAction: () => {
|
||||
throw new Error("Should not call loadMore");
|
||||
}
|
||||
});
|
||||
instance.windowHeight = 200;
|
||||
instance.maybeLoadMoreData({scrollTop: 0, scrollHeight: 400});
|
||||
});
|
||||
|
|
|
@ -15,9 +15,7 @@ const fakeProps = {
|
|||
url: "http://foo.com",
|
||||
favicon_url: "http://foo.com/favicon.ico"
|
||||
},
|
||||
{
|
||||
url: "http://bar.com"
|
||||
}
|
||||
{url: "http://bar.com"}
|
||||
]
|
||||
};
|
||||
|
||||
|
|
|
@ -6,9 +6,7 @@ const {assert} = require("chai");
|
|||
describe("Channel", () => {
|
||||
let fakeTarget;
|
||||
beforeEach(() => {
|
||||
fakeTarget = {
|
||||
addEventListener: () => {}
|
||||
};
|
||||
fakeTarget = {addEventListener: () => {}};
|
||||
});
|
||||
|
||||
describe("instance", () => {
|
||||
|
|
|
@ -60,9 +60,7 @@ describe("selectors", () => {
|
|||
// match the conditions for spotlight to use them
|
||||
function assertInvalidSite(site) {
|
||||
const invalidSite = Object.assign({}, validSpotlightSite, site);
|
||||
const result = selectSpotlight({
|
||||
Highlights: {init: true, rows: [invalidSite, validSpotlightSite]}
|
||||
});
|
||||
const result = selectSpotlight({Highlights: {init: true, rows: [invalidSite, validSpotlightSite]}});
|
||||
assert.lengthOf(result.rows, 2 + firstRunData.Highlights.length);
|
||||
assert.equal(result.rows[0].url, validSpotlightSite.url);
|
||||
assert.equal(result.rows[1].url, invalidSite.url);
|
||||
|
@ -83,9 +81,7 @@ describe("selectors", () => {
|
|||
url: "https://foo.com",
|
||||
favicon_colors: [{color: [11, 11, 11]}]
|
||||
};
|
||||
const results = selectSpotlight({
|
||||
Highlights: {rows: [site]}
|
||||
});
|
||||
const results = selectSpotlight({Highlights: {rows: [site]}});
|
||||
assert.deepEqual(results.rows[0].backgroundColor, "rgba(11, 11, 11, 0.4)");
|
||||
});
|
||||
it("should use site.background_color for items that dont have an image if it exists", () => {
|
||||
|
@ -94,41 +90,29 @@ describe("selectors", () => {
|
|||
background_color: "#111111",
|
||||
favicon_colors: [{color: [11, 11, 11]}]
|
||||
};
|
||||
const results = selectSpotlight({
|
||||
Highlights: {init: true, rows: [site]}
|
||||
});
|
||||
const results = selectSpotlight({Highlights: {init: true, rows: [site]}});
|
||||
assert.equal(results.rows[0].backgroundColor, "#111111");
|
||||
});
|
||||
it("should use a fallback bg color if no favicon_colors are available", () => {
|
||||
const site = {url: "https://foo.com"};
|
||||
const results = selectSpotlight({
|
||||
Highlights: {init: true, rows: [site]}
|
||||
});
|
||||
const results = selectSpotlight({Highlights: {init: true, rows: [site]}});
|
||||
assert.ok(results.rows[0].backgroundColor, "should have a bg color");
|
||||
});
|
||||
it("should include first run items if init is true and Highlights is empty", () => {
|
||||
const results = selectSpotlight({
|
||||
Highlights: {init: true, rows: []}
|
||||
});
|
||||
const results = selectSpotlight({Highlights: {init: true, rows: []}});
|
||||
firstRunData.Highlights.forEach((item, i) => {
|
||||
assert.equal(results.rows[i].url, item.url);
|
||||
});
|
||||
});
|
||||
it("should not include first run items if init is false", () => {
|
||||
const results = selectSpotlight({
|
||||
Highlights: {init: false, rows: []}
|
||||
});
|
||||
const results = selectSpotlight({Highlights: {init: false, rows: []}});
|
||||
assert.lengthOf(results.rows, 0);
|
||||
});
|
||||
it("should sort sites that do not have a title to the end", () => {
|
||||
assertInvalidSite({
|
||||
title: null
|
||||
});
|
||||
assertInvalidSite({title: null});
|
||||
});
|
||||
it("should sort sites that do not have a description to the end", () => {
|
||||
assertInvalidSite({
|
||||
description: null
|
||||
});
|
||||
assertInvalidSite({description: null});
|
||||
});
|
||||
it("should sort sites for which the title equals the description to the end", () => {
|
||||
assertInvalidSite({
|
||||
|
@ -137,44 +121,30 @@ describe("selectors", () => {
|
|||
});
|
||||
});
|
||||
it("should sort sites that do not have an images prop or an empty array to the end", () => {
|
||||
assertInvalidSite({
|
||||
images: null
|
||||
});
|
||||
assertInvalidSite({
|
||||
images: []
|
||||
});
|
||||
assertInvalidSite({images: null});
|
||||
assertInvalidSite({images: []});
|
||||
});
|
||||
it("should append History sites to the end", () => {
|
||||
assertInvalidSite({
|
||||
images: null
|
||||
});
|
||||
assertInvalidSite({
|
||||
images: []
|
||||
});
|
||||
assertInvalidSite({images: null});
|
||||
assertInvalidSite({images: []});
|
||||
});
|
||||
});
|
||||
describe("selectTopSites", () => {
|
||||
it("should add default sites if init is true", () => {
|
||||
const rows = [{url: "http://foo.com"}, {url: "http://bar.com"}];
|
||||
const result = selectTopSites({
|
||||
TopSites: {init: true, rows}
|
||||
});
|
||||
const result = selectTopSites({TopSites: {init: true, rows}});
|
||||
assert.isTrue(result.init);
|
||||
assert.deepEqual(result.rows, rows.concat(firstRunData.TopSites));
|
||||
});
|
||||
it("should not add default sites if init is false", () => {
|
||||
const rows = [{url: "http://foo.com"}, {url: "http://bar.com"}];
|
||||
const result = selectTopSites({
|
||||
TopSites: {init: false, rows}
|
||||
});
|
||||
const result = selectTopSites({TopSites: {init: false, rows}});
|
||||
assert.isFalse(result.init);
|
||||
assert.deepEqual(result.rows, rows);
|
||||
});
|
||||
it("should dedupe by url", () => {
|
||||
const rows = [{url: "http://foo.com"}, {url: "http://www.foo.com"}];
|
||||
const result = selectTopSites({
|
||||
TopSites: {init: false, rows}
|
||||
});
|
||||
const result = selectTopSites({TopSites: {init: false, rows}});
|
||||
assert.deepEqual(result.rows, [{url: "http://foo.com"}]);
|
||||
});
|
||||
});
|
||||
|
@ -276,9 +246,7 @@ describe("selectors", () => {
|
|||
const siteWithMedia = {
|
||||
url: "https://www.youtube.com/watch?v=lDv68xYHFXM",
|
||||
images: [{url: "foo.jpg", height: IMG_HEIGHT, width: IMG_WIDTH}],
|
||||
media: {
|
||||
type: "video"
|
||||
}
|
||||
media: {type: "video"}
|
||||
};
|
||||
const embedPreviewURL = "https://www.youtube.com/embed/lDv68xYHFXM?autoplay=1";
|
||||
let state;
|
||||
|
|
|
@ -39,12 +39,8 @@ module.exports = function(config) {
|
|||
"content-test/index.js",
|
||||
{pattern: "data/content/favicons/**/*", watched: false, included: false, served: true}
|
||||
],
|
||||
proxies: {
|
||||
"/favicons/": "/base/data/content/favicons/"
|
||||
},
|
||||
preprocessors: {
|
||||
"content-test/**/*.js": ["webpack", "sourcemap"]
|
||||
},
|
||||
proxies: {"/favicons/": "/base/data/content/favicons/"},
|
||||
preprocessors: {"content-test/**/*.js": ["webpack", "sourcemap"]},
|
||||
webpack: {
|
||||
devtool: "inline-source-map",
|
||||
resolve: webpack.resolve,
|
||||
|
@ -59,8 +55,6 @@ module.exports = function(config) {
|
|||
},
|
||||
plugins: webpack.plugins
|
||||
},
|
||||
webpackMiddleware: {
|
||||
noInfo: true
|
||||
}
|
||||
webpackMiddleware: {noInfo: true}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -100,9 +100,7 @@ function ActivityStreams(metadataStore, options = {}) {
|
|||
|
||||
this._previewProvider = new PreviewProvider(this._tabTracker, metadataStore);
|
||||
|
||||
this._populatingCache = {
|
||||
places: false
|
||||
};
|
||||
this._populatingCache = {places: false};
|
||||
|
||||
this._asyncBuildPlacesCache();
|
||||
|
||||
|
@ -592,9 +590,7 @@ ActivityStreams.prototype = {
|
|||
this._appURLHider.uninit();
|
||||
this._perfMeter.uninit();
|
||||
this._memoizer.uninit();
|
||||
this._populatingCache = {
|
||||
places: false
|
||||
};
|
||||
this._populatingCache = {places: false};
|
||||
};
|
||||
|
||||
switch (reason) {
|
||||
|
|
|
@ -178,9 +178,7 @@ Links.prototype = {
|
|||
historyObserver: {
|
||||
onDeleteURI: function historyObserver_onDeleteURI(aURI) {
|
||||
// let observers remove sensitive data associated with deleted visit
|
||||
gLinks.emit("deleteURI", {
|
||||
url: aURI.spec
|
||||
});
|
||||
gLinks.emit("deleteURI", {url: aURI.spec});
|
||||
},
|
||||
|
||||
onClearHistory: function historyObserver_onClearHistory() {
|
||||
|
|
|
@ -6,7 +6,7 @@ const simplePrefs = require("sdk/simple-prefs");
|
|||
|
||||
const POCKET_API_URL = "pocket.endpoint";
|
||||
|
||||
const DEFAULT_TIMEOUTS = {
|
||||
const DEFAULT_TIMEOUTS = { // eslint-disable-line object-curly-newline
|
||||
pocketTimeout: 60 * 60 * 1000 // every 1 hour, refresh the Pocket recommendations
|
||||
};
|
||||
|
||||
|
@ -69,7 +69,8 @@ RecommendationProvider.prototype = {
|
|||
url: allowedRecommendations[index].url,
|
||||
recommended: true,
|
||||
recommender_type: "pocket-trending",
|
||||
type: "recommended"});
|
||||
type: "recommended"
|
||||
});
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
|
|
@ -267,6 +267,4 @@ NewTabSearchProvider.prototype = {
|
|||
}
|
||||
};
|
||||
|
||||
exports.SearchProvider = {
|
||||
search: new NewTabSearchProvider()
|
||||
};
|
||||
exports.SearchProvider = {search: new NewTabSearchProvider()};
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
const data = require("sdk/self").data;
|
||||
const URL = require("sdk/url").URL;
|
||||
|
||||
const DEFAULT_OPTIONS = {
|
||||
sites: null
|
||||
};
|
||||
const DEFAULT_OPTIONS = {sites: null};
|
||||
|
||||
function TippyTopProvider(options = {}) {
|
||||
this.options = Object.assign({}, DEFAULT_OPTIONS, options);
|
||||
|
|
|
@ -8,6 +8,4 @@ try {
|
|||
throw new Error("You are trying to import the wrong file. Import lib/vendor.bundle.js instead of lib/vendor-src.js");
|
||||
}
|
||||
|
||||
platform_exports = Object.assign(platform_exports, {
|
||||
SeedRandom: require("seedrandom")
|
||||
});
|
||||
platform_exports = Object.assign(platform_exports, {SeedRandom: require("seedrandom")});
|
||||
|
|
|
@ -52,14 +52,10 @@ exports["test ExperimentProvider.experimentId"] = assert => {
|
|||
exports["test ExperimentProvider.data"] = assert => {
|
||||
setup("baz");
|
||||
assert.equal(experimentProvider.data, experimentProvider._data, ".data should return return this._data");
|
||||
assert.deepEqual(experimentProvider.data, {
|
||||
foo: 42
|
||||
}, "clientID 'baz' should result in control being picked");
|
||||
assert.deepEqual(experimentProvider.data, {foo: 42}, "clientID 'baz' should result in control being picked");
|
||||
|
||||
setup("012j");
|
||||
assert.deepEqual(experimentProvider.data, {
|
||||
foo: 84
|
||||
}, "clientID '012j' should result in variant being picked");
|
||||
assert.deepEqual(experimentProvider.data, {foo: 84}, "clientID '012j' should result in variant being picked");
|
||||
};
|
||||
|
||||
exports["test ExperimentProvider only selects one experiment"] = assert => {
|
||||
|
@ -86,9 +82,7 @@ exports["test ExperimentProvider skips experiments with active = false"] = asser
|
|||
foo: {
|
||||
active: false,
|
||||
name: "foo",
|
||||
control: {
|
||||
value: "bloo"
|
||||
},
|
||||
control: {value: "bloo"},
|
||||
variant: {
|
||||
id: "asdasd",
|
||||
threshold: 0.3,
|
||||
|
|
|
@ -114,9 +114,7 @@ exports.test_Links_getTopFrecentSites_Order = function*(assert) {
|
|||
|
||||
exports.test_Links_getHighlightsLinks = function*(assert) {
|
||||
let provider = PlacesProvider.links;
|
||||
let {
|
||||
TRANSITION_TYPED
|
||||
} = PlacesUtils.history;
|
||||
let {TRANSITION_TYPED} = PlacesUtils.history;
|
||||
|
||||
let timeToday = timeDaysAgo(0);
|
||||
let timeEarlier = timeDaysAgo(2);
|
||||
|
@ -691,9 +689,7 @@ exports.test_Links_getHistorySize = function*(assert) {
|
|||
|
||||
exports.test_blocked_urls = function*(assert) {
|
||||
let provider = PlacesProvider.links;
|
||||
let {
|
||||
TRANSITION_TYPED
|
||||
} = PlacesUtils.history;
|
||||
let {TRANSITION_TYPED} = PlacesUtils.history;
|
||||
|
||||
let timeToday = timeDaysAgo(0);
|
||||
let timeEarlier = timeDaysAgo(2);
|
||||
|
|
|
@ -28,11 +28,7 @@ exports.test_metadatastore_saves_new_links = function*(assert) {
|
|||
{cache_key: "https://www.mozilla.org/", places_url: "https://www.mozilla.org/"},
|
||||
{cache_key: "https://www.mozilla.org/en-US/firefox/new/", places_url: "https://www.mozilla.org/en-US/firefox/new"},
|
||||
{cache_key: "https://notinDB.com/", places_url: "https://www.notinDB.com/", sanitized_url: "https://www.notinDB.com/"}];
|
||||
const fakeResponse = {"urls": {
|
||||
"https://www.notinDB.com/": {
|
||||
"embedlyMetaData": "some embedly metadata"
|
||||
}
|
||||
}};
|
||||
const fakeResponse = {"urls": {"https://www.notinDB.com/": {"embedlyMetaData": "some embedly metadata"}}};
|
||||
|
||||
let srv = httpd.startServerAsync(gPort);
|
||||
srv.registerPathHandler("/previewProviderMetadataStore", function handle(request, response) {
|
||||
|
|
|
@ -196,17 +196,13 @@ exports.test_throw_out_non_requested_responses = function*(assert) {
|
|||
const fakeData = [fakeSite1, fakeSite2, fakeSite4];
|
||||
|
||||
// receive site 1, 2, 3
|
||||
const fakeResponse = {"urls": {
|
||||
"http://example1.com/": {
|
||||
"embedlyMetaData": "some good embedly metadata for fake site 1"
|
||||
},
|
||||
"http://example2.com/": {
|
||||
"embedlyMetaData": "some good embedly metadata for fake site 2"
|
||||
},
|
||||
"http://example3.com/": {
|
||||
"embedlyMetaData": "oh no I didn't request this!"
|
||||
const fakeResponse = {
|
||||
"urls": {
|
||||
"http://example1.com/": {"embedlyMetaData": "some good embedly metadata for fake site 1"},
|
||||
"http://example2.com/": {"embedlyMetaData": "some good embedly metadata for fake site 2"},
|
||||
"http://example3.com/": {"embedlyMetaData": "oh no I didn't request this!"}
|
||||
}
|
||||
}};
|
||||
};
|
||||
|
||||
assert.ok(gPreviewProvider._embedlyEndpoint, "The embedly endpoint is set");
|
||||
let srv = httpd.startServerAsync(gPort);
|
||||
|
@ -247,11 +243,7 @@ exports.test_mock_embedly_request = function*(assert) {
|
|||
"cache_key": "example.com/"
|
||||
};
|
||||
const fakeRequest = [fakeSite];
|
||||
const fakeResponse = {"urls": {
|
||||
"http://example.com/": {
|
||||
"embedlyMetaData": "some embedly metadata"
|
||||
}
|
||||
}};
|
||||
const fakeResponse = {"urls": {"http://example.com/": {"embedlyMetaData": "some embedly metadata"}}};
|
||||
|
||||
const embedlyVersionQuery = "addon_version=";
|
||||
assert.ok(gPreviewProvider._embedlyEndpoint, "The embedly endpoint is set");
|
||||
|
|
|
@ -10,13 +10,15 @@ const gPort = 8079;
|
|||
|
||||
let gRecommendationProvider;
|
||||
let gPrefPocket = simplePrefs.prefs["pocket.endpoint"];
|
||||
let fakeResponse = {"urls": [
|
||||
let fakeResponse = {
|
||||
"urls": [
|
||||
{url: "http://example.com/1"},
|
||||
{url: "http://example.com/2"},
|
||||
{url: "http://example.com/3"},
|
||||
{url: "http://example.com/4"},
|
||||
{url: "http://example.com/5"}
|
||||
]};
|
||||
]
|
||||
};
|
||||
|
||||
exports.test_get_recommended_content = function*(assert) {
|
||||
assert.ok(gRecommendationProvider._pocketEndpoint, "The pocket endpoint is set");
|
||||
|
|
|
@ -3,16 +3,12 @@ const webpack = require("webpack");
|
|||
const absolute = relPath => require("path").join(__dirname, relPath);
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
"vendor": absolute("lib/vendor-src.js")
|
||||
},
|
||||
entry: {"vendor": absolute("lib/vendor-src.js")},
|
||||
output: {
|
||||
path: absolute("lib"),
|
||||
filename: "vendor.bundle.js"
|
||||
},
|
||||
module: {
|
||||
loaders: [{test: /\.json$/, loader: "json"}]
|
||||
},
|
||||
module: {loaders: [{test: /\.json$/, loader: "json"}]},
|
||||
plugins: [
|
||||
new webpack.BannerPlugin("const platform_require = require; let platform_exports = exports;\n", {raw: true})
|
||||
]
|
||||
|
|
|
@ -30,9 +30,7 @@ if (env === "production") {
|
|||
new webpack.optimize.OccurenceOrderPlugin(),
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
test: /vendor/,
|
||||
compress: {
|
||||
warnings: false
|
||||
}
|
||||
compress: {warnings: false}
|
||||
}),
|
||||
new webpack.optimize.DedupePlugin()
|
||||
]);
|
||||
|
|
Загрузка…
Ссылка в новой задаче