diff --git a/pyproject.toml b/pyproject.toml index ad91a12..7fb4747 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "funcnodes-plotly" -version = "1.1.1" +version = "1.1.2" description = "" readme = "README.md" classifiers = [ diff --git a/src/funcnodes_plotly/react_plugin/plugin-custom-renders.css b/src/funcnodes_plotly/react_plugin/plugin-custom-renders.css index e3b1874..9fb672c 100644 --- a/src/funcnodes_plotly/react_plugin/plugin-custom-renders.css +++ b/src/funcnodes_plotly/react_plugin/plugin-custom-renders.css @@ -1 +1 @@ -.funcnodes_plotly_container{width:100%;height:100%;min-height:300px;min-width:300px}.dialogchildren .funcnodes_plotly_container{min-height:60vh} +.funcnodes_plotly_container{width:100%;height:100%;min-height:300px;min-width:300px}.dialog-children .funcnodes_plotly_container{min-height:60vh} diff --git a/src/react_plugin/package.json b/src/react_plugin/package.json index d8331af..9c99223 100644 --- a/src/react_plugin/package.json +++ b/src/react_plugin/package.json @@ -9,6 +9,7 @@ "dist" ], "scripts": { + "test": "node --test", "build": "tsc && vite build", "dev": "vite build --watch", "typecheck": "tsc --noEmit" diff --git a/src/react_plugin/src/style.css b/src/react_plugin/src/style.css index 89ed653..5ceaffa 100644 --- a/src/react_plugin/src/style.css +++ b/src/react_plugin/src/style.css @@ -5,6 +5,6 @@ min-width: 300px; } -.dialogchildren .funcnodes_plotly_container { +.dialog-children .funcnodes_plotly_container { min-height: 60vh; } diff --git a/src/react_plugin/test/style.css.test.js b/src/react_plugin/test/style.css.test.js new file mode 100644 index 0000000..4337d9f --- /dev/null +++ b/src/react_plugin/test/style.css.test.js @@ -0,0 +1,52 @@ +import test from "node:test"; +import assert from "node:assert/strict"; +import fs from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const rootDir = path.resolve(__dirname, ".."); + +const srcStylePath = path.join(rootDir, "src", "style.css"); +const distStylePath = path.join(rootDir, "dist", "plugin-custom-renders.css"); +const packagedStylePath = path.join( + rootDir, + "..", + "funcnodes_plotly", + "react_plugin", + "plugin-custom-renders.css" +); + +function readTextFile(filePath) { + return fs.readFileSync(filePath, "utf8"); +} + +test("src/style.css uses Radix `dialog-children` selector for dialog sizing", () => { + const css = readTextFile(srcStylePath); + assert.match(css, /\.dialog-children\s+\.funcnodes_plotly_container\s*\{/); +}); + +test("src/style.css does not use deprecated `dialogchildren` selector", () => { + const css = readTextFile(srcStylePath); + assert.doesNotMatch(css, /\.dialogchildren\s+\.funcnodes_plotly_container\s*\{/); +}); + +test("src/style.css defines a minimum preview size", () => { + const css = readTextFile(srcStylePath); + assert.match( + css, + /\.funcnodes_plotly_container\s*\{[^}]*min-height:\s*300px;[^}]*min-width:\s*300px;[^}]*\}/s + ); +}); + +test("dist/plugin-custom-renders.css matches src dialog selector", () => { + const css = readTextFile(distStylePath); + assert.match(css, /\.dialog-children\s+\.funcnodes_plotly_container\s*\{/); + assert.doesNotMatch(css, /\.dialogchildren\s+\.funcnodes_plotly_container\s*\{/); +}); + +test("funcnodes_plotly/react_plugin/plugin-custom-renders.css matches src dialog selector", () => { + const css = readTextFile(packagedStylePath); + assert.match(css, /\.dialog-children\s+\.funcnodes_plotly_container\s*\{/); + assert.doesNotMatch(css, /\.dialogchildren\s+\.funcnodes_plotly_container\s*\{/); +}); diff --git a/uv.lock b/uv.lock index f17ae9e..946521c 100644 --- a/uv.lock +++ b/uv.lock @@ -607,7 +607,7 @@ wheels = [ [[package]] name = "funcnodes-plotly" -version = "1.1.1" +version = "1.1.2" source = { editable = "." } dependencies = [ { name = "funcnodes" },