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,