Skip to content

Commit 4ef92b4

Browse files
radu2147ljharb
authored andcommitted
[Tests] jsx-no-script-url: Improve tests
1 parent d1556a3 commit 4ef92b4

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
99
### Fixed
1010
* [`no-danger`]: avoid a crash on a nested component name ([#3833][] @ljharb)
1111

12+
### Changed
13+
* [Tests] [`jsx-no-script-url`]: Improve tests ([#3849][] @radu2147)
14+
15+
[#3849]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3849
1216
[#3833]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3833
1317

1418
## [7.37.2] - 2024.10.22

tests/lib/rules/jsx-no-script-url.js

+11
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ ruleTester.run('jsx-no-script-url', rule, {
3838
{ code: '<a href={"javascript:"}></a>' },
3939
{ code: '<Foo href="javascript:"></Foo>' },
4040
{ code: '<a href />' },
41+
{
42+
code: '<Foo other="javascript:"></Foo>',
43+
options: [[{ name: 'Foo', props: ['to', 'href'] }]],
44+
},
4145
{
4246
code: '<Foo href="javascript:"></Foo>',
4347
settings: {
@@ -51,6 +55,13 @@ ruleTester.run('jsx-no-script-url', rule, {
5155
linkComponents: [{ name: 'Foo', linkAttribute: ['to', 'href'] }],
5256
},
5357
},
58+
{
59+
code: '<Foo other="javascript:"></Foo>',
60+
options: [[], { includeFromSettings: true }],
61+
settings: {
62+
linkComponents: [{ name: 'Foo', linkAttribute: ['to', 'href'] }],
63+
},
64+
},
5465
]),
5566
invalid: parsers.all([
5667
// defaults

0 commit comments

Comments
 (0)