Skip to content

Feat/6633 test que le html qu'on génère est toujours valide#6775

Open
artragis wants to merge 32 commits into
zestedesavoir:devfrom
artragis:feat/6633_test_html
Open

Feat/6633 test que le html qu'on génère est toujours valide#6775
artragis wants to merge 32 commits into
zestedesavoir:devfrom
artragis:feat/6633_test_html

Conversation

@artragis

Copy link
Copy Markdown
Member

Fix #6633

J'ai configuré un tool qui est assez commun en python pour faire de la validation.
Ensuite j'ai commencé à faire les petits fix qui fallait.

QA:

Attendre que la CI passe, je pense.

@Situphen
Situphen self-requested a review December 28, 2025 18:17
@github-project-automation github-project-automation Bot moved this to En développement in Suivi des PR Dec 28, 2025
@Situphen
Situphen removed their request for review December 29, 2025 11:59
@coveralls

coveralls commented Jan 23, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 89.49% (+0.01%) from 89.476% — artragis:feat/6633_test_html into zestedesavoir:dev

@Arnaud-D Arnaud-D left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je n'ai pas tout testé en détail (il y a des changements qui nécessiteraient de regarder le fonctionnel attentivement), mais j'ai vu quelques soucis.

{% captureas alert_link %}{{ edit_link }}{% endcaptureas %}
{% captureas hide_link %}{{ edit_link|trim }}{% endcaptureas %}
{% captureas show_link %}{{ edit_link|trim }}{% endcaptureas %}
{% captureas alert_link %}{{ edit_link|trim }}{% endcaptureas %}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je pense que trim n'est pas la meilleure solution pour le problème avec des retours à la ligne ou autres espaces dans les URL.

Dans le cas présent (et d'autres endroits du code), le problème, c'est qu'on utilise captureas pour avoir des variables dans le template qu'on devrait juste avoir avec une méthode dans le code. Ici, ça devrait être quelque chose du type message.url_of_edit_link. Cette méthode retournerait quelque chose de propre et nous éviterait de programmer dans le template pour rien.

{% include "misc/member_item.part.html" with member=authors.first author=True avatar=True deletable=False %}
</li>
{% else %}
{% elif authors %}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai l'impression que ça ne change rien par rapport à avant, parce que quand authors est vide, il ne s'affiche rien. Ou alors c'est une question de style ?

"member_login_url": reverse("member-login")
+ "?next="
+ quote(full_path)
+ quote_plus(full_path)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quitte à toucher ce genre de choses, peut-être utiliser l'argument query de reverse ? Ça permet de faire des URL avec des paramètres. Détails dans la doc.

"member_login_url": reverse("member-login")
+ "?next="
+ quote(full_path)
+ quote_plus(full_path)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quitte à toucher ce genre de cas, peut-être utiliser l'argument query de reverse ? Ça permet de faire des URL avec des paramètres. Détails dans la doc.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je connaissais pas bien vu

Comment on lines +68 to +69
msg = _('<p>Pas assez de place ? <a href="{}?title={}&amp;{}">Envoyez un MP {}</a> !').format(
reverse("mp:create"), quote_plus(pm_title), usernames, plural

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Un autre cas pour le paramètre query de reverse, je pense.

Comment on lines +449 to +456
def add_extract_url(self):
root_content = self.top_container()
if self.parent.is_top_container:
return reverse("content:create-extract", args=[root_content.pk, root_content.slug, self.slug])
return reverse("content:create-extract", args=[root_content.pk, root_content.slug, self.parent.slug, self.slug])

@property
def add_container_url(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pas super fan du nommage ici, parce que ça peut être lu comme "add_(extract_url)" alor que c'est "(add_extract)_url". L'anglais ne nous aide pas ici, mais peut-être qu'il faudrait être un peu plus verbeux avec un truc du type "url_to_add_extract" ou quelque chose du genre. Les mots de liaison ne sont pas interdits en anglais. :D

Comment thread zds/tests/common.py
return response


class ZdsTestCase(TestCase):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est-ce que cette validation rallonge la suite de tests significativement ? Est-ce que tu as observé un changement à ce niveau-là ou non ?

<div class="picto">
<div class="picto-hexagon">
<img src="/static/images/logo-library.png" />
<img src="/static/images/logo-library.png" alt="Logo de la bibliothèque ZDS"/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour des images purement décoratives, je crois que la recommandation pour l'accessibilité est alt="" (et éventuellement un rôle en plus). J'ai trouvé un doc W3C qui en parle.

Tu peux confirmer que c'est toujours une bonne recommandation @AmauryCarrade ?

Comment on lines +8 to +29
<div class="content-header-container">
<h2 id="{{ child.position_in_parent }}-{{ child.slug }}"
{% if not child.is_validable %}
class="not-ready title-with-buttons"
{% else %}
class="title-with-buttons"
{% endif %}>
<a href="{{ base_url }}{{ child.get_url_path }}">{{ child.title }}</a>
</h2>
{% if display_config.draft_actions.enable_edit %}
<div class="actions-title">
<a href="{{ child.get_edit_url }}" class="ico-after edit btn btn-grey">
{% trans "Éditer" %}
</a>
<a href="#move-{{ child.slug }}" class="open-modal ico-after move btn btn-grey">{% trans "Déplacer" %}</a>
<ul>
<li>
<a href="{{ child.get_edit_url }}" class="ico-after edit btn btn-grey">{% trans "Éditer" %}</a>
</li>
<li>
<a href="#move-{{ child.slug }}" class="open-modal ico-after move btn btn-grey">{% trans "Déplacer" %}</a>
</li>
<li>
{% include "tutorialv2/includes/sidebar/delete.part.html" with object=child additional_classes="ico-after cross btn btn-grey" %}
</li>
</ul>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je ne sais pas si c'est cette modif précisément ou une autre, mais ça casse le design :

Image

Comment on lines +88 to +97
<h2 class="title-with-buttons">
{% url "content:create-extract" content.pk content.slug as create_extract_url %}
<a class="force-blue" href="{{ create_extract_url }}">
{% trans "Ajouter une section" %}
</a>
<div class="actions-title">
<span class="actions-title">
<a href="{{ create_extract_url }}" class="ico-after more btn btn-grey">
{% trans "Ajouter" %}
</a>
</div>
</span>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Design cassé ici également. Le bouton est devenu très long.

Image

@github-project-automation github-project-automation Bot moved this from En développement to Modification demandée in Suivi des PR Feb 28, 2026
@artragis
artragis force-pushed the feat/6633_test_html branch from bf08987 to 8a360e5 Compare July 14, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Modification demandée

Development

Successfully merging this pull request may close these issues.

Identifier des outils automatisés pour tester la validité du HTML

4 participants