Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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 PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# title-component
# add-Toast
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PULL_REQUEST_TEMPLATE.md should not be changed


## Types of changes

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"@storybook/node-logger": "^3.4.10",
"@storybook/react": "^3.4.10",
"@storybook/storybook-deployer": "^2.3.0",
"@types/classnames": "^2.2.6",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Package.json should not be changed

"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.1",
Expand Down
6 changes: 5 additions & 1 deletion src/Toast/Toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ const Toast = ({ children, ...props }) => {
className
)

return <Element className={classNames}>{children}</Element>
return (
<Element {...attributes} className={classNames}>
{children}
</Element>
)
}

Toast.propTypes = propTypes
Expand Down
16 changes: 8 additions & 8 deletions src/__test__/Toast/Toast.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { shallow } from 'enzyme'
import { Toast } from '../..'

describe('Toasts', () => {
it('Should render a span tag by default', () => {
it('Should render a div tag by default', () => {
const wrapper = shallow(<Toast />)

expect(wrapper.type()).toBe('div')
Expand All @@ -17,7 +17,7 @@ describe('Toasts', () => {
})

it('Should pass additional classNames', () => {
const wrapper = shallow(<Toast className='extra'>My Toasts</Toast>)
const wrapper = shallow(<Toast className="extra">My Toasts</Toast>)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent quotes here. Use single quotes, follow the StandardJS style, run npm run lint to check for errors or use the extension.


expect(wrapper.hasClass('extra')).toBe(true)
})
Expand All @@ -29,13 +29,13 @@ describe('Toasts', () => {
})

it('Should render with "toast-{color}" class when a color is provided', () => {
const wrapper = shallow(<Toast color='primary'>Primary</Toast>)
const wrapper = shallow(<Toast color="primary">Primary</Toast>)

expect(wrapper.hasClass('toast-primary')).toBe(true)
})

it('Should render custom tag', () => {
const wrapper = shallow(<Toast renderAs='main'>custom</Toast>)
const wrapper = shallow(<Toast renderAs="main">custom</Toast>)

expect(wrapper.type()).toBe('main')
})
Expand All @@ -46,23 +46,23 @@ describe('Toasts', () => {
expect(wrapper).toMatchSnapshot()
})

// it('Should have Toasts classname', () => {
// const wrapper = renderer.create(<Toasts>Test</Toasts>)
// it('Should have toast classname', () => {
// const wrapper = renderer.create(<Toast>Test</Toast>)

// expect(wrapper.toJSON()).toMatchSnapshot()
// })

// it('Should concat classnames in props with Spectre classnames', () => {
// const wrapper = renderer.create(
// <Toasts className='other-class this-is-a-test'>classes</Toasts>
// <Toast className='other-class this-is-a-test'>classes</Toast>
// )

// expect(wrapper.toJSON()).toMatchSnapshot()
// })

// it('Should use inline styles', () => {
// const wrapper = renderer.create(
// <Toasts style={{ width: 250 }}>Inline styles</Toasts>)
// <Toast style={{ width: 250 }}>Inline styles</Toast>)

// expect(wrapper.toJSON()).toMatchSnapshot()
// })
Expand Down