-
Notifications
You must be signed in to change notification settings - Fork 753
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
Showing
14 changed files
with
141 additions
and
737 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AtFab Snap render AtFab -- default props 1`] = `"<div class=\\"at-fab at-fab--normal\\">按钮</div>"`; | ||
exports[`AtFab Snap render AtFab -- size 50 1`] = `"<div class=\\"at-fab at-fab--50\\">按钮</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,36 @@ | ||
import Taro from '@tarojs/taro' | ||
import { View } from '@tarojs/components' | ||
import PropTypes from 'prop-types' | ||
import classNames from 'classnames' | ||
import AtComponent from '../../common/component' | ||
|
||
export default class AtFab extends AtComponent { | ||
onClick () { | ||
this.props.onClick && this.props.onClick(...arguments) | ||
} | ||
|
||
render () { | ||
const { size } = this.props | ||
|
||
const rootClass = classNames('at-fab', { | ||
[`at-fab--${size}`]: size | ||
}) | ||
|
||
return ( | ||
<View | ||
className={rootClass} | ||
onClick={this.onClick.bind(this)} | ||
>{this.props.children}</View> | ||
) | ||
} | ||
} | ||
|
||
AtFab.propTypes = { | ||
size: PropTypes.oneOf(['normal', 'small']), | ||
onClick: PropTypes.func, | ||
} | ||
|
||
AtFab.defaultProps = { | ||
size: 'normal', | ||
onClick: () => {}, | ||
} |
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,26 @@ | ||
import Nerv, { findDOMNode } from 'nervjs' | ||
import { renderToString } from 'nerv-server' | ||
import { Simulate, renderIntoDocument } from 'nerv-test-utils' | ||
import AtFab from '../../../.temp/components/fab/index' | ||
|
||
describe('AtFab Snap', () => { | ||
it('render AtFab -- default props', () => { | ||
const component = renderToString(<AtFab>按钮</AtFab>) | ||
expect(component).toMatchSnapshot() | ||
}) | ||
|
||
it('render AtFab -- size 50', () => { | ||
const component = renderToString(<AtFab size={50}>按钮</AtFab>) | ||
expect(component).toMatchSnapshot() | ||
}) | ||
}) | ||
|
||
describe('AtFab Event', () => { | ||
it('AtFab onClick', () => { | ||
const onClick = jest.fn() | ||
const component = renderIntoDocument(<AtFab onClick={onClick}>按钮</AtFab>) | ||
const componentDom = findDOMNode(component, 'at-fab') | ||
Simulate.click(componentDom) | ||
expect(onClick).toBeCalled() | ||
}) | ||
}) |
533 changes: 0 additions & 533 deletions
533
src/components/float-button/__snapshots__/index.test.js.snap
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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,38 @@ | ||
@import '../variables/default.scss'; | ||
@import '../mixins/index.scss'; | ||
|
||
.at-fab { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
padding: 0; | ||
width: $at-fab-size; | ||
height: $at-fab-size; | ||
color: $color-white; | ||
font-size: $font-size-base; | ||
line-height: $line-height-zh; | ||
text-align: center; | ||
border-radius: 50%; | ||
background: $at-fab-bg-color; | ||
box-shadow: $at-fab-box-shadow; | ||
box-sizing: border-box; | ||
|
||
&:active { | ||
background: $at-fab-bg-color-active; | ||
box-shadow: $at-fab-box-shadow-active; | ||
} | ||
|
||
/* elements */ | ||
&__icon, | ||
.at-icon { | ||
width: $at-fab-icon-size; | ||
height: $at-fab-icon-size; | ||
font-size: $at-fab-icon-size; | ||
} | ||
|
||
/* modifiers */ | ||
&--small { | ||
width: $at-fab-size-sm; | ||
height: $at-fab-size-sm; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.