-
Notifications
You must be signed in to change notification settings - Fork 78
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
837f08b
commit 3e9dfd3
Showing
3 changed files
with
52 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import InputGroupAddon from './InputGroupAddon'; | ||
import { mount } from 'enzyme'; | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
|
||
describe('<InputGroupAddon />', () => { | ||
const inputGroupAddon = ( | ||
<InputGroupAddon addon='$' /> | ||
); | ||
|
||
test('create list group item actions', () => { | ||
let component = renderer.create(inputGroupAddon); | ||
let tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
describe('Prop spreading', () => { | ||
test('should allow props to be spread to the ListGroupItemActions component', () => { | ||
const element = mount(<InputGroupAddon data-sample='Sample' />); | ||
|
||
expect( | ||
element.getDOMNode().attributes['data-sample'].value | ||
).toBe('Sample'); | ||
}); | ||
}); | ||
|
||
test('should allow props to be spread to the InputGroup component for type number\'s up button element', () => { | ||
const element = mount(<InputGroupAddon inputType='number' numberUpButtonProps={{ 'data-sample': 'Sample' }} />); | ||
|
||
expect( | ||
element.find('button.sap-icon--slim-arrow-up').getDOMNode().attributes['data-sample'].value | ||
).toBe('Sample'); | ||
}); | ||
|
||
test('should allow props to be spread to the InputGroup component for type number\'s down button element', () => { | ||
const element = mount(<InputGroupAddon inputType='number' numberDownButtonProps={{ 'data-sample': 'Sample' }} />); | ||
|
||
expect( | ||
element.find('button.sap-icon--slim-arrow-down').getDOMNode().attributes['data-sample'].value | ||
).toBe('Sample'); | ||
}); | ||
}); |
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,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<InputGroupAddon /> create list group item actions 1`] = ` | ||
<span | ||
className="fd-input-group__addon" | ||
> | ||
$ | ||
</span> | ||
`; |