Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private static String demoShellHtml() {
</div>

<form id="upload-form" class="upload-form" enctype="multipart/form-data">
<label class="field-label" for="file-input">Document</label>
<label class="field-label" for="file-input"><span>Document (required)</span></label>
<input id="file-input" name="file" class="file-input" type="file" required />

<div class="actions">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.clearfolio.viewer.controller;

import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;

class ViewerUiRequiredFieldAccessibilityTest {

private WebTestClient webTestClient;

@BeforeEach
void setUp() {
ViewerUiController controller = new ViewerUiController();
webTestClient = WebTestClient.bindToController(controller).build();
}

@Test
void explicitAccessiblePatternForRequiredFormFields() {
webTestClient.get()
.uri("/")
.exchange()
.expectStatus().isOk()
.expectHeader().contentTypeCompatibleWith(MediaType.TEXT_HTML)
.expectBody(String.class)
.value(body -> {
assertTrue(body.contains(
"<label class=\"field-label\" for=\"file-input\">"
+ "<span>Document (required)</span></label>"));
});
}
}
Loading