Skip to content

Commit

Permalink
Fix the sieve filters page which is duplicating the modal content (#1358
Browse files Browse the repository at this point in the history
)

* Fix the sieve filters page which is duplicating the modal content

* Fix selenium tests: the navigation should be awaited only if the expected route isn't yet active

* Deal with flaky tests
  • Loading branch information
mercihabam authored Nov 18, 2024
1 parent 8f5c1f0 commit 9e9157c
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 663 deletions.
5 changes: 4 additions & 1 deletion modules/core/navigation/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ window.addEventListener('load', function() {
$(document).on('click', 'a', function(event) {
if ($(this).attr('href') !== "#" && $(this).attr('target') !== '_blank' && !$(this).data('external')) {
event.preventDefault();
navigate($(this).attr('href'));
const currentPage = new URL(window.location.href).searchParams.toString();
if (currentPage !== $(this).attr('href').split('?')[1]) {
navigate($(this).attr('href'));
}
}
});

Expand Down
8 changes: 7 additions & 1 deletion modules/core/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,14 @@ function Hm_Modal(options) {
};

this.opts = { ...defaults, ...options };
this.modal = $(`#${this.opts.modalId}`);

this.init = function () {
if (this.modal) {
if (this.modal.length) {
this.modalContent = this.modal.find('.modal-body');
this.modalTitle = this.modal.find('.modal-title');
this.modalFooter = this.modal.find('.modal-footer');
this.bsModal = bootstrap.Modal.getOrCreateInstance(this.modal[0]);
return;
}

Expand Down Expand Up @@ -338,6 +343,7 @@ function Hm_Modal(options) {
};

this.open = () => {
this.bsModal = bootstrap.Modal.getOrCreateInstance(this.modal[0]);
this.bsModal.show();
};

Expand Down
4 changes: 4 additions & 0 deletions modules/sievefilters/js_modules/route_handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ function applyBlockListPageHandlers() {

function applySieveFiltersPageHandler() {
sieveFiltersPageHandler();

return () => {
cleanUpSieveFiltersPage();
};
}
Loading

0 comments on commit 9e9157c

Please sign in to comment.