fix specs

This commit is contained in:
Lisa Durand 2023-02-28 10:49:50 +01:00
parent a4932a749c
commit 7130ea7e99
3 changed files with 6 additions and 4 deletions

View file

@ -3,7 +3,7 @@ import { show, hide } from '@utils';
export function showMotivation(event, state) {
event.preventDefault();
motivationCancel();
const stateElement = document.querySelector(`.motivation.${state}`)
const stateElement = document.querySelector(`.motivation.${state}`);
show(stateElement.parentElement);
show(stateElement);
@ -12,7 +12,9 @@ export function showMotivation(event, state) {
export function motivationCancel() {
document.querySelectorAll('.motivation').forEach(hide);
document.querySelectorAll('.motivation').forEach(el => hide(el.parentElement));
document
.querySelectorAll('.motivation')
.forEach((el) => hide(el.parentElement));
show(document.querySelector('.dropdown-items'));
}

View file

@ -1,5 +1,5 @@
- if dossier.en_instruction?
= render Dropdown::MenuComponent.new(wrapper: :div, wrapper_options: { data: {'turbo-force': true} }, button_options: { class: [button_or_label_class(dossier)]}, role: @dossier.en_instruction? ? :region : :menu) do |menu|
= render Dropdown::MenuComponent.new(wrapper: :div, wrapper_options: { data: {'turbo-force': true} }, button_options: { class: [button_or_label_class(dossier)]}, role: dossier.en_instruction? ? :region : :menu) do |menu|
- menu.with_button_inner_html do
Instruire le dossier

View file

@ -14,7 +14,7 @@ describe 'instructeurs/dossiers/instruction_button.html.haml', type: :view do
matcher :have_dropdown_items do |options|
match do |rendered|
expected_count = options[:count] || 1
expect(rendered).to have_selector('ul.dropdown-items li', count: expected_count)
expect(rendered).to have_selector('ul.dropdown-items li:not(.hidden)', count: expected_count)
end
end