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

atomicpages / pretty-checkbox-react / 10812249919

11 Sep 2024 01:04PM UTC coverage: 100.0%. Remained the same
10812249919

Pull #1165

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.5.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.5.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 #1165: build(deps-dev): bump @commitlint/config-conventional from 17.0.2 to 19.5.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/switch/useAriaChecked.ts
1
import * as React from 'react';
2✔
2
import { PCRSwitchProps } from '../../typings/PCRSwitchProps';
3

4
export type UseAriaCheckedOptions = {
5
  setState?: PCRSwitchProps['setState'];
6
  checked?: PCRSwitchProps['checked'];
7
};
8

9
const handler = (e: any) => {
2✔
10
  e.currentTarget.setAttribute('aria-checked', e.currentTarget.checked + '');
2✔
11
};
12

13
/**
14
 * A small hook to help manage correct aria-checked state when switch
15
 * is used as an uncontrolled component. We need this to run
16
 * for a11y purposes. FOr the `switch` role, `aria-checked` is required.
17
 */
18
export const useAriaChecked = ({
2✔
19
  setState,
20
  checked,
21
}: UseAriaCheckedOptions) => {
22
  const ref = React.useRef<HTMLInputElement>(null);
7✔
23

24
  React.useEffect(() => {
7✔
25
    const elem = ref.current;
7✔
26
    let bound = false;
7✔
27

28
    if (!setState && !checked && elem) {
7✔
29
      elem.setAttribute('aria-checked', elem.checked + '');
4✔
30
      elem.addEventListener('change', handler);
4✔
31
      bound = true;
4✔
32
    }
33

34
    return () => {
7✔
35
      if (bound && elem) {
7✔
36
        elem.removeEventListener('change', handler);
4✔
37
      }
38
    };
39
  }, [setState, checked]);
40

41
  return ref;
7✔
42
};
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