Skip to content

Commit ba2e3a2

Browse files
authored
Add navName to disMacro support (#20)
1 parent 2a85ad2 commit ba2e3a2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/haystack/val/dict.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,10 @@ where
417417
return decode_str_from_value(val);
418418
}
419419

420+
if let Some(val) = dict.get("navName") {
421+
return decode_str_from_value(val);
422+
}
423+
420424
if let Some(val) = dict.get("id") {
421425
return if let Value::Ref(val) = val {
422426
Cow::Borrowed(val.dis.as_ref().unwrap_or(&val.value))
@@ -497,6 +501,12 @@ mod test {
497501
assert_eq!(dict_to_dis(&dict, &|_| None, None), "display");
498502
}
499503

504+
#[test]
505+
fn dict_to_dis_returns_nav_name() {
506+
let dict = dict!["navName" => Value::make_str("navName")];
507+
assert_eq!(dict_to_dis(&dict, &|_| None, None), "navName");
508+
}
509+
500510
#[test]
501511
fn dict_to_dis_returns_id() {
502512
let dict = dict!["id" => Value::make_ref("id")];

0 commit comments

Comments
 (0)