mirror of
https://github.com/Hopiu/djLint.git
synced 2026-05-26 21:33:59 +00:00
closes #89. added tests
This commit is contained in:
parent
edcf3506aa
commit
d634ce61fa
2 changed files with 8 additions and 2 deletions
|
|
@ -190,4 +190,5 @@
|
|||
message: Emtpy id and class tags can be removed.
|
||||
flags: re.I
|
||||
patterns:
|
||||
- <(?:\w+)(?:\s(?:(?:{%[^(?:%})]*?%})|(?:{{[^(?:}})]*?}})|[^<>])*)(id|class)(?:(?:=(?:\"{2})|(?:'{2}))|\s)
|
||||
- <\w+\b[^(?:{(?:%|{|#))>]*?\b(class|id)\b=(\"\"|'')
|
||||
- <\w+\b[^(?:{(?:%|{|#))>]*?\b(class|id)\b[^=]
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ run::
|
|||
|
||||
# for a single test
|
||||
|
||||
pytest tests/test_linter.py::test_H025 --cov=src/djlint --cov-branch \
|
||||
pytest tests/test_linter.py::test_H026 --cov=src/djlint --cov-branch \
|
||||
--cov-report xml:coverage.xml --cov-report term-missing
|
||||
|
||||
"""
|
||||
|
|
@ -396,6 +396,11 @@ def test_H026(runner: CliRunner, tmp_file: TextIO) -> None:
|
|||
assert result.exit_code == 1
|
||||
assert "H026" in result.output
|
||||
|
||||
write_to_file(tmp_file.name, b'<asdf {% class="" %}></asdf>')
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 0
|
||||
assert "H026" not in result.output
|
||||
|
||||
|
||||
def test_rules_not_matched_in_ignored_block(
|
||||
runner: CliRunner, tmp_file: TextIO
|
||||
|
|
|
|||
Loading…
Reference in a new issue