From 82d58257da6148c9a7ace475a9302734b9e9cf0e Mon Sep 17 00:00:00 2001 From: Olivier Refalo Date: Sat, 19 Oct 2024 22:21:21 +0400 Subject: [PATCH] fix: fix tests and demo headers --- package.json | 6 +- pnpm-lock.yaml | 107 ++++++++++-------- src/lib/VirtualListNew.svelte | 4 +- src/routes/examples/events/+page.svelte | 2 +- src/routes/examples/horizontal/+page.svelte | 2 +- src/routes/examples/positioning/code.svelte | 2 +- src/routes/examples/table/+page.svelte | 2 +- .../examples/variablesizing/+page.svelte | 2 +- src/routes/examples/vertical/+page.svelte | 2 +- tests/scrollVirtualList.spec.ts | 26 ++--- 10 files changed, 81 insertions(+), 74 deletions(-) diff --git a/package.json b/package.json index 67d78a4..bd8c0eb 100644 --- a/package.json +++ b/package.json @@ -61,8 +61,8 @@ "@playwright/test": "^1.48.1", "@sveltejs/adapter-static": "^3.0.5", "@sveltejs/kit": "^2.7.1", - "@sveltejs/package": "2.3.5", - "@sveltejs/vite-plugin-svelte": "^4.0.0-next.7", + "@sveltejs/package": "^2.3.5", + "@sveltejs/vite-plugin-svelte": "^4.0.0", "@types/eslint": "^9.6.1", "@types/node": "^22.7.7", "@typescript-eslint/eslint-plugin": "^8.10.0", @@ -94,6 +94,6 @@ "vite": "^5.4.9" }, "peerDependencies": { - "svelte": "5.0.0-next.270" + "svelte": "^5.0.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9aa1bc5..1bcb059 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: svelte: - specifier: 5.0.0-next.270 - version: 5.0.0-next.270 + specifier: ^5.0.0 + version: 5.0.0 devDependencies: '@commitlint/cli': specifier: ^19.5.0 @@ -23,16 +23,16 @@ importers: version: 1.48.1 '@sveltejs/adapter-static': specifier: ^3.0.5 - version: 3.0.5(@sveltejs/kit@2.7.1(@sveltejs/vite-plugin-svelte@4.0.0-next.7(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)))(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1))) + version: 3.0.5(@sveltejs/kit@2.7.1(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)))(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1))) '@sveltejs/kit': specifier: ^2.7.1 - version: 2.7.1(@sveltejs/vite-plugin-svelte@4.0.0-next.7(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)))(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)) + version: 2.7.1(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)))(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)) '@sveltejs/package': - specifier: 2.3.5 - version: 2.3.5(svelte@5.0.0-next.270)(typescript@5.6.3) + specifier: ^2.3.5 + version: 2.3.5(svelte@5.0.0)(typescript@5.6.3) '@sveltejs/vite-plugin-svelte': - specifier: ^4.0.0-next.7 - version: 4.0.0-next.7(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)) + specifier: ^4.0.0 + version: 4.0.0(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)) '@types/eslint': specifier: ^9.6.1 version: 9.6.1 @@ -71,7 +71,7 @@ importers: version: 0.1.0(eslint@9.13.0(jiti@1.21.6)) eslint-plugin-svelte: specifier: ^2.45.1 - version: 2.45.1(eslint@9.13.0(jiti@1.21.6))(svelte@5.0.0-next.270) + version: 2.45.1(eslint@9.13.0(jiti@1.21.6))(svelte@5.0.0) globals: specifier: ^15.11.0 version: 15.11.0 @@ -89,7 +89,7 @@ importers: version: 3.3.3 prettier-plugin-svelte: specifier: ^3.2.7 - version: 3.2.7(prettier@3.3.3)(svelte@5.0.0-next.270) + version: 3.2.7(prettier@3.3.3)(svelte@5.0.0) rimraf: specifier: ^6.0.1 version: 6.0.1 @@ -101,13 +101,13 @@ importers: version: 14.2.4 svelte-check: specifier: ^4.0.5 - version: 4.0.5(svelte@5.0.0-next.270)(typescript@5.6.3) + version: 4.0.5(svelte@5.0.0)(typescript@5.6.3) svelte-highlight: specifier: ^7.7.0 version: 7.7.0 svelte-preprocess: specifier: ^6.0.3 - version: 6.0.3(postcss-load-config@4.0.2(postcss@8.4.47))(postcss@8.4.47)(sass@1.80.3)(svelte@5.0.0-next.270)(typescript@5.6.3) + version: 6.0.3(postcss-load-config@4.0.2(postcss@8.4.47))(postcss@8.4.47)(sass@1.80.3)(svelte@5.0.0)(typescript@5.6.3) tslib: specifier: ^2.8.0 version: 2.8.0 @@ -777,8 +777,8 @@ packages: svelte: ^5.0.0-next.96 || ^5.0.0 vite: ^5.0.0 - '@sveltejs/vite-plugin-svelte@4.0.0-next.7': - resolution: {integrity: sha512-yMUnAqquoayvBDztk1rWUgdtvjv7YcHgopCAB7sWl9SQht8U/7lqwTlJU0ZTAY09pFFRe6bbakd7YoiyyIvJiA==} + '@sveltejs/vite-plugin-svelte@4.0.0': + resolution: {integrity: sha512-kpVJwF+gNiMEsoHaw+FJL76IYiwBikkxYU83+BpqQLdVMff19KeRKLd2wisS8niNBMJ2omv5gG+iGDDwd8jzag==} engines: {node: ^18.0.0 || ^20.0.0 || >=22} peerDependencies: svelte: ^5.0.0-next.96 || ^5.0.0 @@ -1984,6 +1984,9 @@ packages: magic-string@0.30.11: resolution: {integrity: sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A==} + magic-string@0.30.12: + resolution: {integrity: sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==} + meow@12.1.1: resolution: {integrity: sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==} engines: {node: '>=16.10'} @@ -2594,8 +2597,8 @@ packages: svelte: ^3.55 || ^4.0.0-next.0 || ^4.0 || ^5.0.0-next.0 typescript: ^4.9.4 || ^5.0.0 - svelte@5.0.0-next.270: - resolution: {integrity: sha512-1PPYfFECNuEtltTZf6FbcjBz5T9Uv0HGbDSdjzGnGfnZoXmoAf24pPqlocJiu+JhZTdymfRZ9GFJRjCiGwzISQ==} + svelte@5.0.0: + resolution: {integrity: sha512-jv2IvTtakG58DqZMo6fY3T6HFmGV4iDQH2lSUyfmCEYaoa+aCNcF+9rERbdDvT4XDF0nQBg6TEoJn0dirED8VQ==} engines: {node: '>=18'} temp@0.9.4: @@ -2758,10 +2761,10 @@ packages: terser: optional: true - vitefu@1.0.2: - resolution: {integrity: sha512-0/iAvbXyM3RiPPJ4lyD4w6Mjgtf4ejTK6TPvTNG3H32PLwuT0N/ZjJLiXug7ETE/LWtTeHw9WRv7uX/tIKYyKg==} + vitefu@1.0.3: + resolution: {integrity: sha512-iKKfOMBHob2WxEJbqbJjHAkmYgvFDPhuqrO82om83S8RLk+17FtyMBfcyeH8GqD0ihShtkMW/zzJgiA51hCNCQ==} peerDependencies: - vite: ^3.0.0 || ^4.0.0 || ^5.0.0 + vite: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0-beta.0 peerDependenciesMeta: vite: optional: true @@ -3320,13 +3323,13 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.24.0': optional: true - '@sveltejs/adapter-static@3.0.5(@sveltejs/kit@2.7.1(@sveltejs/vite-plugin-svelte@4.0.0-next.7(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)))(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)))': + '@sveltejs/adapter-static@3.0.5(@sveltejs/kit@2.7.1(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)))(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)))': dependencies: - '@sveltejs/kit': 2.7.1(@sveltejs/vite-plugin-svelte@4.0.0-next.7(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)))(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)) + '@sveltejs/kit': 2.7.1(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)))(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)) - '@sveltejs/kit@2.7.1(@sveltejs/vite-plugin-svelte@4.0.0-next.7(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)))(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1))': + '@sveltejs/kit@2.7.1(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)))(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1))': dependencies: - '@sveltejs/vite-plugin-svelte': 4.0.0-next.7(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)) + '@sveltejs/vite-plugin-svelte': 4.0.0(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)) '@types/cookie': 0.6.0 cookie: 0.6.0 devalue: 5.1.1 @@ -3338,40 +3341,40 @@ snapshots: sade: 1.8.1 set-cookie-parser: 2.6.0 sirv: 3.0.0 - svelte: 5.0.0-next.270 + svelte: 5.0.0 tiny-glob: 0.2.9 vite: 5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1) - '@sveltejs/package@2.3.5(svelte@5.0.0-next.270)(typescript@5.6.3)': + '@sveltejs/package@2.3.5(svelte@5.0.0)(typescript@5.6.3)': dependencies: chokidar: 4.0.1 kleur: 4.1.5 sade: 1.8.1 semver: 7.6.2 - svelte: 5.0.0-next.270 - svelte2tsx: 0.7.21(svelte@5.0.0-next.270)(typescript@5.6.3) + svelte: 5.0.0 + svelte2tsx: 0.7.21(svelte@5.0.0)(typescript@5.6.3) transitivePeerDependencies: - typescript - '@sveltejs/vite-plugin-svelte-inspector@3.0.0-next.2(@sveltejs/vite-plugin-svelte@4.0.0-next.7(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)))(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1))': + '@sveltejs/vite-plugin-svelte-inspector@3.0.0-next.2(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)))(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1))': dependencies: - '@sveltejs/vite-plugin-svelte': 4.0.0-next.7(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)) + '@sveltejs/vite-plugin-svelte': 4.0.0(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)) debug: 4.3.7 - svelte: 5.0.0-next.270 + svelte: 5.0.0 vite: 5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1) transitivePeerDependencies: - supports-color - '@sveltejs/vite-plugin-svelte@4.0.0-next.7(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1))': + '@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1))': dependencies: - '@sveltejs/vite-plugin-svelte-inspector': 3.0.0-next.2(@sveltejs/vite-plugin-svelte@4.0.0-next.7(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)))(svelte@5.0.0-next.270)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)) + '@sveltejs/vite-plugin-svelte-inspector': 3.0.0-next.2(@sveltejs/vite-plugin-svelte@4.0.0(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)))(svelte@5.0.0)(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)) debug: 4.3.7 deepmerge: 4.3.1 kleur: 4.1.5 - magic-string: 0.30.11 - svelte: 5.0.0-next.270 + magic-string: 0.30.12 + svelte: 5.0.0 vite: 5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1) - vitefu: 1.0.2(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)) + vitefu: 1.0.3(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)) transitivePeerDependencies: - supports-color @@ -4108,7 +4111,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-plugin-svelte@2.45.1(eslint@9.13.0(jiti@1.21.6))(svelte@5.0.0-next.270): + eslint-plugin-svelte@2.45.1(eslint@9.13.0(jiti@1.21.6))(svelte@5.0.0): dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@9.13.0(jiti@1.21.6)) '@jridgewell/sourcemap-codec': 1.5.0 @@ -4121,9 +4124,9 @@ snapshots: postcss-safe-parser: 6.0.0(postcss@8.4.47) postcss-selector-parser: 6.1.0 semver: 7.6.2 - svelte-eslint-parser: 0.42.0(svelte@5.0.0-next.270) + svelte-eslint-parser: 0.42.0(svelte@5.0.0) optionalDependencies: - svelte: 5.0.0-next.270 + svelte: 5.0.0 transitivePeerDependencies: - ts-node @@ -4658,6 +4661,10 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 + magic-string@0.30.12: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.0 + meow@12.1.1: {} merge-stream@2.0.0: {} @@ -4906,10 +4913,10 @@ snapshots: prelude-ls@1.2.1: {} - prettier-plugin-svelte@3.2.7(prettier@3.3.3)(svelte@5.0.0-next.270): + prettier-plugin-svelte@3.2.7(prettier@3.3.3)(svelte@5.0.0): dependencies: prettier: 3.3.3 - svelte: 5.0.0-next.270 + svelte: 5.0.0 prettier@3.3.3: {} @@ -5211,19 +5218,19 @@ snapshots: dependencies: has-flag: 4.0.0 - svelte-check@4.0.5(svelte@5.0.0-next.270)(typescript@5.6.3): + svelte-check@4.0.5(svelte@5.0.0)(typescript@5.6.3): dependencies: '@jridgewell/trace-mapping': 0.3.25 chokidar: 4.0.1 fdir: 6.4.0 picocolors: 1.1.0 sade: 1.8.1 - svelte: 5.0.0-next.270 + svelte: 5.0.0 typescript: 5.6.3 transitivePeerDependencies: - picomatch - svelte-eslint-parser@0.42.0(svelte@5.0.0-next.270): + svelte-eslint-parser@0.42.0(svelte@5.0.0): dependencies: eslint-scope: 7.2.2 eslint-visitor-keys: 3.4.3 @@ -5231,29 +5238,29 @@ snapshots: postcss: 8.4.47 postcss-scss: 4.0.9(postcss@8.4.47) optionalDependencies: - svelte: 5.0.0-next.270 + svelte: 5.0.0 svelte-highlight@7.7.0: dependencies: highlight.js: 11.10.0 - svelte-preprocess@6.0.3(postcss-load-config@4.0.2(postcss@8.4.47))(postcss@8.4.47)(sass@1.80.3)(svelte@5.0.0-next.270)(typescript@5.6.3): + svelte-preprocess@6.0.3(postcss-load-config@4.0.2(postcss@8.4.47))(postcss@8.4.47)(sass@1.80.3)(svelte@5.0.0)(typescript@5.6.3): dependencies: - svelte: 5.0.0-next.270 + svelte: 5.0.0 optionalDependencies: postcss: 8.4.47 postcss-load-config: 4.0.2(postcss@8.4.47) sass: 1.80.3 typescript: 5.6.3 - svelte2tsx@0.7.21(svelte@5.0.0-next.270)(typescript@5.6.3): + svelte2tsx@0.7.21(svelte@5.0.0)(typescript@5.6.3): dependencies: dedent-js: 1.0.1 pascal-case: 3.1.2 - svelte: 5.0.0-next.270 + svelte: 5.0.0 typescript: 5.6.3 - svelte@5.0.0-next.270: + svelte@5.0.0: dependencies: '@ampproject/remapping': 2.3.0 '@jridgewell/sourcemap-codec': 1.5.0 @@ -5413,7 +5420,7 @@ snapshots: sass: 1.80.3 terser: 5.31.1 - vitefu@1.0.2(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)): + vitefu@1.0.3(vite@5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1)): optionalDependencies: vite: 5.4.9(@types/node@22.7.7)(sass@1.80.3)(terser@5.31.1) diff --git a/src/lib/VirtualListNew.svelte b/src/lib/VirtualListNew.svelte index 06fc2f2..6506253 100644 --- a/src/lib/VirtualListNew.svelte +++ b/src/lib/VirtualListNew.svelte @@ -548,12 +548,12 @@ const children = !isTable ? listInner.children : listInner.querySelector('tbody')!.children; for (let index = 0; index < children.length; index++) { - const el = children[index]; + const el = children[index]; const style = getComputedStyle(el); if (['absolute', 'fixed'].includes(style.position)) { continue; } - const outerSize = getOuterSize(el); + const outerSize = getOuterSize(el as HTMLElement); sizeArr.push(outerSize); if (sizeArr.length >= maxSampleCount) { break; diff --git a/src/routes/examples/events/+page.svelte b/src/routes/examples/events/+page.svelte index 3bb2a88..a14c97e 100644 --- a/src/routes/examples/events/+page.svelte +++ b/src/routes/examples/events/+page.svelte @@ -4,5 +4,5 @@

Events

-

Try interacting with the list below and check the event log below.

+

Try interacting with the list below and check the event log in the console.

diff --git a/src/routes/examples/horizontal/+page.svelte b/src/routes/examples/horizontal/+page.svelte index 1f730bd..670ddf0 100644 --- a/src/routes/examples/horizontal/+page.svelte +++ b/src/routes/examples/horizontal/+page.svelte @@ -3,6 +3,6 @@ import example from './code.svelte?example'; -

Internal: VirtualList

+

Horizontal List

diff --git a/src/routes/examples/positioning/code.svelte b/src/routes/examples/positioning/code.svelte index 40f765e..0d8fa95 100644 --- a/src/routes/examples/positioning/code.svelte +++ b/src/routes/examples/positioning/code.svelte @@ -66,7 +66,7 @@ } randomizeContent(); - randomizeSize(); + sameSize();
diff --git a/src/routes/examples/table/+page.svelte b/src/routes/examples/table/+page.svelte index 027a1fa..f5b27b5 100644 --- a/src/routes/examples/table/+page.svelte +++ b/src/routes/examples/table/+page.svelte @@ -3,6 +3,6 @@ import example from './code.svelte?example'; -

Table rendering

+

Table Rendering

diff --git a/src/routes/examples/variablesizing/+page.svelte b/src/routes/examples/variablesizing/+page.svelte index da38636..4489d45 100644 --- a/src/routes/examples/variablesizing/+page.svelte +++ b/src/routes/examples/variablesizing/+page.svelte @@ -3,6 +3,6 @@ import example from './code.svelte?example'; -

Variable Sizing

+

Variable item Sizing

diff --git a/src/routes/examples/vertical/+page.svelte b/src/routes/examples/vertical/+page.svelte index 1f730bd..f576aef 100644 --- a/src/routes/examples/vertical/+page.svelte +++ b/src/routes/examples/vertical/+page.svelte @@ -3,6 +3,6 @@ import example from './code.svelte?example'; -

Internal: VirtualList

+

Vertical List

diff --git a/tests/scrollVirtualList.spec.ts b/tests/scrollVirtualList.spec.ts index 70fc99f..964f5b3 100644 --- a/tests/scrollVirtualList.spec.ts +++ b/tests/scrollVirtualList.spec.ts @@ -8,16 +8,16 @@ test('index 0, then 5000, then back to 0', async ({ page }) => { const testpage = page.locator(':has-text("Positioning")~div'); expect(testpage).toBeDefined(); - const listWrapper = testpage.locator('div.virtual-list-wrapper').first(); + const listWrapper = testpage.locator('div.vtlist-inner').first(); expect(listWrapper).toBeDefined(); // count the rendered list rows - expect(await listWrapper.locator('div.row').count()).toBeGreaterThan(7); + expect(await listWrapper.locator('div').count()).toBeGreaterThan(7); // Find the first rendered Row - let firstRowElement = await listWrapper.locator('div.row').first(); - let innerHTML = await firstRowElement.evaluate(element => element.innerHTML); - expect(innerHTML).toBe('Item #0'); + let firstRowElement = await listWrapper.locator('div').first(); + let innerHTML = await firstRowElement.allTextContents(); + expect(innerHTML[0].toString().substring(0, 2)).toContain('#0'); // Goto element 5000 const numberInput = await testpage.locator('#index'); @@ -25,19 +25,19 @@ test('index 0, then 5000, then back to 0', async ({ page }) => { await page.waitForTimeout(2000); // count the rendered list rows - expect(await listWrapper.locator('div.row').count()).toBeGreaterThan(7); + expect(await listWrapper.locator('div').count()).toBeGreaterThan(7); - // validate that the first rendered row is not "Item #0" anymore - firstRowElement = await listWrapper.locator('div.row').first(); - innerHTML = await firstRowElement.evaluate(element => element.innerHTML); - expect(innerHTML).not.toBe('Item #0'); + // validate that the first rendered row is not "#0..." anymore + firstRowElement = await listWrapper.locator('div').first(); + innerHTML = await firstRowElement.allTextContents(); + expect(innerHTML[0].toString().substring(0, 2)).not.toContain('#0'); // go back to item 0 await numberInput.fill('0'); await page.waitForTimeout(2000); // ensure we are back on the first item - firstRowElement = await listWrapper.locator('div.row').first(); - innerHTML = await firstRowElement.evaluate(element => element.innerHTML); - expect(innerHTML).toBe('Item #0'); + firstRowElement = await listWrapper.locator('div').first(); + innerHTML = await firstRowElement.allTextContents(); + expect(innerHTML[0].toString().substring(0, 2)).toContain('#0'); });