UPDATE: Adds Web browser wasm bindings (#30)

* UPDATE: Adds Web browser wasm bindings

* FIX: install wasm-pack in the GitHub actions
This commit is contained in:
Nicolás Hatcher Andrés
2024-04-07 12:41:33 +02:00
committed by GitHub
parent d445553d85
commit 489027991c
27 changed files with 1129 additions and 183 deletions

View File

@@ -0,0 +1,30 @@
#![allow(clippy::unwrap_used)]
use crate::{test::util::new_empty_model, UserModel};
#[test]
fn basic() {
let mut model1 = UserModel::from_model(new_empty_model());
let width = model1.get_column_width(0, 3).unwrap() * 3.0;
model1.set_column_width(0, 3, width).unwrap();
model1.set_user_input(0, 1, 2, "Hello IronCalc!").unwrap();
let model_bytes = model1.to_bytes();
let model2 = UserModel::from_bytes(&model_bytes).unwrap();
assert_eq!(model2.get_column_width(0, 3), Ok(width));
assert_eq!(
model2.get_formatted_cell_value(0, 1, 2),
Ok("Hello IronCalc!".to_string())
);
}
#[test]
fn errors() {
let model_bytes = "Early in the morning, late in the century, Cricklewood Broadway.";
assert_eq!(
&UserModel::from_bytes(model_bytes).unwrap_err(),
"Error parsing workbook"
);
}