Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm. By doing this you will break the figure inclusion in the README.

  • You may instead copy this file with a different name.
  • Moreover, I suppose there are very few people naming a file with a starting hash. You could instead use the hash a symbol for "number" (as it is done frequently in English).

Hence you should preserve docs/architecture.png and copy it as docs/architecture#1.png. OK ?

File renamed without changes
5 changes: 3 additions & 2 deletions frontend/scenarios/add_picture.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ Fonctionnalité: Ajouter une image à une glose

Soit un document dont je suis l'auteur affiché comme glose
Et une session active avec mon compte
Quand j'essaie d'ajouter une image à une glose
Alors je vois l'image "<IMAGE DESCRIPTION>" dans la glose
Quand j'essaie d'ajouter une image "#architecture.png" à une glose
Alors je vois l'image "#architecture.png" dans la glose
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See the previous comment on a more realistic name that includes a hash.

Et l'image a un texte alternatif "<IMAGE DESCRIPTION>"
3 changes: 1 addition & 2 deletions frontend/src/hyperglosae.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ function Hyperglosae(logger) {
reader.readAsArrayBuffer(attachment);
reader.onload = () => {
const arrayBuffer = reader.result;

fetch(`${service}/${id}/${attachment.name}`, {
fetch(`${service}/${id}/${attachment.name.split('#').join('%23')}`, {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

split then join? Well it works, but why not simply use replaceAll?

method: 'PUT',
headers: {
// ETag is the header that carries the current rev.
Expand Down
5 changes: 2 additions & 3 deletions frontend/tests/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,10 @@ Quand("je supprime le lien entre le document principal et la référence", () =>
cy.get(".modal-dialog").get(".btn-primary").click();
});

Quand("j'essaie d'ajouter une image à une glose", () => {
Quand("j'essaie d'ajouter une image {string} à une glose", (imagePath) => {
context = cy.get('.scholium').eq(1);
cy.click_on_contextual_menu_item(context, 'Add a picture...');
cy.get('[id="image-input"]').selectFile('../docs/architecture.png', {
cy.get('[id="image-input"]').selectFile(`../docs/${imagePath}`, {
force: true,
});
});

10 changes: 8 additions & 2 deletions frontend/tests/outcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ Alors("je ne peux pas lire {string}", (text) => {
cy.get('body').should('not.contain', text);
});

Alors("je vois l'image {string} dans la glose", (alternative_text) => {
cy.get('.row:not(.runningHead)>.scholium').should('have.descendants', `img[alt='${alternative_text}']`);
Alors("je vois l'image {string} dans la glose", (image_name) => {
cy.get('.row:not(.runningHead)>.scholium img[src]')
.invoke('attr', 'src')
.should('match', /^http.*:\/\/(?!.*\/#).*/);
});

Alors("l'image a un texte alternatif {string}", (alternative_text) => {
cy.get('.row:not(.runningHead)>.scholium').should('have.descendants', `img[alt='${alternative_text}']`);
});

Alors("je vois l'image {string} dans le document principal", (alternative_text) => {
Expand Down
Loading