microsoft / microsoft/fluentui

Conformance tests for triggers

Open
#21,670 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area: Build System Area: Testing Fluent UI react-components (v9) Resolution: Soft Close
Dominant language
TypeScript
Stars
20.3k
Forks
2.9k
Avg merge
2d 9h
Merged PRs (30d)
46

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the trigger-pattern components and their existing test setup. Add conformance coverage for consistent prop application, customer props taking precedence, and merged internal and user callbacks; done means the described markup and both callback behaviors are verified across applicable components.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.