Skip to content

Commit

Permalink
Fixing duplicate props after merging two PRs (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
robmadole authored Feb 24, 2022
1 parent 77b9bde commit 797dd75
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 30 deletions.
39 changes: 14 additions & 25 deletions src/utils/__tests__/get-class-list-from-props.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,36 @@ import getClassList from '../get-class-list-from-props'

describe('get class list', () => {
test('test the booleans', () => {
// the eight we're testing plus the three defaults
const NUM_CLASSES = 8

const props = {
spin: true,
pulse: true,
border: true,
fixedWidth: true,
inverse: true,
border: true,
listItem: true,
pulse: true,
spin: true,
beat: true,
fade: true,
beatFade: true,
bounce: true,
shake: true,
bounce: true
swapOpacity: true
}

const classList = getClassList(props)
expect(classList.length).toBe(NUM_CLASSES)

expect(classList).toStrictEqual([
'fa-beat',
'fa-fade',
'fa-beat-fade',
'fa-bounce',
'fa-shake',
'fa-spin',
'fa-pulse',
'fa-fw',
'fa-inverse',
'fa-border',
'fa-li',
'fa-shake'
'fa-swap-opacity'
])
})

Expand Down Expand Up @@ -130,19 +135,3 @@ describe('get class list', () => {
})
})
})

test('bounce', () => {
function testBounce(bounce) {
expect(getClassList({ bounce })).toStrictEqual([`fa-${bounce}`])
}

testBounce('bounce')
})

test('shake', () => {
function testShake(shake) {
expect(getClassList({ shake })).toStrictEqual([`fa-${shake}`])
}

testShake('shake')
})
6 changes: 1 addition & 5 deletions src/utils/get-class-list-from-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
export default function classList(props) {
const {
beat,
bounce,
fade,
beatFade,
bounce,
Expand All @@ -19,14 +18,12 @@ export default function classList(props) {
flip,
size,
rotation,
pull,
shake
pull
} = props

// map of CSS class names to properties
const classes = {
'fa-beat': beat,
'fa-bounce': bounce,
'fa-fade': fade,
'fa-beat-fade': beatFade,
'fa-bounce': bounce,
Expand All @@ -46,7 +43,6 @@ export default function classList(props) {
[`fa-rotate-${rotation}`]:
typeof rotation !== 'undefined' && rotation !== null && rotation !== 0,
[`fa-pull-${pull}`]: typeof pull !== 'undefined' && pull !== null,
'fa-shake': shake,
'fa-swap-opacity': props.swapOpacity
}

Expand Down

0 comments on commit 797dd75

Please sign in to comment.