mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 11:23:48 -05:00
Fix comparison of original categories with new
These tests make sure the sub-categories shown when a category is selected are right but the comparison looked for a direct match between the labels for both types. This looks for the category label in the sub-category label instead, ie. 'Today at' in 'Today at 1pm'. ...instead of 'Today at' === 'Today at 1pm', which will always fail.
This commit is contained in:
committed by
Chris Hill-Scott
parent
909f2d4678
commit
e45bbcf99e
@@ -159,10 +159,13 @@ describe('RadioSelect', () => {
|
||||
|
||||
describe(`clicking the button for ${category} should`, () => {
|
||||
|
||||
const categoryRegExp = new RegExp('^' + category);
|
||||
let originalOptionsForcategory;
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
// get all the options in the original page for this category
|
||||
originalOptionsForCategory = originalOptionsForAllCategories.filter(option => option.label === category);
|
||||
originalOptionsForCategory = originalOptionsForAllCategories.filter(option => categoryRegExp.test(option.label));
|
||||
|
||||
// start module
|
||||
window.GOVUK.modules.start();
|
||||
|
||||
Reference in New Issue
Block a user