Skip to content
Snippets Groups Projects
Commit 35dbe61e authored by Tom Robinson's avatar Tom Robinson
Browse files

Misc tweaks

parent 1d62860f
No related branches found
No related tags found
No related merge requests found
......@@ -3,8 +3,8 @@
import type { DatetimeUnit } from "metabase/meta/types/Query";
export type DateStyle =
| "M/D/YY"
| "D/M/YY"
| "M/D/YYYY"
| "D/M/YYYY"
| "YYYY/M/D"
| "MMMM D, YYYY"
| "MMMM D, YYYY"
......@@ -36,11 +36,11 @@ const DEFAULT_DATE_FORMATS: { [unit: DatetimeUnit]: MomentFormat } = {
const DATE_STYLE_TO_FORMAT: {
[style: DateStyle]: { [unit: DatetimeUnit]: MomentFormat },
} = {
"M/D/YY": {
month: "M/YY",
"M/D/YYYY": {
month: "M/YYYY",
},
"D/M/YY": {
month: "M/YY",
"D/M/YYYY": {
month: "M/YYYY",
},
"YYYY/M/D": {
month: "YYYY/M",
......
......@@ -59,12 +59,12 @@ const EXAMPLE_DATE = moment("2018-01-07 17:24");
function getDateStyleOptionsForUnit(unit: ?DatetimeUnit) {
const options = [
dateStyleOption("M/D/YY", unit, hasDay(unit) ? "month, day, year" : null),
dateStyleOption("D/M/YY", unit, hasDay(unit) ? "day, month, year" : null),
dateStyleOption("YYYY/M/D", unit, hasDay(unit) ? "year, month, day" : null),
dateStyleOption("MMMM D, YYYY", unit),
dateStyleOption("D MMMM, YYYY", unit),
dateStyleOption("dddd, MMMM D, YYYY", unit),
dateStyleOption("M/D/YYYY", unit, hasDay(unit) ? "month, day, year" : null),
dateStyleOption("D/M/YYYY", unit, hasDay(unit) ? "day, month, year" : null),
dateStyleOption("YYYY/M/D", unit, hasDay(unit) ? "year, month, day" : null),
];
const seen = new Set();
return options.filter(option => {
......
......@@ -112,7 +112,7 @@ export function nestedSettings(
onChangeSettings,
extra,
);
return widgets;
return widgets.map(widget => ({ ...widget, noPadding: true }));
}
// decorate with nested settings HOC
......
......@@ -9,13 +9,13 @@ describe("visualization_settings", () => {
describe("getSettings", () => {
describe("stackable.stack_type", () => {
it("should default to unstacked stacked", () => {
const settings = getSettings(
const settings = getComputedSettingsForSeries(
cardWithTimeseriesBreakout({ unit: "month" }),
);
expect(settings["stackable.stack_type"]).toBe(null);
});
it("should default area chart to stacked for 1 dimensions and 2 metrics", () => {
const settings = getSettings(
const settings = getComputedSettingsForSeries(
cardWithTimeseriesBreakoutAndTwoMetrics({
display: "area",
unit: "month",
......@@ -42,14 +42,18 @@ describe("visualization_settings", () => {
describe("non-histgram units", () =>
NON_HISTOGRAM_UNITS.map(unit =>
it(`should default ${unit} to false`, () => {
const settings = getSettings(cardWithTimeseriesBreakout({ unit }));
const settings = getComputedSettingsForSeries(
cardWithTimeseriesBreakout({ unit }),
);
expect(settings["graph.x_axis._is_histogram"]).toBe(false);
}),
));
describe("histgram units", () =>
HISTOGRAM_UNITS.map(unit =>
it(`should default ${unit} to true`, () => {
const settings = getSettings(cardWithTimeseriesBreakout({ unit }));
const settings = getComputedSettingsForSeries(
cardWithTimeseriesBreakout({ unit }),
);
expect(settings["graph.x_axis._is_histogram"]).toBe(true);
}),
));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment