Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(incomplete) new failing test, <a target="_blank noopener"> #3457

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
new failing test
this test is derived from a real bug in a project,
  in which the intention was to get it right
  but the bug causes "two wrongs make a right"

this one failing test is intended to illustrate an entire class of possible failures
  which are neither detected nor thoroughly represented

and although the apparent *intention* of the "bad" code is
  `target="_blank"` the *effect* is not, so unless the browser DWIMs it
  then the jsx-no-target-blank rule is technically not violated
  • Loading branch information
mcast authored Oct 11, 2022
commit 19d4491fd063f87cfe934270420152c7389f673f
5 changes: 5 additions & 0 deletions tests/lib/rules/jsx-no-target-blank.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ ruleTester.run('jsx-no-target-blank', rule, {
output: '<a target="_blank" rel="no referrer noreferrer" href="https://example.com/7"></a>',
errors: defaultErrors,
},
{
code: '<a href="https://example.com/7a-run-on" target="_blank rel=noopener"></a>'
output: '<a target="_blank noopener" href="https://example.com/7a-run-on"></a>',
errors: [{ messageId: 'noTargetBlankIntendedIneffective' }],
},
{
code: '<a target="_BLANK" href="https://example.com/8"></a>',
output: '<a target="_BLANK" href="https://example.com/8" rel="noreferrer"></a>',
Expand Down