From da56f59cf75b44dc95ce8b9ca079391b7b8df538 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 22:25:24 +0000 Subject: [PATCH] Shell: test that module settings menus have no blank rows The dock keeps its pinned apps as a setting with an empty label; the settings menu must skip it (c45e0ef) rather than draw an unlabeled row. Cover config_rows directly and with the dock's real settings, on the wasm target (no wasmer needed). No other module declares an empty label or choice. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DPL5hkqAzaoEVwZmqjUx99 --- compositor/shell/config_rows_wbtest.mbt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 compositor/shell/config_rows_wbtest.mbt diff --git a/compositor/shell/config_rows_wbtest.mbt b/compositor/shell/config_rows_wbtest.mbt new file mode 100644 index 0000000..ec84f99 --- /dev/null +++ b/compositor/shell/config_rows_wbtest.mbt @@ -0,0 +1,24 @@ +///| A module's settings menu never has a blank row: a setting with an empty label is kept by the +/// module (the dock's pinned apps) but not listed, and every listed row has a label. +test "settings menu rows: hidden settings are skipped, no blank rows" { + let items : Array[@wasm.ConfigItem] = [ + { key: "size", label: "Icon size", choices: ["Small", "Large"], value: "Small" }, + { key: "magnify", label: "Magnify", choices: [], value: "on" }, + { key: "pinned", label: "", choices: [], value: "foot;gimp" }, + ] + let rows = config_rows(items) + assert_eq(rows.map(r => r.label), ["Icon size", "Small", "Large", "Magnify"]) + assert_true(rows.iter().all(r => r.label.length() > 0)) +} + +///| The dock's real settings, as its module declares them. +test "dock settings menu has no blank rows" { + let c = @dock.DockConfig::from_pairs([("pinned", "foot;gimp")]) + let items = c + .items() + .map(it => ({ key: it.key, label: it.label, choices: it.choices, value: it.value } : @wasm.ConfigItem)) + let rows = config_rows(items) + assert_true(rows.length() > 0) + assert_true(rows.iter().all(r => r.label.length() > 0)) + assert_false(rows.iter().any(r => r.arg == "pinned")) +}