Skip to content

Commit

Permalink
fix(dialog): should extend HTMLElement (#723)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgr34 authored and Matt Goo committed Mar 18, 2019
1 parent 603f5d5 commit af449f4
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/dialog/DialogContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface DialogContentProps<T> extends React.HTMLProps<T> {
id?: string,
};

const DialogContent: <T extends {} = HTMLDivElement>(props: DialogContentProps<T>) =>
const DialogContent: <T extends HTMLElement = HTMLDivElement>(props: DialogContentProps<T>) =>
React.ReactElement<T> = ({
/* eslint-disable react/prop-types */
className = '',
Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/DialogFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface DialogFooterProps<T> extends React.HTMLProps<T> {
};


const DialogFooter: <T extends {} = HTMLElement>(props: DialogFooterProps<T>) =>
const DialogFooter: <T extends HTMLElement = HTMLElement>(props: DialogFooterProps<T>) =>
React.ReactElement<T> = ({
/* eslint-disable react/prop-types */
className = '',
Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/DialogTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface DialogTitleProps<T> extends React.HTMLProps<T> {
id?: string,
};

const DialogTitle: <T extends {} = HTMLHeadingElement>(props: DialogTitleProps<T>) =>
const DialogTitle: <T extends HTMLElement = HTMLHeadingElement>(props: DialogTitleProps<T>) =>
React.ReactElement<T> = ({
/* eslint-disable react/prop-types */
className = '',
Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function isDialogContent(element: any): element is DialogContent<any> {
return element.type === DialogContent;
}

class Dialog<T extends {} = HTMLElement> extends React.Component<
class Dialog<T extends HTMLElement = HTMLElement> extends React.Component<
DialogProps<T>,
DialogState
> {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/dialog/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as td from 'testdouble';
import {shallow, mount} from 'enzyme';
// @ts-ignore
import Dialog, {
ChildTypes, DialogProps, DialogTitle, DialogContent, DialogFooter, DialogButton,
ChildTypes, DialogTitle, DialogContent, DialogFooter, DialogButton,
} from '../../../packages/dialog';
// @ts-ignore no mdc .d.ts file
import {util} from '@material/dialog/dist/mdc.dialog';
Expand Down Expand Up @@ -227,7 +227,7 @@ test('#adapter.isContentScrollable returns false when there is no content', () =
});

test('#adapter.isContentScrollable returns the value of util.isScrollable', () => {
const wrapper = mount<Dialog<DialogProps<HTMLDivElement>>, {classList: Set<string>}>(
const wrapper = mount<Dialog>(
<Dialog open><DialogContent><p>meowkay</p></DialogContent></Dialog>
);
const content = wrapper.instance().content;
Expand Down

0 comments on commit af449f4

Please sign in to comment.