From 3429e9c9821ae3f633d65cde11e3a0d8336ae79d Mon Sep 17 00:00:00 2001 From: Mert Akinc <7282195+m-akinc@users.noreply.github.com> Date: Wed, 27 Mar 2024 14:42:32 -0500 Subject: [PATCH] Minor changes --- .../nimble-components/src/utilities/tests/matrix.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/nimble-components/src/utilities/tests/matrix.ts b/packages/nimble-components/src/utilities/tests/matrix.ts index 739079fec8..a91099a927 100644 --- a/packages/nimble-components/src/utilities/tests/matrix.ts +++ b/packages/nimble-components/src/utilities/tests/matrix.ts @@ -25,6 +25,7 @@ export const sharedMatrixParameters = () => ({ }) as const; type MakeTupleEntriesArrays = { [K in keyof T]: readonly T[K][] }; + /** * Calculates the cartesian product of an array of sets. */ @@ -50,23 +51,22 @@ export function cartesianProduct( } /** - * Takes a template rendered with an array of states. + * Passes each of the given state combinations into a template function and returns the combined output. */ function createMatrixFromStates( component: (...states: T) => ViewTemplate, states: T[] ): ViewTemplate { - const matrix = states.map(state => component(...state)); // prettier-ignore return html` - ${repeat(() => matrix, html` - ${(x: ViewTemplate): ViewTemplate => x} + ${repeat(() => states, html` + ${(x: T): ViewTemplate => component(...x)} `)} `; } /** - * Takes a template rendered with the cartesian product the provided states. + * Creates a template that renders all combinations of states in the given dimensions. */ export function createMatrix( component: (...states: T) => ViewTemplate,