mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-29 18:55:49 +00:00
data-cy adicionados
This commit is contained in:
parent
e7592f4d64
commit
6a34f1f017
10 changed files with 34 additions and 30 deletions
|
@ -8,8 +8,8 @@
|
|||
<label class="col-sm-2 control-label" th:text="${label}">Label</label>
|
||||
<div class="col-sm-10">
|
||||
<div th:switch="${type}">
|
||||
<input th:case="'text'" class="form-control" type="text" th:field="*{__${name}__}" />
|
||||
<input th:case="'date'" class="form-control" type="date" th:field="*{__${name}__}"/>
|
||||
<input th:data-cy="${name}" th:case="'text'" class="form-control" type="text" th:field="*{__${name}__}" />
|
||||
<input th:data-cy="${name}" th:case="'date'" class="form-control" type="date" th:field="*{__${name}__}"/>
|
||||
</div>
|
||||
<span th:if="${valid}"
|
||||
class="fa fa-ok form-control-feedback"
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
<nav class="navbar navbar-expand-lg navbar-dark" role="navigation">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" th:href="@{/}"><span></span></a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#main-navbar">
|
||||
<a data-cy="navbar-brand" class="navbar-brand" th:href="@{/}"><span></span></a>
|
||||
<button data-cy="navbar-toggler" class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#main-navbar">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="main-navbar" style>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<ul class="navbar-nav me-auto mb-2 mb-lg-0" th:remove="all">
|
||||
|
||||
<li th:fragment="menuItem (link,active,title,glyph,text)" th:class="nav-item">
|
||||
<a th:class="${active==menu ? 'nav-link active' : 'nav-link'}" th:href="@{__${link}__}" th:title="${title}">
|
||||
<a th:data-cy="${title}" th:class="${active==menu ? 'nav-link active' : 'nav-link'}" th:href="@{__${link}__}" th:title="${title}">
|
||||
<span th:class="'fa fa-'+${glyph}" class="fa fa-home"></span>
|
||||
<span th:text="${text}">Template</span>
|
||||
</a>
|
||||
|
@ -45,17 +45,17 @@
|
|||
|
||||
<ul class="nav navbar-nav me-auto">
|
||||
|
||||
<li th:replace="~{::menuItem ('/','home','home page','home','Home')}">
|
||||
<li data-cy="home" th:replace="~{::menuItem ('/','home','home page','home','Home')}">
|
||||
<span class="fa fa-home" aria-hidden="true"></span>
|
||||
<span>Home</span>
|
||||
</li>
|
||||
|
||||
<li th:replace="~{::menuItem ('/owners/find','owners','find owners','search','Find owners')}">
|
||||
<li data-cy="find-owners" th:replace="~{::menuItem ('/owners/find','owners','find owners','search','Find owners')}">
|
||||
<span class="fa fa-search" aria-hidden="true"></span>
|
||||
<span>Find owners</span>
|
||||
</li>
|
||||
|
||||
<li th:replace="~{::menuItem ('/vets.html','vets','veterinarians','th-list','Veterinarians')}">
|
||||
<li data-cy="veterinarians" th:replace="~{::menuItem ('/vets.html','vets','veterinarians','th-list','Veterinarians')}">
|
||||
<span class="fa fa-th-list" aria-hidden="true"></span>
|
||||
<span>Veterinarians</span>
|
||||
</li>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<div class="col-sm-10">
|
||||
<select th:field="*{__${name}__}">
|
||||
<option th:each="item : ${items}" th:value="${item}"
|
||||
<option th:data-cy="${item}" th:each="item : ${items}" th:value="${item}"
|
||||
th:text="${item}">dog</option>
|
||||
</select>
|
||||
<span th:if="${valid}"
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<button
|
||||
data-cy="add-owner"
|
||||
th:with="text=${owner['new']} ? 'Add Owner' : 'Update Owner'"
|
||||
class="btn btn-primary" type="submit" th:text="${text}">Add
|
||||
Owner</button>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<div class="control-group" id="lastNameGroup">
|
||||
<label class="col-sm-2 control-label">Last name </label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" th:field="*{lastName}" size="30"
|
||||
<input data-cy="last-name-input-find-owners" class="form-control" th:field="*{lastName}" size="30"
|
||||
maxlength="80" /> <span class="help-inline"><div
|
||||
th:if="${#fields.hasAnyErrors()}">
|
||||
<p th:each="err : ${#fields.allErrors()}" th:text="${err}">Error</p>
|
||||
|
@ -21,12 +21,12 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<button type="submit" class="btn btn-primary">Find
|
||||
<button data-cy="find-owner-button" type="submit" class="btn btn-primary">Find
|
||||
Owner</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a class="btn btn-primary" th:href="@{/owners/new}">Add Owner</a>
|
||||
<a class="btn btn-primary" data-cy="add-owner-find-owners" th:href="@{/owners/new}">Add Owner</a>
|
||||
|
||||
</form>
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
<a th:href="@{__${owner.id}__/edit}" class="btn btn-primary">Edit
|
||||
<a data-cy="edit-owner" th:href="@{__${owner.id}__/edit}" class="btn btn-primary">Edit
|
||||
Owner</a>
|
||||
<a th:href="@{__${owner.id}__/pets/new}" class="btn btn-primary">Add
|
||||
<a data-cy="add-new-pet" th:href="@{__${owner.id}__/pets/new}" class="btn btn-primary">Add
|
||||
New Pet</a>
|
||||
|
||||
<br />
|
||||
|
@ -65,8 +65,8 @@
|
|||
<td th:text="${visit?.description}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a th:href="@{__${owner.id}__/pets/__${pet.id}__/edit}">Edit Pet</a></td>
|
||||
<td><a th:href="@{__${owner.id}__/pets/__${pet.id}__/visits/new}">Add Visit</a></td>
|
||||
<td><a data-cy="edit-pet-a" th:href="@{__${owner.id}__/pets/__${pet.id}__/edit}">Edit Pet</a></td>
|
||||
<td><a data-cy="add-visit-a" th:href="@{__${owner.id}__/pets/__${pet.id}__/visits/new}">Add Visit</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<tbody>
|
||||
<tr th:each="owner : ${listOwners}">
|
||||
<td>
|
||||
<a th:href="@{/owners/__${owner.id}__}" th:text="${owner.firstName + ' ' + owner.lastName}"/></a>
|
||||
<a data-cy="owner-link" th:href="@{/owners/__${owner.id}__}" th:text="${owner.firstName + ' ' + owner.lastName}"/></a>
|
||||
</td>
|
||||
<td th:text="${owner.address}"/>
|
||||
<td th:text="${owner.city}"/>
|
||||
|
@ -32,27 +32,27 @@
|
|||
<span>Pages:</span>
|
||||
<span>[</span>
|
||||
<span th:each="i: ${#numbers.sequence(1, totalPages)}">
|
||||
<a th:if="${currentPage != i}" th:href="@{'/owners?page=' + ${i}}">[[${i}]]</a>
|
||||
<a data-cy="pagination-button" th:if="${currentPage != i}" th:href="@{'/owners?page=' + ${i}}">[[${i}]]</a>
|
||||
<span th:unless="${currentPage != i}">[[${i}]]</span>
|
||||
</span>
|
||||
<span>] </span>
|
||||
<span>
|
||||
<a th:if="${currentPage > 1}" th:href="@{'/owners?page=1'}" title="First"
|
||||
<a data-cy="first-button" th:if="${currentPage > 1}" th:href="@{'/owners?page=1'}" title="First"
|
||||
class="fa fa-fast-backward"></a>
|
||||
<span th:unless="${currentPage > 1}" title="First" class="fa fa-fast-backward"></span>
|
||||
</span>
|
||||
<span>
|
||||
<a th:if="${currentPage > 1}" th:href="@{'/owners?page=__${currentPage - 1}__'}" title="Previous"
|
||||
<a data-cy="previous-button" th:if="${currentPage > 1}" th:href="@{'/owners?page=__${currentPage - 1}__'}" title="Previous"
|
||||
class="fa fa-step-backward"></a>
|
||||
<span th:unless="${currentPage > 1}" title="Previous" class="fa fa-step-backward"></span>
|
||||
</span>
|
||||
<span>
|
||||
<a th:if="${currentPage < totalPages}" th:href="@{'/owners?page=__${currentPage + 1}__'}" title="Next"
|
||||
<a data-cy="next-button" th:if="${currentPage < totalPages}" th:href="@{'/owners?page=__${currentPage + 1}__'}" title="Next"
|
||||
class="fa fa-step-forward"></a>
|
||||
<span th:unless="${currentPage < totalPages}" title="Next" class="fa fa-step-forward"></span>
|
||||
</span>
|
||||
<span>
|
||||
<a th:if="${currentPage < totalPages}" th:href="@{'/owners?page=__${totalPages}__'}" title="Last"
|
||||
<a data-cy="last-button" th:if="${currentPage < totalPages}" th:href="@{'/owners?page=__${totalPages}__'}" title="Last"
|
||||
class="fa fa-fast-forward"></a>
|
||||
<span th:unless="${currentPage < totalPages}" title="Last" class="fa fa-step-forward"></span>
|
||||
</span>
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
Pet
|
||||
</h2>
|
||||
<form th:object="${pet}" class="form-horizontal" method="post">
|
||||
<input type="hidden" name="id" th:value="*{id}" />
|
||||
<input
|
||||
data-cy="id-input"
|
||||
type="hidden" name="id" th:value="*{id}" />
|
||||
<div class="form-group has-feedback">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">Owner</label>
|
||||
|
@ -26,6 +28,7 @@
|
|||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<button
|
||||
data-cy="add-pet"
|
||||
th:with="text=${pet['new']} ? 'Add Pet' : 'Update Pet'"
|
||||
class="btn btn-primary" type="submit" th:text="${text}">Add
|
||||
Pet</button>
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<input type="hidden" name="petId" th:value="${pet.id}" />
|
||||
<button class="btn btn-primary" type="submit">Add Visit</button>
|
||||
<input data-cy="id-input" type="hidden" name="petId" th:value="${pet.id}" />
|
||||
<button data-cy="add-visit-button" class="btn btn-primary" type="submit">Add Visit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -28,27 +28,27 @@
|
|||
<span>Pages:</span>
|
||||
<span>[</span>
|
||||
<span th:each="i: ${#numbers.sequence(1, totalPages)}">
|
||||
<a th:if="${currentPage != i}" th:href="@{'/vets.html?page=__${i}__'}">[[${i}]]</a>
|
||||
<a data-cy="vets-pagination-button" th:if="${currentPage != i}" th:href="@{'/vets.html?page=__${i}__'}">[[${i}]]</a>
|
||||
<span th:unless="${currentPage != i}">[[${i}]]</span>
|
||||
</span>
|
||||
<span>] </span>
|
||||
<span>
|
||||
<a th:if="${currentPage > 1}" th:href="@{'/vets.html?page=1'}" title="First"
|
||||
<a data-cy="vets-first-button" th:if="${currentPage > 1}" th:href="@{'/vets.html?page=1'}" title="First"
|
||||
class="fa fa-fast-backward"></a>
|
||||
<span th:unless="${currentPage > 1}" title="First" class="fa fa-fast-backward"></span>
|
||||
</span>
|
||||
<span>
|
||||
<a th:if="${currentPage > 1}" th:href="@{'/vets.html?page=__${currentPage - 1}__'}" title="Previous"
|
||||
<a data-cy="vets-previous-button" th:if="${currentPage > 1}" th:href="@{'/vets.html?page=__${currentPage - 1}__'}" title="Previous"
|
||||
class="fa fa-step-backward"></a>
|
||||
<span th:unless="${currentPage > 1}" title="Previous" class="fa fa-step-backward"></span>
|
||||
</span>
|
||||
<span>
|
||||
<a th:if="${currentPage < totalPages}" th:href="@{'/vets.html?page=__${currentPage + 1}__'}" title="Next"
|
||||
<a data-cy="vets-next-button" th:if="${currentPage < totalPages}" th:href="@{'/vets.html?page=__${currentPage + 1}__'}" title="Next"
|
||||
class="fa fa-step-forward"></a>
|
||||
<span th:unless="${currentPage < totalPages}" title="Next" class="fa fa-step-forward"></span>
|
||||
</span>
|
||||
<span>
|
||||
<a th:if="${currentPage < totalPages}" th:href="@{'/vets.html?page=__${totalPages}__'}" title="Last"
|
||||
<a data-cy="vets-last-button" th:if="${currentPage < totalPages}" th:href="@{'/vets.html?page=__${totalPages}__'}" title="Last"
|
||||
class="fa fa-fast-forward"></a>
|
||||
<span th:unless="${currentPage < totalPages}" title="Last" class="fa fa-fast-forward"></span>
|
||||
</span>
|
||||
|
|
Loading…
Reference in a new issue