fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

Conformance tests for triggers

Open layershifter opened this issue 3 years ago • 3 comments

Recently we had various discussions around triggers and reached the agreement on how it should work:

  • No magic handling of props in triggers, props should be applied always. I.e consistently set the same attributes and props
  • child.props always win, it is user's responsibility to handle it
    • The exclusion from the rule are callbacks, they are merged

Another point that we could cover that contract with conformance tests and enable them for components that use the trigger pattern. For an initial implementation the following scenarios should be covered.

Props merging

Props specified by a customer always win.

function App() {
  return (
    <Trigger>
      <button id="foo" aria-label="bar" />
    </Trigger>
  );
}

This should render following markup:

<button id="foo" aria-label="bar"></button>

Callback merging

Internal and user's callbacks should be merged.

function App() {
  return (
    <Trigger>
      <button onClick={() => console.log('foo') />
    </Trigger>
  );
}
  • internal onClick handler in Trigger should be called if present
  • onClick specified by user should be also called

layershifter avatar Feb 09 '22 17:02 layershifter

This is needed as there are tests which are already copy&paste.

miroslavstastny avatar Aug 04 '22 09:08 miroslavstastny

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

msft-fluent-ui-bot avatar Jan 01 '23 10:01 msft-fluent-ui-bot

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

msft-fluent-ui-bot avatar Jun 02 '23 10:06 msft-fluent-ui-bot

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.