Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

fix(css-properties): remove incorrect React.ReactChild from Lossy Union #372

Merged
Show file tree
Hide file tree
Changes from 2 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
66 changes: 61 additions & 5 deletions test/glamorous.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -534,17 +534,20 @@ const usePropsAreCssOverrides = (
</div>
)

const BuiltinSingleElement: JSX.Element = <glamorous.Div />;
import { Span } from "../"

const BuiltinSingleElement: JSX.Element = <glamorous.Div display="block" onClick={() => {}} />;
const BuiltinSingleElementNamedExport: JSX.Element = <Span display="block" onClick={() => {}} />;

const BuiltinSingleChild: JSX.Element = (
<glamorous.Div>
<glamorous.Span>Hello, world!</glamorous.Span>
<Span>Hello, world!</Span>
</glamorous.Div>
);

const BuiltinMultipleChild: JSX.Element = (
<glamorous.Div>
<glamorous.Span>Hello,</glamorous.Span>
<Span>Hello,</Span>
<glamorous.Span>world!</glamorous.Span>
</glamorous.Div>
);
Expand All @@ -559,8 +562,61 @@ const BuiltinStyledWithSingleChild: JSX.Element = (
);

const BuiltinStyledWithMultipleChild: JSX.Element = (
<glamorous.Div color='red'>
<glamorous.Div color='red' onClick={() => {}}>
<glamorous.Span>Hello,</glamorous.Span>
<glamorous.Span>world!</glamorous.Span>
<Span>world!</Span>
</glamorous.Div>
);

const CustomStatelessComponent: React.SFC<{}> = (_props) => <div />
class CustomClassComponent extends React.Component<{}, {}> {
render() {
return null
}
}
const CustomGlamorousComponent = glamorous.div()
const CustomGlamorousComponent2 = glamorous('div')()
const CustomGlamorousComponent3 = glamorous(CustomGlamorousComponent)()
const BuiltinStyledComponentChildren: JSX.Element = (
<glamorous.Div height={18} onClick={() => {}}>
{}
<CustomStatelessComponent />
<CustomClassComponent />
<CustomGlamorousComponent />
<CustomGlamorousComponent2 />
<CustomGlamorousComponent3 />
</glamorous.Div>
)
const BuiltinStyledWithPrimitivesChildren: JSX.Element = (
<Div color='red'>
{null}
{false}
{true}
{undefined}
{5}
</Div>
);

const BuiltinStyledWithFragment: JSX.Element = (
<div>
<glamorous.Div color='red' onClick={() => {}}>
<React.Fragment />
</glamorous.Div>
<Span color='red' onClick={() => {}}>
<React.Fragment />
</Span>
</div>
);

const cssProps = {
":active": {
color: "purple"
}
};

const BuiltinStyledWithCSSPseudoProps = (
<div>
<glamorous.A {...cssProps} />
<glamorous.A css={cssProps} />
</div>
);
Loading