From 110e1358b2d63aa8f6708b74faa8e982fd2a1b4f Mon Sep 17 00:00:00 2001 From: timdeschryver <28659384+timdeschryver@users.noreply.github.com> Date: Sat, 27 Nov 2021 09:13:14 +0100 Subject: [PATCH 1/2] fix: query params with same keys are added to the collection BREAKING CHANGE: Query params on a router link with the same key are no longer overwriting the last value. Instead they are added to an array. --- projects/testing-library/src/lib/testing-library.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/projects/testing-library/src/lib/testing-library.ts b/projects/testing-library/src/lib/testing-library.ts index 6d66e933..12d14fde 100644 --- a/projects/testing-library/src/lib/testing-library.ts +++ b/projects/testing-library/src/lib/testing-library.ts @@ -130,8 +130,14 @@ export async function render( const queryParams = params ? params.split('&').reduce((qp, q) => { const [key, value] = q.split('='); - // TODO(Breaking): group same keys qp[key] ? [...qp[key], value] : value - qp[key] = value; + const currentValue = qp[key]; + if (typeof currentValue === 'undefined') { + qp[key] = value; + } else if (Array.isArray(currentValue)) { + qp[key] = [...currentValue, value]; + } else { + qp[key] = [currentValue, value]; + } return qp; }, {}) : undefined; From 1cd6fa17c8fd5097bb7abcc5487ba18a7e348b30 Mon Sep 17 00:00:00 2001 From: timdeschryver <28659384+timdeschryver@users.noreply.github.com> Date: Sat, 27 Nov 2021 09:14:50 +0100 Subject: [PATCH 2/2] fix: wrapper component selector is appended with `atl-` BEFORE: Wrapper component had `wrapper-component` as selector ```ts @Component({ selector: 'wrapper-component', template: '' }) class WrapperComponent {} ``` AFTER: Wrapper component has `atl-wrapper-component` as selector ```ts @Component({ selector: 'atl-wrapper-component', template: '' }) class WrapperComponent {} ``` --- projects/testing-library/src/lib/testing-library.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/projects/testing-library/src/lib/testing-library.ts b/projects/testing-library/src/lib/testing-library.ts index 12d14fde..1a517aa2 100644 --- a/projects/testing-library/src/lib/testing-library.ts +++ b/projects/testing-library/src/lib/testing-library.ts @@ -388,9 +388,7 @@ if (typeof process === 'undefined' || !process.env?.ATL_SKIP_AUTO_CLEANUP) { } } -// TODO: rename to `atl-wrapper-component` -// eslint-disable-next-line @angular-eslint/component-selector -@Component({ selector: 'wrapper-component', template: '' }) +@Component({ selector: 'atl-wrapper-component', template: '' }) class WrapperComponent {} /**