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 30cca55 commit 96c1ede
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/lib/rules/jsx-no-script-url.js
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 96c1ede

Please sign in to comment.