mirror of
https://github.com/Hopiu/djLint.git
synced 2026-05-10 06:34:42 +00:00
fixed #116, added test
This commit is contained in:
parent
17e29a79cf
commit
3ab0eab278
3 changed files with 13 additions and 2 deletions
|
|
@ -4,6 +4,7 @@ Changelog
|
|||
next release
|
||||
-----------
|
||||
- Added require_pragma option
|
||||
- Updated DJ018 to catch ``data-src`` and ``action`` on inputs
|
||||
|
||||
0.5.7
|
||||
-----
|
||||
|
|
|
|||
|
|
@ -133,14 +133,14 @@
|
|||
message: (Django) Internal links should use the {% url ... %} pattern.
|
||||
flags: re.DOTALL|re.I
|
||||
patterns:
|
||||
- <(?:a|div|span|input)\s+?[^>]*?(?:href|data-url)=[\"|'](?!(?:https?://)|javascript:|on\w+:)[\w|/]+
|
||||
- <(?:a|div|span|input)\s+?[^>]*?(?:href|data-url|data-src|action)=[\"|'](?!(?:https?://)|javascript:|on\w+:)[\w|/]+
|
||||
- <form\s+?[^>]*?(?:action)=[\"|'](?!(?:https?://)|javascript:|on\w+:)[\w|/]+
|
||||
- rule:
|
||||
name: J018
|
||||
message: (Jinja) Internal links should use the {{ url_for() ... }} pattern.
|
||||
flags: re.DOTALL|re.I
|
||||
patterns:
|
||||
- <(?:a|div|span|input)\s+?[^>]*?(?:href|data-url)=[\"|'](?!(?:https?://)|javascript:|on\w+:)[\w|/]+
|
||||
- <(?:a|div|span|input)\s+?[^>]*?(?:href|data-url|data-src|action)=[\"|'](?!(?:https?://)|javascript:|on\w+:)[\w|/]+
|
||||
- <form\s+?[^>]*?(?:action)=[\"|'](?!(?:https?://)|javascript:|on\w+:)[\w|/]+
|
||||
- rule:
|
||||
name: H019
|
||||
|
|
|
|||
|
|
@ -254,6 +254,16 @@ def test_DJ018(runner: CliRunner, tmp_file: TextIO) -> None:
|
|||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 0
|
||||
|
||||
# test data-src
|
||||
write_to_file(
|
||||
tmp_file.name,
|
||||
b'<div class="em-ajaxLogs" data-src="/table/task/{{ t.id }}/log"></div>',
|
||||
)
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 1
|
||||
assert "D018 1:" in result.output
|
||||
assert "J018 1:" in result.output
|
||||
|
||||
|
||||
def test_H019(runner: CliRunner, tmp_file: TextIO) -> None:
|
||||
write_to_file(tmp_file.name, b"<a href='javascript:abc()'>asdf</a>")
|
||||
|
|
|
|||
Loading…
Reference in a new issue