Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
burtek committed Jan 8, 2024
1 parent a819211 commit eed8cd7
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/lib/rules/jsx-no-script-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,24 @@ ruleTester.run('jsx-no-script-url', rule, {
[{ name: 'Foo', props: ['to', 'href'] }],
],
},
{
code: '<Foo to="javascript:"></Foo>',
errors: [{ messageId: 'noScriptURL' }],
settings: {
linkComponents: [
{ name: 'Foo', linkAttributes: ['to'] }
]
},
},
{
code: '<Foo href="javascript:"></Foo>',
errors: [{ messageId: 'noScriptURL' }],
settings: {
linkComponents: [
{ name: 'Foo', linkAttributes: ['to'] }
]
},
},
{
code: `
<div>
Expand All @@ -84,5 +102,27 @@ ruleTester.run('jsx-no-script-url', rule, {
],
],
},
{
code: `
<div>
<Foo href="javascript:"></Foo>
<Bar link="javascript:"></Bar>
</div>
`,
errors: [
{ messageId: 'noScriptURL' },
{ messageId: 'noScriptURL' },
],
options: [
[
{ name: 'Bar', props: ['link'] },
],
],
settings: {
linkComponents: [
{ name: 'Foo', linkAttributes: ['to', 'href'] }
]
},
},
]),
});

0 comments on commit eed8cd7

Please sign in to comment.