Skip to content

Commit eed8cd7

Browse files
committed
Tests
1 parent a819211 commit eed8cd7

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

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

+40
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,24 @@ ruleTester.run('jsx-no-script-url', rule, {
6666
[{ name: 'Foo', props: ['to', 'href'] }],
6767
],
6868
},
69+
{
70+
code: '<Foo to="javascript:"></Foo>',
71+
errors: [{ messageId: 'noScriptURL' }],
72+
settings: {
73+
linkComponents: [
74+
{ name: 'Foo', linkAttributes: ['to'] }
75+
]
76+
},
77+
},
78+
{
79+
code: '<Foo href="javascript:"></Foo>',
80+
errors: [{ messageId: 'noScriptURL' }],
81+
settings: {
82+
linkComponents: [
83+
{ name: 'Foo', linkAttributes: ['to'] }
84+
]
85+
},
86+
},
6987
{
7088
code: `
7189
<div>
@@ -84,5 +102,27 @@ ruleTester.run('jsx-no-script-url', rule, {
84102
],
85103
],
86104
},
105+
{
106+
code: `
107+
<div>
108+
<Foo href="javascript:"></Foo>
109+
<Bar link="javascript:"></Bar>
110+
</div>
111+
`,
112+
errors: [
113+
{ messageId: 'noScriptURL' },
114+
{ messageId: 'noScriptURL' },
115+
],
116+
options: [
117+
[
118+
{ name: 'Bar', props: ['link'] },
119+
],
120+
],
121+
settings: {
122+
linkComponents: [
123+
{ name: 'Foo', linkAttributes: ['to', 'href'] }
124+
]
125+
},
126+
},
87127
]),
88128
});

0 commit comments

Comments
 (0)