• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

atomicpages / pretty-checkbox-react / 11913957799

19 Nov 2024 01:21PM UTC coverage: 100.0%. Remained the same
11913957799

Pull #1202

github

web-flow
build(deps-dev): bump @commitlint/config-conventional

Bumps [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/HEAD/@commitlint/config-conventional) from 17.0.2 to 19.6.0.
- [Release notes](https://github.com/conventional-changelog/commitlint/releases)
- [Changelog](https://github.com/conventional-changelog/commitlint/blob/master/@commitlint/config-conventional/CHANGELOG.md)
- [Commits](https://github.com/conventional-changelog/commitlint/commits/v19.6.0/@commitlint/config-conventional)

---
updated-dependencies:
- dependency-name: "@commitlint/config-conventional"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #1202: build(deps-dev): bump @commitlint/config-conventional from 17.0.2 to 19.6.0

67 of 67 branches covered (100.0%)

Branch coverage included in aggregate %.

172 of 172 relevant lines covered (100.0%)

9.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/components/checkbox/useIndeterminate.ts
1
import * as React from 'react';
3✔
2
import { UseCheckboxState } from './useCheckboxState';
3

4
export type UseIndeterminateOptions = {
5
  checked?: boolean;
6
  state?: UseCheckboxState['state'];
7
  indeterminate?: boolean;
8
};
9

10
export const useIndeterminate = ({
3✔
11
  checked,
12
  state,
13
  indeterminate: indeterminateFromProps,
14
}: UseIndeterminateOptions): {
15
  ref: React.MutableRefObject<HTMLInputElement>;
16
  'aria-checked': React.AriaAttributes['aria-checked'];
17
} => {
18
  const [indeterminate, setStatus] = React.useState(false);
28✔
19
  const ref = React.useRef<HTMLInputElement>(
28✔
20
    null
21
  ) as React.MutableRefObject<HTMLInputElement>;
22

23
  React.useEffect(() => {
28✔
24
    if (state !== undefined && ref.current) {
24✔
25
      setStatus(state === 'indeterminate');
19✔
26
    }
27
  }, [state]);
28

29
  // if a prop is passed mark the indeterminate state
30
  // we should check to ensure state isn't set to indeterminate
31
  // since we don't want ot clobber the state value if
32
  // it is defined.
33
  React.useEffect(() => {
28✔
34
    if (
25✔
35
      state !== 'indeterminate' &&
69✔
36
      ref.current &&
37
      typeof indeterminateFromProps !== 'undefined'
38
    ) {
39
      ref.current.checked = indeterminateFromProps;
1✔
40

41
      // fix needs to come from pretty-checkbox
42
      // ref.current.indeterminate = indeterminateFromProps;
43

44
      setStatus(indeterminateFromProps);
1✔
45
    }
46
  }, [indeterminateFromProps, state]);
47

48
  return {
28✔
49
    ref,
50
    'aria-checked': indeterminate ? 'mixed' : checked,
28✔
51
  };
52
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc