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")) +}