Skip to content

Commit 9ff3d65

Browse files
Add new test cases to discuss about the fix
1 parent fa6376c commit 9ff3d65

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

docs/rules/no-deprecated-props.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Rule Details
22

3-
This rule enforces to use the recommended API (`ActionList.GroupHeading`) component over the deprecated prop (`title` prop on `ActionList.Group`) for ActionList component.
3+
This rule enforces to use the recommended API (`ActionList.GroupHeading`) component over the deprecated prop (`title` prop on `ActionList.Group`) for ActionList component..
44

55
👎 Examples of **incorrect** code for this rule:
66

src/rules/__tests__/no-deprecated-props.test.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,32 @@ ruleTester.run('no-deprecated-props', rule, {
9090
},
9191
],
9292
},
93+
{
94+
code: `<ActionList.Group title={title}></ActionList.Group>`,
95+
output: `<ActionList.Group><ActionList.GroupHeading>{title}</ActionList.GroupHeading></ActionList.Group>`,
96+
errors: [
97+
{
98+
messageId: 'titlePropDeprecated',
99+
},
100+
],
101+
},
102+
{
103+
code: `<ActionList.Group title={'Title'}></ActionList.Group>`,
104+
output: `<ActionList.Group><ActionList.GroupHeading>Title</ActionList.GroupHeading></ActionList.Group>`,
105+
errors: [
106+
{
107+
messageId: 'titlePropDeprecated',
108+
},
109+
],
110+
},
111+
{
112+
code: `<ActionList.Group title={condition ? 'Title' : undefined}></ActionList.Group>`,
113+
output: `<ActionList.Group><ActionList.GroupHeading>Group heading 1</ActionList.GroupHeading></ActionList.Group>`,
114+
errors: [
115+
{
116+
messageId: 'titlePropDeprecated',
117+
},
118+
],
119+
},
93120
],
94121
})

0 commit comments

Comments
 (0)