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

alma-oss / spirit-design-system / 28179456061

25 Jun 2026 02:59PM UTC coverage: 86.433% (+0.9%) from 85.576%
28179456061

Pull #2741

github

crishpeen
fix(web): remove unused mixins and variables
Pull Request #2741: refactor(web,web-react)!: switch toggle to composition markup #DS-564

2639 of 3519 branches covered (74.99%)

Branch coverage included in aggregate %.

67 of 79 new or added lines in 4 files covered. (84.81%)

12 existing lines in 6 files now uncovered.

7223 of 7891 relevant lines covered (91.53%)

209.23 hits per line

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

39.13
/packages/web-react/src/hooks/useDeprecationMessage.ts
1
'use client';
2

3
import { useEffect } from 'react';
246✔
4
import { warning } from '../common/utilities';
246✔
5

6
export interface UseDeprecationMessageProps {
7
  method?: 'component' | 'property' | 'custom';
8
  trigger: boolean;
9
  componentName: string;
10
  componentProps?: {
11
    newName?: string;
12
    delete?: boolean;
13
  };
14
  propertyProps?: {
15
    // Use for property name
16
    deprecatedName?: string;
17
    newName?: string;
18
    delete?: boolean;
19
    // Use for property value
20
    deprecatedValue?: string;
21
    newValue?: string;
22
    propertyName?: string;
23
  };
24
  customText?: string;
25
}
26

27
export const useDeprecationMessage = ({
246✔
28
  method = 'component',
×
29
  trigger,
30
  componentName,
31
  componentProps,
32
  propertyProps,
33
  customText,
34
}: UseDeprecationMessageProps) => {
35
  const messageBase = `Deprecation warning (${componentName}):`;
139✔
36

37
  useEffect(() => {
139✔
38
    const isExecutable = trigger && componentName && process.env.NODE_ENV === 'development';
129✔
39

40
    let message: string | undefined;
41
    let hasProps: boolean;
42

43
    switch (method) {
129!
44
      case 'property':
45
        if (propertyProps?.delete) {
×
46
          message = `${messageBase} "${propertyProps?.deprecatedName}" property will be deleted in the next major version.`;
×
47
        } else if (propertyProps?.deprecatedValue && propertyProps?.newValue && propertyProps?.propertyName) {
×
48
          message = `${messageBase} The "${propertyProps?.deprecatedValue}" value for "${propertyProps?.propertyName}" property will be renamed to "${propertyProps?.newValue}" in the next major version.`;
×
49
        } else {
50
          message = `${messageBase} "${propertyProps?.deprecatedName}" property will be replaced in the next major version. Please use "${propertyProps?.newName}" instead. ♻️️`;
×
51
        }
52
        hasProps = !!propertyProps;
×
53
        break;
×
54

55
      case 'custom':
56
        message = `${messageBase} ${customText}`;
129✔
57
        hasProps = true;
129✔
58
        break;
129✔
59

60
      case 'component':
61
      default:
62
        if (componentProps?.delete) {
×
63
          message = `${messageBase} The component and its subcomponents will be deleted in the next major version.`;
×
64
        } else {
65
          message = `${messageBase} The component and its subcomponents will be renamed to "${componentProps?.newName}" in the next major version.`;
×
66
        }
67
        hasProps = !!componentProps;
×
68
        break;
×
69
    }
70

71
    if (message && isExecutable && hasProps) {
129!
UNCOV
72
      warning(false, message);
×
73
    }
74

75
    // eslint-disable-next-line react-hooks/exhaustive-deps -- We want to call this hook only once
76
  }, []);
77
};
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

© 2026 Coveralls, Inc