From 144874a58552c236c60f692dc3f868195840fa0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramirez=20Vargas=2C=20Jos=C3=A9=20Pablo?= Date: Thu, 23 Jul 2026 19:51:28 -0600 Subject: [PATCH] fix(tests): Disable TypeScript v7 --- .vscode/settings.json | 3 ++- src/lib/Tr/RsTr.svelte.test.ts | 46 +++++++++++----------------------- 2 files changed, 17 insertions(+), 32 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 64031c2..df932ef 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,5 +3,6 @@ "aria-rowcount", "mdsvex", "viewports" - ] + ], + "js/ts.experimental.useTsgo": false } \ No newline at end of file diff --git a/src/lib/Tr/RsTr.svelte.test.ts b/src/lib/Tr/RsTr.svelte.test.ts index a7815dd..d0c75c3 100644 --- a/src/lib/Tr/RsTr.svelte.test.ts +++ b/src/lib/Tr/RsTr.svelte.test.ts @@ -3,30 +3,28 @@ import { page } from 'vitest/browser'; import { render } from 'vitest-browser-svelte'; import type { TableContextOptions } from '$lib/types.js'; import Layout from '$lib/tests/Layout.svelte'; -// @ts-expect-error TS2614 import { children1Col, childrenEmptyCell, emptyContent } from '$lib/tests/TestSnippets.svelte'; -import { flushSync } from 'svelte'; describe('RsTr', () => { test('Should render data rows as lists.', async () => { - const optionsCtx: TableContextOptions = { + const ctxOptions: TableContextOptions = { breakpoint: window.innerWidth, }; render(Layout, { props: { - optionsCtx, + ctxOptions, children: children1Col, }, }); await expect.element(page.getByRole('list')).toBeInTheDocument(); }); test('Should render header content as list items.', async () => { - const optionsCtx: TableContextOptions = { + const ctxOptions: TableContextOptions = { breakpoint: window.innerWidth, }; render(Layout, { props: { - optionsCtx, + ctxOptions, children: children1Col, }, }); @@ -35,12 +33,12 @@ describe('RsTr', () => { expect(el.textContent).toBe('Header 1'); }); test("Should render data content inside the element of role 'cell'.", async () => { - const optionsCtx: TableContextOptions = { + const ctxOptions: TableContextOptions = { breakpoint: window.innerWidth, }; render(Layout, { props: { - optionsCtx, + ctxOptions, children: children1Col, }, }); @@ -49,12 +47,12 @@ describe('RsTr', () => { expect(el.textContent).toBe('Cell 1'); }); test("Should render the element of role 'cell' with the expected attributes.", async () => { - const optionsCtx: TableContextOptions = { + const ctxOptions: TableContextOptions = { breakpoint: window.innerWidth, }; render(Layout, { props: { - optionsCtx, + ctxOptions, children: children1Col, }, }); @@ -66,12 +64,12 @@ describe('RsTr', () => { }); describe('Empty cell content', () => { test('Should not render the term element for empty cells.', async () => { - const optionsCtx: TableContextOptions = { + const ctxOptions: TableContextOptions = { breakpoint: window.innerWidth, }; render(Layout, { props: { - optionsCtx, + ctxOptions, children: childrenEmptyCell, }, }); @@ -89,30 +87,16 @@ describe('RsTr', () => { contentType: 'snippet', } ])('#7: Should render the $contentType empty content on empty cells.', async ({ emptyCellContent }) => { - let tableCtx: TableContextOptions | undefined; + const ctxOptions: TableContextOptions = { + breakpoint: window.innerWidth, + emptyCellContent, + }; await render(Layout, { props: { + ctxOptions, children: childrenEmptyCell, - get tableCtx() { - return tableCtx; - }, - set tableCtx(value) { - tableCtx = value; - } }, }); - /* - There's something different in the test environment than real browsers: If I pass optionsCtx to initialize - the context with non-default values, the TestContext constructor doesn't receive the optionsCtx object I - assign via the options.props property of the render() function. It claims that "options" is undefined. - - The weird thing is that all other tests work fine with the optionsCtx object passed to the render() - function. I don't know why this test is different, but I can work around it by setting the context values - after the render() function is called. - */ - tableCtx!.breakpoint = window.innerWidth; - tableCtx!.emptyCellContent = emptyCellContent; - flushSync(); const els = page.getByRole('cell').all(); expect(els).toHaveLength(2); await expect.element(els[0]).toBeInTheDocument();