@@ -159,8 +159,8 @@ export default function PluginsPage() {
|
||||
() => [
|
||||
...protocolSectionMeta.map((section) => ({ ...section, plugins: filteredPlugins.filter((plugin) => pluginMatchesCategory(plugin.manifest, section.key)) })),
|
||||
{ key: "other", label: "应用插件", description: "画布、素材与工作流扩展", icon: PlugZap, plugins: filteredPlugins.filter((plugin) => pluginMatchesCategory(plugin.manifest, "other")) },
|
||||
],
|
||||
[filteredPlugins],
|
||||
].filter((section) => categoryFilter === "all" || section.key === categoryFilter),
|
||||
[categoryFilter, filteredPlugins],
|
||||
);
|
||||
|
||||
const selectCategory = (key: string) => {
|
||||
|
||||
12
web/test/plugin-category-sections.test.ts
Normal file
12
web/test/plugin-category-sections.test.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, test } from "bun:test";
|
||||
|
||||
const source = readFileSync(new URL("../src/pages/plugins/index.tsx", import.meta.url), "utf8");
|
||||
|
||||
describe("plugin category sections (#428)", () => {
|
||||
test("limits rendered sections to the selected category, not just matching plugins", () => {
|
||||
const sections = source.slice(source.indexOf("const pluginSections ="), source.indexOf("const selectCategory ="));
|
||||
expect(sections).toContain('categoryFilter === "all" || section.key === categoryFilter');
|
||||
expect(sections).toContain("[categoryFilter, filteredPlugins]");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user