diff --git a/.reuse/dep5 b/.reuse/dep5
index 90a4ef3..53243f9 100644
--- a/.reuse/dep5
+++ b/.reuse/dep5
@@ -11,6 +11,7 @@ Files:
README.md
src/**.rs
src/web/version.txt
+ tests/**.rs
update_web_files.sh
Copyright: LibrePCB Developers
License: MIT
diff --git a/src/lib.rs b/src/lib.rs
index b299c45..242eb50 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -512,6 +512,13 @@ impl ToJson for RefMap {
/// // Add BOM rows (designators and their footprint IDs).
/// ibom.bom_front.push(vec![RefMap::new("R1", id)]);
/// ```
+///
+///
+/// Please note that this struct is not completely fool-proof regarding as
+/// it does not validate lots of the added data, so make sure you add only
+/// valid BOM data. Only the most important things are validated: Footprint IDs
+/// in BOM rows, and number of fields in footprints.
+///
#[non_exhaustive]
pub struct InteractiveHtmlBom {
// Metadata
@@ -537,29 +544,29 @@ pub struct InteractiveHtmlBom {
/// Custom field names, listed as columns
pub fields: Vec,
- /// User-defined JavaScript
+ /// User-defined HTML header
///
///
/// This should be used carefully as we neither guarantee forward- nor
/// backward-compatibility.
///
- pub user_js: String,
+ pub user_header: String,
- /// User-defined HTML header
+ /// User-defined HTML footer
///
///
/// This should be used carefully as we neither guarantee forward- nor
/// backward-compatibility.
///
- pub user_header: String,
+ pub user_footer: String,
- /// User-defined HTML footer
+ /// User-defined JavaScript
///
///
/// This should be used carefully as we neither guarantee forward- nor
/// backward-compatibility.
///
- pub user_footer: String,
+ pub user_js: String,
/// Drawings (PCB edges, silkscreen, fabrication)
pub drawings: Vec,
@@ -651,7 +658,7 @@ impl InteractiveHtmlBom {
}
/// Generate HTML
- pub fn generate(&self) -> Result {
+ pub fn generate_html(&self) -> Result {
// Validate footprint IDs.
for bom in [&self.bom_back, &self.bom_front, &self.bom_both] {
for row in bom {
diff --git a/tests/integration_test.rs b/tests/integration_test.rs
new file mode 100644
index 0000000..9bc19c6
--- /dev/null
+++ b/tests/integration_test.rs
@@ -0,0 +1,181 @@
+use interactive_html_bom::*;
+
+#[test]
+fn test_empty() {
+ let bom = InteractiveHtmlBom::new(
+ "Test Title",
+ "Test Company",
+ "Test Revision",
+ "Test Date",
+ (0.0, 0.0),
+ (0.0, 0.0),
+ );
+
+ let html = bom.generate_html().unwrap();
+ assert!(html.contains("