Skip to content

Commit

Permalink
BC-7824 add data testid for classes (#3518)
Browse files Browse the repository at this point in the history
* dataTestId

* added datatestid

* added datatestid

* added data testids

* added testid

* updated testid name

---------

Co-authored-by: Martin Schuhmacher <55735359+MartinSchuhmacher@users.noreply.github.com>
  • Loading branch information
atlldwp and MartinSchuhmacher authored Sep 9, 2024
1 parent 26d8099 commit 9d6dd7f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
9 changes: 8 additions & 1 deletion controllers/administration.js
Original file line number Diff line number Diff line change
Expand Up @@ -2128,15 +2128,19 @@ router.get(
key: 'upcoming',
title: `${upcomingYears.pop().name}`,
link: `/administration/classes/?showTab=upcoming${filterQueryString}`,
testId: 'upcoming-tab'
},
{
key: 'current',
title: `${currentYear.name}`,
link: `/administration/classes/?showTab=current${filterQueryString}`,
}, {
testId: 'current-tab'
},
{
key: 'archive',
title: res.$t('global.tab.label.archive'),
link: `/administration/classes/?showTab=archive${filterQueryString}`,
testId: 'archive-tab'
},
];

Expand All @@ -2162,18 +2166,21 @@ router.get(
link: `${basePath + item._id}/manage`,
icon: 'users',
title: res.$t('administration.controller.link.manageClass'),
testId: 'manage-class'
},
{
link: `${basePath + item._id}/edit`,
icon: 'edit',
title: res.$t('administration.controller.link.editClass'),
testId: 'edit-class'
},
{
link: basePath + item._id,
class: 'btn-delete',
icon: 'trash-o',
method: 'delete',
title: res.$t('administration.controller.link.deleteClass'),
testId: 'delete-class'
},
];
if (lastDefinedSchoolYear !== (item.year || {})._id
Expand Down
2 changes: 1 addition & 1 deletion views/administration/classes.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="tabContainer mb-1" data-active-tab={{showTab}}>
<div class="tabs">
{{#each classesTabs}}
<a class="tab" data-tab="js-{{this.key}}" href="{{this.link}}">
<a class="tab" data-tab="js-{{this.key}}" href="{{this.link}}" data-testid="{{this.testId}}">
<span class="text">{{this.title}}</span>
</a>
{{/each}}
Expand Down
10 changes: 5 additions & 5 deletions views/administration/forms/form-classes-edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<input type="hidden" name="referrer" value="{{../referrer}}" />

<a class="d-block mb-1" href="/administration/classes/{{../class/_id}}/manage"
title="Klasse '{{../class.name}}' verwalten.">
title="Klasse '{{../class.name}}' verwalten." data-testid="manage-class-btn">
<i class="fa fa-users"></i> {{$t "administration.classes.text.manageClass" }}
</a>
{{/ifeq}}
Expand All @@ -17,7 +17,7 @@
{{/each}}
{{/ifeq}}

<div class="form-group">
<div class="form-group" data-testid="class-school-year-selection">
<label>{{$t "administration.global.label.schoolYear" }} <sup>*</sup></label>
<select class="linked" name="schoolyear" data-linktext data-placeholder="Schuljahr auswählen"
{{#ifCond edit '&&' isCustom}}{{#unless @root.class.keepYear}}disabled {{/unless}}{{/ifCond}}>
Expand All @@ -29,7 +29,7 @@
</select>
</div>

<div class="form-group">
<div class="form-group" data-testid="class-teacher-selection">
<label>{{$t "administration.classes.label.selectTeacher" }}</label>

<select name="teacherIds[]" multiple data-placeholder="{{$t "global.placeholder.selectTeacher" }}">
Expand Down Expand Up @@ -78,7 +78,7 @@
required value="{{class.customName}}" {{#unless isCustom}}disabled{{/unless}} />
</div>
<label class="my-1">
<input name="keepyear" type="checkbox" value="true"
<input name="keepyear" type="checkbox" value="true" data-testid="maintain-school-year-in-class"
{{#ifCond edit '&&' isCustom}}{{#if @root.class.keepYear}}checked{{/if}}{{else}}checked{{/ifCond}}
{{#unless isCustom}}disabled{{/unless}} />
<span>{{$t "administration.classes.label.maintainSchoolYearAssignment" }}</span>
Expand Down Expand Up @@ -112,7 +112,7 @@
{{/userHasPermission}}
{{/ifeq}}
{{#ifeq mode "edit"}}
<button class="btn btn-primary" type="submit" disabled>{{$t "global.button.saveChanges" }}</button>
<button data-testId="confirm-class-edit" class="btn btn-primary" type="submit" disabled>{{$t "global.button.saveChanges" }}</button>
{{#if ../isUpgradable}}
<a class="btn btn-outline-primary" href="/administration/classes/{{@root.class.id}}/createSuccessor">{{$t "administration.classes.button.transferClassToTheNextSchoolYear" }}</a>
{{/if}}
Expand Down
6 changes: 3 additions & 3 deletions views/administration/forms/form-classes-manage.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<div class="row">
<a class="d-block mb-1"
href="/administration/classes/{{@root.class/_id}}/edit"
title="{{$t "administration.classes.placeholer.change" (dict "name" @root.class.name)}}">
title="{{$t "administration.classes.placeholer.change" (dict "name" @root.class.name)}}" data-testid="rename-class-btn">
<i class="fa fa-pencil"></i> {{$t "administration.classes.label.renameClass" }}
</a>
</div>

<div class="row">
<div style="width: 100%" class="form-group">
<div style="width: 100%" class="form-group" data-testid="teacher-selection-on-manage-class">
<label>{{$t "global.placeholder.Lehrer" }} {{#userHasPermission 'ADMIN_VIEW'}}{{else}}*{{/userHasPermission}}</label>

<select name="teacherIds[]" multiple data-placeholder="{{$t "global.placeholder.selectTeacher"}}" {{#userHasPermission 'ADMIN_VIEW'}}{{else}}required{{/userHasPermission}}>
Expand All @@ -30,7 +30,7 @@
</div>

<div class="row">
<div style="width: 100%" class="form-group">
<div style="width: 100%" class="form-group" data-testid="student-selection-on-manage-class">
<label>{{$t "administration.global.label.student" }}</label>
<select name="userIds" multiple data-placeholder="{{$t "administration.global.placeholder.selectStudent" }}">
{{#each students}}
Expand Down
2 changes: 1 addition & 1 deletion views/lib/components/table.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<label for="method" hidden>{{this.label}}</label>
<input id="method" type="hidden" name="_method" value="{{this.method}}" hidden />
{{> "lib/components/csrfInput"}}
<button type="submit" class="btn btn-secondary btn-sm no-inline-styling {{this.class}}" title="{{this.title}}" aria-label="{{this.title}}" tabindex="0">
<button type="submit" class="btn btn-secondary btn-sm no-inline-styling {{this.class}}" title="{{this.title}}" aria-label="{{this.title}}" data-testid="{{this.testId}}" tabindex="0">
<i class="fa fa-{{this.icon}}"></i> {{this.label}}
</button>
</form>
Expand Down

0 comments on commit 9d6dd7f

Please sign in to comment.