Skip to content

Commit f70f9d1

Browse files
authored
test(runtime-vapor): port tests from rendererChildren.spec.ts (#13649)
1 parent 56a7f9d commit f70f9d1

File tree

3 files changed

+774
-1
lines changed

3 files changed

+774
-1
lines changed

packages/runtime-vapor/__tests__/_utils.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,21 @@ export function makeInteropRender(): (comp: Component) => InteropRenderContext {
135135

136136
return define
137137
}
138+
139+
export function shuffle(array: Array<any>): any[] {
140+
let currentIndex = array.length
141+
let temporaryValue
142+
let randomIndex
143+
144+
// while there remain elements to shuffle...
145+
while (currentIndex !== 0) {
146+
// pick a remaining element...
147+
randomIndex = Math.floor(Math.random() * currentIndex)
148+
currentIndex -= 1
149+
// and swap it with the current element.
150+
temporaryValue = array[currentIndex]
151+
array[currentIndex] = array[randomIndex]
152+
array[randomIndex] = temporaryValue
153+
}
154+
return array
155+
}

0 commit comments

Comments
 (0)