Skip to content

Commit

Permalink
Revert "[release/1.x] Use correct popover props for TimezonePicker (#…
Browse files Browse the repository at this point in the history
…1879)"

This reverts commit f5da6b3.
  • Loading branch information
cmslewis committed Dec 13, 2017
1 parent 1ad1816 commit 877d425
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import {
HTMLInputProps,
IButtonProps,
IInputGroupProps,
IPopoverProps,
IProps,
MenuItem,
Utils,
} from "@blueprintjs/core";
import * as Classes from "../../common/classes";
import { IPopover2Props } from "../popover/popover2";
import { ISelectItemRendererProps, Select } from "../select/select";
import { formatTimezone, TimezoneDisplayFormat } from "./timezoneDisplayFormat";
import { getInitialTimezoneItems, getTimezoneItems, ITimezoneItem } from "./timezoneItems";
Expand Down Expand Up @@ -89,8 +89,8 @@ export interface ITimezonePickerProps extends IProps {
*/
inputProps?: IInputGroupProps & HTMLInputProps;

/** Props to spread to `Popover2`. Note that `content` cannot be changed. */
popoverProps?: Partial<IPopover2Props> & object;
/** Props to spread to `Popover`. Note that `content` cannot be changed. */
popoverProps?: Partial<IPopoverProps> & object;
}

export interface ITimezonePickerState {
Expand Down Expand Up @@ -135,7 +135,7 @@ export class TimezonePicker extends AbstractComponent<ITimezonePickerProps, ITim
placeholder: "Search for timezones...",
...inputProps,
};
const finalPopoverProps: Partial<IPopover2Props> & object = {
const finalPopoverProps: Partial<IPopoverProps> & object = {
...popoverProps,
popoverClassName: classNames(Classes.TIMEZONE_PICKER_POPOVER, popoverProps.popoverClassName),
};
Expand Down
19 changes: 10 additions & 9 deletions packages/labs/test/timezonePickerTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import {
IInputGroupProps,
IInputGroupState,
InputGroup,
IPopoverProps,
IPopoverState,
MenuItem,
} from "@blueprintjs/core";
import { IPopover2Props } from "../src/components/popover/popover2";
import {
getInitialTimezoneItems,
getLocalTimezoneItem,
Expand All @@ -43,7 +43,7 @@ import {
type TimezonePickerShallowWrapper = ShallowWrapper<ITimezonePickerProps, ITimezonePickerState>;
type SelectShallowWrapper = ShallowWrapper<ISelectProps<ITimezoneItem>, ISelectState<ITimezoneItem>>;
type QueryListShallowWrapper = ShallowWrapper<IQueryListProps<ITimezoneItem>, IQueryListState<ITimezoneItem>>;
type PopoverShallowWrapper = ShallowWrapper<IPopover2Props, IPopoverState>;
type PopoverShallowWrapper = ShallowWrapper<IPopoverProps, IPopoverState>;
type InputGroupShallowWrapper = ShallowWrapper<IInputGroupProps, IInputGroupState>;

describe("<TimezonePicker>", () => {
Expand Down Expand Up @@ -221,15 +221,16 @@ describe("<TimezonePicker>", () => {
});

it("popover can be controlled with popover props", () => {
const popoverProps: IPopover2Props = {
const popoverProps: IPopoverProps = {
inline: true,
isOpen: true,
placement: "right",
tetherOptions: { constraints: [{ attachment: "together", pin: true, to: "window" }] },
useSmartArrowPositioning: true,
};
const timezonePicker = shallow(<TimezonePicker popoverProps={popoverProps} />);
const popover = findPopover(timezonePicker);
for (const key of Object.keys(popoverProps)) {
assert.deepEqual(popover.prop(key), popoverProps[key as keyof IPopover2Props]);
assert.deepEqual(popover.prop(key), popoverProps[key as keyof IPopoverProps]);
}
});

Expand Down Expand Up @@ -259,10 +260,10 @@ describe("<TimezonePicker>", () => {
});

function getPopoverProps(
overrides: Partial<IPopover2Props> = {},
keysToUnset: Array<keyof IPopover2Props> = [],
): Partial<IPopover2Props> {
const popoverProps: Partial<IPopover2Props> = {
overrides: Partial<IPopoverProps> = {},
keysToUnset: Array<keyof IPopoverProps> = [],
): Partial<IPopoverProps> {
const popoverProps: Partial<IPopoverProps> = {
inline: true,
isOpen: true,
...overrides,
Expand Down

0 comments on commit 877d425

Please sign in to comment.