fix specs
This commit is contained in:
parent
a4932a749c
commit
7130ea7e99
3 changed files with 6 additions and 4 deletions
|
@ -3,7 +3,7 @@ import { show, hide } from '@utils';
|
||||||
export function showMotivation(event, state) {
|
export function showMotivation(event, state) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
motivationCancel();
|
motivationCancel();
|
||||||
const stateElement = document.querySelector(`.motivation.${state}`)
|
const stateElement = document.querySelector(`.motivation.${state}`);
|
||||||
|
|
||||||
show(stateElement.parentElement);
|
show(stateElement.parentElement);
|
||||||
show(stateElement);
|
show(stateElement);
|
||||||
|
@ -12,7 +12,9 @@ export function showMotivation(event, state) {
|
||||||
|
|
||||||
export function motivationCancel() {
|
export function motivationCancel() {
|
||||||
document.querySelectorAll('.motivation').forEach(hide);
|
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'));
|
show(document.querySelector('.dropdown-items'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
- if dossier.en_instruction?
|
- 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
|
- menu.with_button_inner_html do
|
||||||
Instruire le dossier
|
Instruire le dossier
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ describe 'instructeurs/dossiers/instruction_button.html.haml', type: :view do
|
||||||
matcher :have_dropdown_items do |options|
|
matcher :have_dropdown_items do |options|
|
||||||
match do |rendered|
|
match do |rendered|
|
||||||
expected_count = options[:count] || 1
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue