Skip to content

Conversation

@JasonGore
Copy link
Member

@JasonGore JasonGore commented May 8, 2018

Pull request checklist

Description of changes

Deprecate Persona's primaryText prop. Add new 'text' prop. Replace all usages in codebase. Add Deprecation guidelines.

Focus areas to test

Persona and PersonaCoin's use of primaryText and text props.

@dzearing
Copy link
Member

dzearing commented May 9, 2018

@mtennoe , @jakob101, @Markionium The PR here is one of a few places where we render "primary text", but the prop isn't called "text". We have a few places where the "text" you provide is called different things, so we want to standardize on the "text" prop. (Obviously, primaryText will still work, but we want to clean things up for as much predictability as possible. Let us know if you have any concerns.

@Markionium
Copy link
Member

Markionium commented May 9, 2018

Seems ok with me, i don't really see any specific reason why we would have any objections. We'll obviously have to migrate over on our side.

[edit] Marius/Jakob, i created a work item on us for this :)

@JasonGore
Copy link
Member Author

@Markionium Please let me know if you run into any issues whatsoever with backwards compatibility. I've added as many tests on old behavior as possible to catch any issues, so if I miss anything I want to make sure I modify our process and guidelines appropriately. Thanks 😄

});

beforeAll(() => {
Utilities.warnDeprecations = jest.fn().mockImplementation(() => { /** no impl **/ });
Copy link
Contributor

Choose a reason for hiding this comment

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

in my testing, commenting line 17-23 doesn't cause the test to fail..

Copy link
Contributor

Choose a reason for hiding this comment

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

So the problem is you called the file .text.tsx

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch, that caught a backwards compatibility bug too. Shows the tests are working as intended 😄


```tsx
// Prevent warn deprecations from failing test
const Utilities = require('@uifabric/utilities/lib/warn');
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't be using require here. Amongst other things, Utilities will not be typed as a result.

Recommend:

import * as Utilities from '@uifabric/utilities/lib/warn';
jest.spyOn(Utilities, 'warnDeprecations').mockImplementation(() => { /** no impl **/ });

The only thing I'm a little less sure about is whether there is a need to cleanup the mock after the fact, as the mock seems localized to the tests within the file/module only.

If you do a beforeEach/afterEach reset though, you can then have asserts again warnDeprecation being triggered.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I think this should also be mockReset and not mockClear

Copy link
Member Author

Choose a reason for hiding this comment

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

Does anybody know of a way to spyOn or mock exported modules from index modules like Utilities.ts? I don't like using the full path show above as most test imports are using import { setRTL } from '../../Utilities'; but I haven't found a workaround yet.

@cliffkoh cliffkoh dismissed their stale review May 9, 2018 23:00

Removing block

@mtennoe
Copy link
Member

mtennoe commented May 10, 2018

No objections from my side about doing this. Aligning on consistent coding names and patterns is important, and it only needs a minor change when consuming the updated version

@JasonGore JasonGore merged commit 84d82e8 into microsoft:master May 10, 2018
Markionium added a commit to Markionium/office-ui-fabric-react that referenced this pull request May 13, 2018
…i-fabric-react into parallel-tsc

* 'parallel-tsc' of https://github.com/Markionium/office-ui-fabric-react:
  Variants: have project use OUFR instead of just styling (microsoft#4854)
  Add more customization hooks to ProgressIndicator (microsoft#4566)
  Issue#4832: Break BaseButton Types hard dependency from class ContextualMenu (microsoft#4845)
  Applying package updates.
  Revert react portals change (microsoft#4840)
  Update ImageOverview.md
  Fixes duplicate reading of suggestions on people picker (microsoft#4765)
  Persona: Deprecate primaryText (microsoft#4811)
  Experiments: Fix Fluent theme color names (microsoft#4834)
  Applying package updates.
  Add JasonGore to command bar codeowners
  Fix index import (microsoft#4826)
  Added overflowMenuProps property to CommandBar (microsoft#4818)
  Fluent theme: Fix imports to use relative paths (microsoft#4831)
  ContextualMenuItem: adding secondaryText (microsoft#4788)
  ComboBox: Option Performance Optimization (microsoft#4782)
Markionium added a commit to Markionium/office-ui-fabric-react that referenced this pull request May 13, 2018
* master: (95 commits)
  Variants: have project use OUFR instead of just styling (microsoft#4854)
  Add more customization hooks to ProgressIndicator (microsoft#4566)
  Issue#4832: Break BaseButton Types hard dependency from class ContextualMenu (microsoft#4845)
  Applying package updates.
  Revert react portals change (microsoft#4840)
  Update ImageOverview.md
  Fixes duplicate reading of suggestions on people picker (microsoft#4765)
  Persona: Deprecate primaryText (microsoft#4811)
  Experiments: Fix Fluent theme color names (microsoft#4834)
  Applying package updates.
  Add JasonGore to command bar codeowners
  Fix index import (microsoft#4826)
  Added overflowMenuProps property to CommandBar (microsoft#4818)
  Fluent theme: Fix imports to use relative paths (microsoft#4831)
  ContextualMenuItem: adding secondaryText (microsoft#4788)
  ComboBox: Option Performance Optimization (microsoft#4782)
  Marqueeselection style update (microsoft#4803)
  Applying package updates.
  FocusZone: Add the ability to stop focus from propagating outside the FocusZone (microsoft#4823)
  Unknown persona coin (microsoft#4809)
  ...
@JasonGore JasonGore deleted the jagore/deprecate-persona-primaryText branch May 29, 2018 16:08
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standardize on "text", "secondaryText", and "tertiaryText"

7 participants