File tree 1 file changed +5
-5
lines changed
packages/nimble-components/src/utilities/tests
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export const sharedMatrixParameters = () => ({
25
25
} ) as const ;
26
26
27
27
type MakeTupleEntriesArrays < T > = { [ K in keyof T ] : readonly T [ K ] [ ] } ;
28
+
28
29
/**
29
30
* Calculates the cartesian product of an array of sets.
30
31
*/
@@ -50,23 +51,22 @@ export function cartesianProduct<T extends readonly unknown[]>(
50
51
}
51
52
52
53
/**
53
- * Takes a template rendered with an array of states .
54
+ * Passes each of the given state combinations into a template function and returns the combined output .
54
55
*/
55
56
function createMatrixFromStates < T extends readonly unknown [ ] > (
56
57
component : ( ...states : T ) => ViewTemplate ,
57
58
states : T [ ]
58
59
) : ViewTemplate {
59
- const matrix = states . map ( state => component ( ...state ) ) ;
60
60
// prettier-ignore
61
61
return html `
62
- ${ repeat ( ( ) => matrix , html `
63
- ${ ( x : ViewTemplate ) : ViewTemplate => x }
62
+ ${ repeat ( ( ) => states , html `
63
+ ${ ( x : T ) : ViewTemplate => component ( ... x ) }
64
64
` ) }
65
65
` ;
66
66
}
67
67
68
68
/**
69
- * Takes a template rendered with the cartesian product the provided states .
69
+ * Creates a template that renders all combinations of states in the given dimensions .
70
70
*/
71
71
export function createMatrix < T extends readonly unknown [ ] > (
72
72
component : ( ...states : T ) => ViewTemplate ,
You can’t perform that action at this time.
0 commit comments