From ab337f8c0518cc0cfcba249e0e7578932d764127 Mon Sep 17 00:00:00 2001 From: Alex Gibson Date: Fri, 16 Dec 2022 11:07:37 +0000 Subject: [PATCH] Fix careers listings filtering (Fixes #12490) (#12492) --- media/js/careers/listings/filters.es6.js | 4 ++-- tests/unit/spec/careers/filters.js | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/media/js/careers/listings/filters.es6.js b/media/js/careers/listings/filters.es6.js index de48c14a4b..6f0cafc2a4 100644 --- a/media/js/careers/listings/filters.es6.js +++ b/media/js/careers/listings/filters.es6.js @@ -124,7 +124,7 @@ PositionFilters.prototype = { for (let i = 0; i < positions.length; i++) { const data = positions.item(i).dataset[field]; - if (data.indexOf(value + ',') === -1) { + if (data.indexOf(value) === -1) { positions.item(i).classList.add('hidden'); } } @@ -139,7 +139,7 @@ PositionFilters.prototype = { const positions = this.positionTable.getElementsByClassName('position'); for (let i = 0; i < positions.length; i++) { - const data = positions.item(i).dataset.location; + const data = positions.item(i).dataset.location + ','; // When user selects 'Remote' only list jobs explicitly marked // Remote otherwise list jobs matching value (which is a mozilla diff --git a/tests/unit/spec/careers/filters.js b/tests/unit/spec/careers/filters.js index ed6180fe81..8044bcd9a5 100644 --- a/tests/unit/spec/careers/filters.js +++ b/tests/unit/spec/careers/filters.js @@ -57,42 +57,42 @@ describe('filters.js', function () { - + Operations Specialist - Business Development San Francisco Office Business Development - + Localization Program Manager Remote San Francisco Bay Area Core Product-Firefox - + Senior Program Manager Remote Canada Core Product-Firefox - + Senior Software Engineer (C++) Remote US Core Product-Security - + Senior UI Engineer San Francisco Office Core Product-Security - + Data Engineer Remote Canada, Remote Germany, Remote US Data Organization - + Inference Data Scientist (Staff Level) Remote Canada, Remote US Data Organization - + Senior Software Engineer Remote Mozilla Foundation