Skip to content

Commit

Permalink
test(react): clean up persona-coin test and use isConformant without …
Browse files Browse the repository at this point in the history
…side-effects
  • Loading branch information
Hotell committed Nov 9, 2022
1 parent 3c0b275 commit e6fc681
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1,851 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "test(react): clean up persona-coin test and use isConformant without side-effects",
"packageName": "@fluentui/react",
"email": "[email protected]",
"dependentChangeType": "none"
}
20 changes: 2 additions & 18 deletions packages/react/src/components/Persona/Persona.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { mount, ReactWrapper } from 'enzyme';
import { getIcon } from '../../Styling';
import { PersonaPresence, PersonaSize } from './index';
import { isConformant } from '../../common/isConformant';
import type { IRenderFunction } from '../../Utilities';
import type { IPersonaSharedProps, IPersonaProps, IPersonaCoinProps } from './index';
import type { IPersonaSharedProps, IPersonaCoinProps } from './index';
import { wrapPersona } from './test-utils';

const testImage1x1 =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQImWP4DwQACfsD/eNV8pwAAAAASUVORK5CYII=';
Expand All @@ -21,22 +21,6 @@ const STYLES = {
red: '.ms-Persona-initials--red',
};

/**
* function to override the default onRender callbacks
*/
export const wrapPersona = (
example: IPersonaSharedProps,
shouldWrapPersonaCoin: boolean = false,
): ((coinProps: IPersonaProps, defaultRenderer: IRenderFunction<IPersonaProps>) => JSX.Element | null) => {
return (coinProps, defaultCoinRenderer): JSX.Element | null => {
return shouldWrapPersonaCoin ? (
<span id="persona-coin-container">{defaultCoinRenderer(coinProps)}</span>
) : (
defaultCoinRenderer(coinProps)
);
};
};

const customOnRenderPersonaFunction = (props: IPersonaCoinProps): JSX.Element | null => {
return <Icon iconName="Dictionary" />;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { create } from '@fluentui/utilities/lib/test';
import { setRTL } from '../../../Utilities';
import { PersonaCoin } from './PersonaCoin';
import { wrapPersona } from '../Persona.test';
import { wrapPersona } from '../test-utils';

const testImage1x1 =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQImWP4DwQACfsD/eNV8pwAAAAASUVORK5CYII=';
Expand Down
Loading

0 comments on commit e6fc681

Please sign in to comment.