Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

fix(dialog): should extend HTMLElement #723

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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