forked from cuke-ui/cuke-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0adc7fa
commit e0442ca
Showing
14 changed files
with
653 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
268 changes: 268 additions & 0 deletions
268
components/popover/__tests__/__snapshots__/index.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,268 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<Popover/> should render a <Popover/> components 1`] = ` | ||
<div> | ||
<div | ||
class="cuke-popover" | ||
content="11" | ||
> | ||
<div | ||
class="cuke-tooltip" | ||
> | ||
<div | ||
class="cuke-tooltip-wrapper position-top cuke-popover-wrapper cuke-tooltip-hide cuke-ui-no-animate" | ||
style="left:0;top:0" | ||
> | ||
<div | ||
class="cuke-popover-title" | ||
> | ||
黄瓜ui | ||
</div> | ||
<div | ||
class="cuke-popover-content" | ||
> | ||
11 | ||
</div> | ||
</div> | ||
<span | ||
class="cuke-tooltip-trigger-wrapper" | ||
> | ||
<span> | ||
鼠标放上来 | ||
</span> | ||
</span> | ||
</div> | ||
</div> | ||
<div | ||
class="cuke-popover" | ||
content="11" | ||
> | ||
<div | ||
class="cuke-tooltip" | ||
> | ||
<div | ||
class="cuke-tooltip-wrapper position-top cuke-popover-wrapper cuke-tooltip-hide cuke-ui-no-animate" | ||
style="left:0;top:0" | ||
> | ||
<div | ||
class="cuke-popover-title" | ||
> | ||
黄瓜ui | ||
</div> | ||
<div | ||
class="cuke-popover-content" | ||
> | ||
11 | ||
</div> | ||
</div> | ||
<span | ||
class="cuke-tooltip-trigger-wrapper" | ||
> | ||
<button | ||
class="cuke-button cuke-button-default" | ||
type="button" | ||
> | ||
<span> | ||
上 | ||
</span> | ||
</button> | ||
</span> | ||
</div> | ||
</div> | ||
<div | ||
class="cuke-popover" | ||
content="11" | ||
> | ||
<div | ||
class="cuke-tooltip" | ||
> | ||
<div | ||
class="cuke-tooltip-wrapper position-bottom cuke-popover-wrapper cuke-tooltip-hide cuke-ui-no-animate" | ||
style="left:0;top:0" | ||
> | ||
<div | ||
class="cuke-popover-title" | ||
> | ||
黄瓜ui | ||
</div> | ||
<div | ||
class="cuke-popover-content" | ||
> | ||
11 | ||
</div> | ||
</div> | ||
<span | ||
class="cuke-tooltip-trigger-wrapper" | ||
> | ||
<button | ||
class="cuke-button cuke-button-default" | ||
type="button" | ||
> | ||
<span> | ||
下 | ||
</span> | ||
</button> | ||
</span> | ||
</div> | ||
</div> | ||
<div | ||
class="cuke-popover" | ||
content="11" | ||
> | ||
<div | ||
class="cuke-tooltip" | ||
> | ||
<div | ||
class="cuke-tooltip-wrapper position-left cuke-popover-wrapper cuke-tooltip-hide cuke-ui-no-animate" | ||
style="left:0;top:0" | ||
> | ||
<div | ||
class="cuke-popover-title" | ||
> | ||
黄瓜ui | ||
</div> | ||
<div | ||
class="cuke-popover-content" | ||
> | ||
11 | ||
</div> | ||
</div> | ||
<span | ||
class="cuke-tooltip-trigger-wrapper" | ||
> | ||
<button | ||
class="cuke-button cuke-button-default" | ||
type="button" | ||
> | ||
<span> | ||
左 | ||
</span> | ||
</button> | ||
</span> | ||
</div> | ||
</div> | ||
<div | ||
class="cuke-popover" | ||
> | ||
<div | ||
class="cuke-tooltip" | ||
> | ||
<div | ||
class="cuke-tooltip-wrapper position-right cuke-popover-wrapper cuke-tooltip-hide cuke-ui-no-animate" | ||
style="left:0;top:0" | ||
> | ||
<div | ||
class="cuke-popover-title" | ||
> | ||
黄瓜ui | ||
</div> | ||
</div> | ||
<span | ||
class="cuke-tooltip-trigger-wrapper" | ||
> | ||
<button | ||
class="cuke-button cuke-button-default" | ||
type="button" | ||
> | ||
<span> | ||
右 | ||
</span> | ||
</button> | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`<Popover/> should render custom position 1`] = ` | ||
<div> | ||
<Popover | ||
onVisibleChange={[Function]} | ||
position="top" | ||
prefixCls="cuke-popover" | ||
title="黄瓜ui" | ||
> | ||
<Button | ||
block={false} | ||
circle={false} | ||
dashed={false} | ||
disabled={false} | ||
hollow={false} | ||
href="" | ||
htmlType="button" | ||
loading={false} | ||
prefixCls="cuke-button" | ||
size="default" | ||
type="default" | ||
> | ||
上 | ||
</Button> | ||
</Popover> | ||
<Popover | ||
onVisibleChange={[Function]} | ||
position="bottom" | ||
prefixCls="cuke-popover" | ||
title="黄瓜ui" | ||
> | ||
<Button | ||
block={false} | ||
circle={false} | ||
dashed={false} | ||
disabled={false} | ||
hollow={false} | ||
href="" | ||
htmlType="button" | ||
loading={false} | ||
prefixCls="cuke-button" | ||
size="default" | ||
type="default" | ||
> | ||
下 | ||
</Button> | ||
</Popover> | ||
<Popover | ||
onVisibleChange={[Function]} | ||
position="left" | ||
prefixCls="cuke-popover" | ||
title="黄瓜ui" | ||
> | ||
<Button | ||
block={false} | ||
circle={false} | ||
dashed={false} | ||
disabled={false} | ||
hollow={false} | ||
href="" | ||
htmlType="button" | ||
loading={false} | ||
prefixCls="cuke-button" | ||
size="default" | ||
type="default" | ||
> | ||
左 | ||
</Button> | ||
</Popover> | ||
<Popover | ||
onVisibleChange={[Function]} | ||
position="right" | ||
prefixCls="cuke-popover" | ||
title="黄瓜ui" | ||
> | ||
<Button | ||
block={false} | ||
circle={false} | ||
dashed={false} | ||
disabled={false} | ||
hollow={false} | ||
href="" | ||
htmlType="button" | ||
loading={false} | ||
prefixCls="cuke-button" | ||
size="default" | ||
type="default" | ||
> | ||
右 | ||
</Button> | ||
</Popover> | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import React from "react"; | ||
import assert from "power-assert"; | ||
import { render, shallow } from "enzyme"; | ||
import toJson from "enzyme-to-json"; | ||
import Popover from "../index"; | ||
import Button from "../../button"; | ||
import Tooltip from "../../tooltip"; | ||
|
||
describe("<Popover/>", () => { | ||
it("should render a <Popover/> components", () => { | ||
const wrapper = render( | ||
<div> | ||
<Popover title="黄瓜ui" content="11"> | ||
<span> 鼠标放上来 </span> | ||
</Popover> | ||
<Popover title="黄瓜ui" position="top" content="11"> | ||
<Button>上</Button> | ||
</Popover> | ||
<Popover title="黄瓜ui" position="bottom" content="11"> | ||
<Button>下</Button> | ||
</Popover> | ||
<Popover title="黄瓜ui" position="left" content="11"> | ||
<Button>左</Button> | ||
</Popover> | ||
<Popover title="黄瓜ui" position="right"> | ||
<Button>右</Button> | ||
</Popover> | ||
</div> | ||
); | ||
expect(toJson(wrapper)).toMatchSnapshot(); | ||
}); | ||
|
||
it("should find cuke-popover classnames", () => { | ||
const wrapper = shallow( | ||
<Popover title="黄瓜ui"> | ||
<span> 鼠标放上来 </span> | ||
</Popover> | ||
); | ||
assert(wrapper.find(".cuke-popover").length === 1); | ||
}); | ||
|
||
it("should render custom position", () => { | ||
const wrapper = shallow( | ||
<div> | ||
<Popover title="黄瓜ui" position="top"> | ||
<Button>上</Button> | ||
</Popover> | ||
<Popover title="黄瓜ui" position="bottom"> | ||
<Button>下</Button> | ||
</Popover> | ||
<Popover title="黄瓜ui" position="left"> | ||
<Button>左</Button> | ||
</Popover> | ||
<Popover title="黄瓜ui" position="right"> | ||
<Button>右</Button> | ||
</Popover> | ||
</div> | ||
); | ||
expect(toJson(wrapper)).toMatchSnapshot(); | ||
}); | ||
|
||
it("should find Tooltip", () => { | ||
const wrapper = shallow( | ||
<Popover title="黄瓜ui" position="top"> | ||
<Button>上</Button> | ||
</Popover> | ||
); | ||
assert(wrapper.find(Tooltip).length === 1); | ||
}); | ||
|
||
it("should render custom children", () => { | ||
const wrapper = shallow( | ||
<Popover title="黄瓜ui" position="top"> | ||
<Button>上</Button> | ||
</Popover> | ||
); | ||
assert(wrapper.find(Button).length === 1); | ||
}); | ||
}); |
Oops, something went wrong.