-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #182 from appfolio/simplifySummaryBlock
gt - Remove custom SCSS
- Loading branch information
Showing
7 changed files
with
97 additions
and
88 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import 'jsdom-global/register'; | ||
|
||
/* eslint-env mocha */ | ||
import React from 'react'; | ||
import assert from 'assert'; | ||
import { mount } from 'enzyme'; | ||
|
||
import { SummaryBox, SummaryBoxItem } from '../../src'; | ||
|
||
describe.only('<SummaryBox />', () => { | ||
it('should render correctly', () => { | ||
const component = mount(<SummaryBox />); | ||
assert(component); | ||
}); | ||
|
||
it('should render items as SummaryBoxItems', () => { | ||
const items = [ | ||
{ value: 'Alpha', label: 'Team' }, | ||
{ value: 'Bravo', label: 'Johnny' }, | ||
{ value: 'Charlie', label: 'Brown' } | ||
]; | ||
const component = mount(<SummaryBox items={items} />); | ||
const children = component.find(SummaryBoxItem); | ||
assert(children.length, items.length); | ||
|
||
children.forEach((child, i) => { | ||
assert.equal(child.prop('value'), items[i].value); | ||
assert.equal(child.prop('label'), items[i].label); | ||
}); | ||
}); | ||
|
||
it('should render children', () => { | ||
const items = [ | ||
{ value: 'Oogah', label: 'Chaka' }, | ||
{ value: 'Milli', label: 'Vanilli' }, | ||
{ value: 'Ray', label: 'Charles' } | ||
]; | ||
const component = mount( | ||
<SummaryBox items={items}> | ||
{items.map(({ value, label }) => <SummaryBoxItem value={value} label={label} />)} | ||
</SummaryBox> | ||
); | ||
const children = component.find(SummaryBoxItem); | ||
assert(children.length, items.length); | ||
|
||
children.forEach((child, i) => { | ||
assert.equal(child.prop('value'), items[i].value); | ||
assert.equal(child.prop('label'), items[i].label); | ||
}); | ||
}); | ||
}); |
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,24 @@ | ||
import 'jsdom-global/register'; | ||
|
||
/* eslint-env mocha */ | ||
import React from 'react'; | ||
import assert from 'assert'; | ||
import { mount } from 'enzyme'; | ||
|
||
import { SummaryBoxItem } from '../../src'; | ||
|
||
describe('<SummaryBoxItem />', () => { | ||
it('should render correctly', () => { | ||
const component = mount(<SummaryBoxItem label="Hello" value="World" />); | ||
assert(component); | ||
assert(component.find('h3').text(), 'Hello'); | ||
assert(component.find('small').text(), 'World'); | ||
}); | ||
|
||
it('should show the default label and value if none specified', () => { | ||
const component = mount(<SummaryBoxItem />); | ||
assert(component); | ||
assert(component.find('h3').text(), '--'); | ||
assert(component.find('small').text(), '--'); | ||
}); | ||
}); |