Skip to content
Merged
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
Binary file added docs/#1architecture.png
Comment thread
CocoChart marked this conversation as resolved.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 "#1architecture.png" à une glose
Alors je vois l'image "#1architecture.png" dans la glose
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.replaceAll('#', '%23')}`, {
method: 'PUT',
headers: {
// ETag is the header that carries the current rev.
Expand Down
4 changes: 2 additions & 2 deletions frontend/tests/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,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,
});
});
Expand Down
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