summaryrefslogtreecommitdiff
path: root/src/viewmodel/name.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/viewmodel/name.rs')
-rw-r--r--src/viewmodel/name.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/viewmodel/name.rs b/src/viewmodel/name.rs
index a88e07f..b6ded60 100644
--- a/src/viewmodel/name.rs
+++ b/src/viewmodel/name.rs
@@ -1,6 +1,21 @@
use super::*;
use crate::view::name::*;
+/// Type that represents a vcard `name` property
+///
+/// # Examples
+/// ```
+/// # use bcard_wasm_webapp::viewmodel::name::Name;
+/// # use crate::bcard_wasm_webapp::viewmodel::VCardPropertyInputObject;
+/// let mut name = Name::new();
+/// name.prefix = String::from("Sir");
+/// name.first_name = String::from("Arthur");
+/// name.middle_name = String::from("Charles");
+/// name.last_name = String::from("Clarke");
+/// name.suffix = String::from("CBE FRAS");
+///
+/// assert_eq!(name.generate_fn(), String::from("Sir Arthur Charles Clarke, CBE FRAS"));
+/// ```
#[derive(Clone, Debug)]
pub struct Name {
pub prefix: String,
@@ -86,7 +101,7 @@ impl Name {
full_name.push_str(&self.last_name);
}
if !self.suffix.is_empty() {
- full_name.push_str(" ");
+ full_name.push_str(", ");
full_name.push_str(&self.suffix);
}