Skip to content

Commit

Permalink
[Tests] jsx-no-script-url: Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
radu2147 authored and ljharb committed Nov 4, 2024
1 parent d1556a3 commit 4ef92b4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
### Fixed
* [`no-danger`]: avoid a crash on a nested component name ([#3833][] @ljharb)

### Changed
* [Tests] [`jsx-no-script-url`]: Improve tests ([#3849][] @radu2147)

[#3849]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3849
[#3833]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3833

## [7.37.2] - 2024.10.22
Expand Down
11 changes: 11 additions & 0 deletions tests/lib/rules/jsx-no-script-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ ruleTester.run('jsx-no-script-url', rule, {
{ code: '<a href={"javascript:"}></a>' },
{ code: '<Foo href="javascript:"></Foo>' },
{ code: '<a href />' },
{
code: '<Foo other="javascript:"></Foo>',
options: [[{ name: 'Foo', props: ['to', 'href'] }]],
},
{
code: '<Foo href="javascript:"></Foo>',
settings: {
Expand All @@ -51,6 +55,13 @@ ruleTester.run('jsx-no-script-url', rule, {
linkComponents: [{ name: 'Foo', linkAttribute: ['to', 'href'] }],
},
},
{
code: '<Foo other="javascript:"></Foo>',
options: [[], { includeFromSettings: true }],
settings: {
linkComponents: [{ name: 'Foo', linkAttribute: ['to', 'href'] }],
},
},
]),
invalid: parsers.all([
// defaults
Expand Down

0 comments on commit 4ef92b4

Please sign in to comment.