Skip to content

Commit

Permalink
Add navName to disMacro support (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
garethj2 authored Mar 1, 2024
1 parent 2a85ad2 commit ba2e3a2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/haystack/val/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,10 @@ where
return decode_str_from_value(val);
}

if let Some(val) = dict.get("navName") {
return decode_str_from_value(val);
}

if let Some(val) = dict.get("id") {
return if let Value::Ref(val) = val {
Cow::Borrowed(val.dis.as_ref().unwrap_or(&val.value))
Expand Down Expand Up @@ -497,6 +501,12 @@ mod test {
assert_eq!(dict_to_dis(&dict, &|_| None, None), "display");
}

#[test]
fn dict_to_dis_returns_nav_name() {
let dict = dict!["navName" => Value::make_str("navName")];
assert_eq!(dict_to_dis(&dict, &|_| None, None), "navName");
}

#[test]
fn dict_to_dis_returns_id() {
let dict = dict!["id" => Value::make_ref("id")];
Expand Down

0 comments on commit ba2e3a2

Please sign in to comment.