fix most typos, add crate-ci/typos to CI (#2653)

* fix most typos, add crate-ci/typos to CI

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
Tristan F.andJonathan Kelley authored and GitHub committed 2024-07-23 17:49:33 -07:00
1 parent 841b447d2a
commit 9167cd9dec
83 files changed
+258 -203

No files matched your search

+1 -1
View File
@@ -40,7 +40,7 @@ If you are just starting, check out the Guides first.
## Understanding the implementation
`dioxus-core` is designed to be a lightweight crate that. It exposes a number of flexible primitives without being deeply concerned about the intracices of state management itself. We proivde a number of useful abstractions built on these primitives in the `dioxus-hooks` crate as well as the `dioxus-signals` crate.
`dioxus-core` is designed to be a lightweight crate that. It exposes a number of flexible primitives without being deeply concerned about the intracices of state management itself. We provide a number of useful abstractions built on these primitives in the `dioxus-hooks` crate as well as the `dioxus-signals` crate.
The important abstractions to understand are:
+9 -9
View File
@@ -92,25 +92,25 @@ impl VirtualDom {
}
impl ElementPath {
pub(crate) fn is_decendant(&self, small: &[u8]) -> bool {
pub(crate) fn is_descendant(&self, small: &[u8]) -> bool {
small.len() <= self.path.len() && small == &self.path[..small.len()]
}
}
#[test]
fn is_decendant() {
fn is_descendant() {
let event_path = ElementPath {
path: &[1, 2, 3, 4, 5],
};
assert!(event_path.is_decendant(&[1, 2, 3, 4, 5]));
assert!(event_path.is_decendant(&[1, 2, 3, 4]));
assert!(event_path.is_decendant(&[1, 2, 3]));
assert!(event_path.is_decendant(&[1, 2]));
assert!(event_path.is_decendant(&[1]));
assert!(event_path.is_descendant(&[1, 2, 3, 4, 5]));
assert!(event_path.is_descendant(&[1, 2, 3, 4]));
assert!(event_path.is_descendant(&[1, 2, 3]));
assert!(event_path.is_descendant(&[1, 2]));
assert!(event_path.is_descendant(&[1]));
assert!(!event_path.is_decendant(&[1, 2, 3, 4, 5, 6]));
assert!(!event_path.is_decendant(&[2, 3, 4]));
assert!(!event_path.is_descendant(&[1, 2, 3, 4, 5, 6]));
assert!(!event_path.is_descendant(&[2, 3, 4]));
}
impl PartialEq<&[u8]> for ElementPath {
+1 -1
View File
@@ -344,7 +344,7 @@ impl Mutations {
/// Rewrites IDs to just be "template", so you can compare the mutations
///
/// Used really only for testing
pub fn santize(mut self) -> Self {
pub fn sanitize(mut self) -> Self {
for edit in self.edits.iter_mut() {
if let Mutation::LoadTemplate { name, .. } = edit {
*name = "template"
+6 -6
View File
@@ -193,7 +193,7 @@ impl Drop for VNode {
// FIXME:
// TODO:
//
// We have to add this drop *here* becase we can't add a drop impl to AttributeValue and
// We have to add this drop *here* because we can't add a drop impl to AttributeValue and
// keep semver compatibility. Adding a drop impl means you can't destructure the value, which
// we need to do for enums.
//
@@ -546,7 +546,7 @@ impl TemplateNode {
/// A node created at runtime
///
/// This node's index in the DynamicNode list on VNode should match its repsective `Dynamic` index
/// This node's index in the DynamicNode list on VNode should match its respective `Dynamic` index
#[derive(Debug)]
pub enum DynamicNode {
/// A component node
@@ -761,7 +761,7 @@ pub struct Attribute {
impl Attribute {
/// Create a new [`Attribute`] from a name, value, namespace, and volatile bool
///
/// "Volatile" referes to whether or not Dioxus should always override the value. This helps prevent the UI in
/// "Volatile" refers to whether or not Dioxus should always override the value. This helps prevent the UI in
/// some renderers stay in sync with the VirtualDom's understanding of the world
pub fn new(
name: &'static str,
@@ -1145,8 +1145,8 @@ pub trait HasAttributes {
#[cfg(debug_assertions)]
pub(crate) fn sort_bfo(paths: &[&'static [u8]]) -> Vec<(usize, &'static [u8])> {
let mut with_indecies = paths.iter().copied().enumerate().collect::<Vec<_>>();
with_indecies.sort_by(|(_, a), (_, b)| {
let mut with_indices = paths.iter().copied().enumerate().collect::<Vec<_>>();
with_indices.sort_by(|(_, a), (_, b)| {
let mut a = a.iter();
let mut b = b.iter();
loop {
@@ -1163,7 +1163,7 @@ pub(crate) fn sort_bfo(paths: &[&'static [u8]]) -> Vec<(usize, &'static [u8])> {
}
}
});
with_indecies
with_indices
}
#[test]
+1 -1
View File
@@ -162,7 +162,7 @@ impl ReactiveContext {
/// # use futures_util::StreamExt;
/// fn use_simplified_memo(mut closure: impl FnMut() -> i32 + 'static) -> Signal<i32> {
/// use_hook(|| {
/// // Create a new reactive context and channel that will recieve a value every time a value the reactive context subscribes to changes
/// // Create a new reactive context and channel that will receive a value every time a value the reactive context subscribes to changes
/// let (reactive_context, mut changed) = ReactiveContext::new();
/// // Compute the value of the memo inside the reactive context. This will subscribe the reactive context to any values you read inside the closure
/// let value = reactive_context.reset_and_run_in(&mut closure);
+1 -1
View File
@@ -6,7 +6,7 @@ use std::{cell::Ref, rc::Rc};
/// A component's unique identifier.
///
/// `ScopeId` is a `usize` that acts a key for the internal slab of Scopes. This means that the key is not unqiue across
/// `ScopeId` is a `usize` that acts a key for the internal slab of Scopes. This means that the key is not unique across
/// time. We do try and guarantee that between calls to `wait_for_work`, no ScopeIds will be recycled in order to give
/// time for any logic that relies on these IDs to properly update.
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+1 -1
View File
@@ -887,7 +887,7 @@ impl VirtualDom {
for attr in attrs.iter() {
// Remove the "on" prefix if it exists, TODO, we should remove this and settle on one
if attr.name.get(2..) == Some(name) && target_path.is_decendant(this_path) {
if attr.name.get(2..) == Some(name) && target_path.is_descendant(this_path) {
listeners.push(&attr.value);
// Break if this is the exact target element.
+5 -5
View File
@@ -21,7 +21,7 @@ fn attrs_cycle() {
});
assert_eq!(
dom.rebuild_to_vec().santize().edits,
dom.rebuild_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(1,) },
AppendChildren { m: 1, id: ElementId(0) },
@@ -30,7 +30,7 @@ fn attrs_cycle() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(2,) },
AssignId { path: &[0,], id: ElementId(3,) },
@@ -42,7 +42,7 @@ fn attrs_cycle() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(1) },
ReplaceWith { id: ElementId(2), m: 1 }
@@ -51,7 +51,7 @@ fn attrs_cycle() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(2) },
AssignId { path: &[0], id: ElementId(3) },
@@ -74,7 +74,7 @@ fn attrs_cycle() {
// we take the node taken by attributes since we reused it
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(1) },
ReplaceWith { id: ElementId(2), m: 1 }
+1 -1
View File
@@ -6,7 +6,7 @@ fn bool_test() {
let mut app = VirtualDom::new(|| rsx!(div { hidden: false }));
assert_eq!(
app.rebuild_to_vec().santize().edits,
app.rebuild_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(1) },
SetAttribute {
+1 -1
View File
@@ -19,7 +19,7 @@ fn bubbles_error() {
let mut dom = VirtualDom::new(app);
{
let _edits = dom.rebuild_to_vec().santize();
let _edits = dom.rebuild_to_vec().sanitize();
}
dom.mark_dirty(ScopeId::APP);
+3 -3
View File
@@ -20,7 +20,7 @@ fn state_shares() {
let mut dom = VirtualDom::new(app);
assert_eq!(
dom.rebuild_to_vec().santize().edits,
dom.rebuild_to_vec().sanitize().edits,
[
CreateTextNode { value: "Value is 0".to_string(), id: ElementId(1,) },
AppendChildren { m: 1, id: ElementId(0) },
@@ -41,7 +41,7 @@ fn state_shares() {
dom.mark_dirty(ScopeId(ScopeId::APP.0 + 2));
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[SetText { value: "Value is 2".to_string(), id: ElementId(1,) },]
);
@@ -49,7 +49,7 @@ fn state_shares() {
dom.mark_dirty(ScopeId(ScopeId::APP.0 + 2));
let edits = dom.render_immediate_to_vec();
assert_eq!(
edits.santize().edits,
edits.sanitize().edits,
[SetText { value: "Value is 3".to_string(), id: ElementId(1,) },]
);
}
+6 -6
View File
@@ -17,7 +17,7 @@ fn test_original_diff() {
}
});
let edits = dom.rebuild_to_vec().santize();
let edits = dom.rebuild_to_vec().sanitize();
assert_eq!(
edits.edits,
@@ -46,7 +46,7 @@ fn create() {
}
});
let _edits = dom.rebuild_to_vec().santize();
let _edits = dom.rebuild_to_vec().sanitize();
// todo: we don't test template mutations anymore since the templates are passed along
@@ -77,7 +77,7 @@ fn create() {
fn create_list() {
let mut dom = VirtualDom::new(|| rsx! {{(0..3).map(|f| rsx!( div { "hello" } ))}});
let _edits = dom.rebuild_to_vec().santize();
let _edits = dom.rebuild_to_vec().sanitize();
// note: we dont test template edits anymore
// assert_eq!(
@@ -103,7 +103,7 @@ fn create_simple() {
}
});
let edits = dom.rebuild_to_vec().santize();
let edits = dom.rebuild_to_vec().sanitize();
// note: we dont test template edits anymore
// assert_eq!(
@@ -142,7 +142,7 @@ fn create_components() {
}
}
let _edits = dom.rebuild_to_vec().santize();
let _edits = dom.rebuild_to_vec().sanitize();
// todo: test this
}
@@ -161,7 +161,7 @@ fn anchors() {
});
// note that the template under "false" doesn't show up since it's not loaded
let edits = dom.rebuild_to_vec().santize();
let edits = dom.rebuild_to_vec().sanitize();
// note: we dont test template edits anymore
// assert_eq!(
+2 -2
View File
@@ -12,10 +12,10 @@ fn multiroot() {
});
// note: we dont test template edits anymore
let _templates = dom.rebuild_to_vec().santize().templates;
let _templates = dom.rebuild_to_vec().sanitize().templates;
// assert_eq!(
// dom.rebuild_to_vec().santize().templates,
// dom.rebuild_to_vec().sanitize().templates,
// [
// CreateElement { name: "div" },
// CreateStaticText { value: "Hello a" },
+1 -1
View File
@@ -25,7 +25,7 @@ fn app() -> Element {
fn list_renders() {
let mut dom = VirtualDom::new(app);
let edits = dom.rebuild_to_vec().santize();
let edits = dom.rebuild_to_vec().sanitize();
// note: we dont test template edits anymore
// assert_eq!(
+3 -3
View File
@@ -21,7 +21,7 @@ fn nested_passthru_creates() {
}
let mut dom = VirtualDom::new(app);
let edits = dom.rebuild_to_vec().santize();
let edits = dom.rebuild_to_vec().sanitize();
assert_eq!(
edits.edits,
@@ -60,7 +60,7 @@ fn nested_passthru_creates_add() {
let mut dom = VirtualDom::new(app);
assert_eq!(
dom.rebuild_to_vec().santize().edits,
dom.rebuild_to_vec().sanitize().edits,
[
// load 1
LoadTemplate { name: "template", index: 0, id: ElementId(1) },
@@ -85,7 +85,7 @@ fn dynamic_node_as_root() {
}
let mut dom = VirtualDom::new(app);
let edits = dom.rebuild_to_vec().santize();
let edits = dom.rebuild_to_vec().sanitize();
// Since the roots were all dynamic, they should not cause any template muations
assert!(edits.templates.is_empty());
+4 -4
View File
@@ -11,7 +11,7 @@ fn cycling_elements() {
});
{
let edits = dom.rebuild_to_vec().santize();
let edits = dom.rebuild_to_vec().sanitize();
assert_eq!(
edits.edits,
[
@@ -23,7 +23,7 @@ fn cycling_elements() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(2,) },
ReplaceWith { id: ElementId(1,), m: 1 },
@@ -33,7 +33,7 @@ fn cycling_elements() {
// notice that the IDs cycle back to ElementId(1), preserving a minimal memory footprint
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(1,) },
ReplaceWith { id: ElementId(2,), m: 1 },
@@ -42,7 +42,7 @@ fn cycling_elements() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(2,) },
ReplaceWith { id: ElementId(1,), m: 1 },
+4 -4
View File
@@ -62,7 +62,7 @@ fn component_swap() {
let mut dom = VirtualDom::new(app);
{
let edits = dom.rebuild_to_vec().santize();
let edits = dom.rebuild_to_vec().sanitize();
assert_eq!(
edits.edits,
[
@@ -79,7 +79,7 @@ fn component_swap() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(6) },
ReplaceWith { id: ElementId(5), m: 1 }
@@ -88,7 +88,7 @@ fn component_swap() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(5) },
ReplaceWith { id: ElementId(6), m: 1 }
@@ -97,7 +97,7 @@ fn component_swap() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(6) },
ReplaceWith { id: ElementId(5), m: 1 }
+8 -8
View File
@@ -48,7 +48,7 @@ fn element_swap() {
vdom.mark_dirty(ScopeId::APP);
assert_eq!(
vdom.render_immediate_to_vec().santize().edits,
vdom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(2,) },
ReplaceWith { id: ElementId(1,), m: 1 },
@@ -57,7 +57,7 @@ fn element_swap() {
vdom.mark_dirty(ScopeId::APP);
assert_eq!(
vdom.render_immediate_to_vec().santize().edits,
vdom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(1,) },
ReplaceWith { id: ElementId(2,), m: 1 },
@@ -66,7 +66,7 @@ fn element_swap() {
vdom.mark_dirty(ScopeId::APP);
assert_eq!(
vdom.render_immediate_to_vec().santize().edits,
vdom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(2,) },
ReplaceWith { id: ElementId(1,), m: 1 },
@@ -75,7 +75,7 @@ fn element_swap() {
vdom.mark_dirty(ScopeId::APP);
assert_eq!(
vdom.render_immediate_to_vec().santize().edits,
vdom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(1,) },
ReplaceWith { id: ElementId(2,), m: 1 },
@@ -128,7 +128,7 @@ fn attribute_diff() {
vdom.mark_dirty(ScopeId::APP);
assert_eq!(
vdom.render_immediate_to_vec().santize().edits,
vdom.render_immediate_to_vec().sanitize().edits,
[
SetAttribute {
name: "b",
@@ -147,7 +147,7 @@ fn attribute_diff() {
vdom.mark_dirty(ScopeId::APP);
assert_eq!(
vdom.render_immediate_to_vec().santize().edits,
vdom.render_immediate_to_vec().sanitize().edits,
[
SetAttribute { name: "a", value: AttributeValue::None, id: ElementId(1,), ns: None },
SetAttribute { name: "b", value: AttributeValue::None, id: ElementId(1,), ns: None },
@@ -168,7 +168,7 @@ fn attribute_diff() {
vdom.mark_dirty(ScopeId::APP);
assert_eq!(
vdom.render_immediate_to_vec().santize().edits,
vdom.render_immediate_to_vec().sanitize().edits,
[
SetAttribute { name: "c", value: AttributeValue::None, id: ElementId(1,), ns: None },
SetAttribute {
@@ -196,7 +196,7 @@ fn diff_empty() {
vdom.rebuild(&mut NoOpMutations);
vdom.mark_dirty(ScopeId::APP);
let edits = vdom.render_immediate_to_vec().santize().edits;
let edits = vdom.render_immediate_to_vec().sanitize().edits;
assert_eq!(
edits,
+11 -11
View File
@@ -22,7 +22,7 @@ fn keyed_diffing_out_of_order() {
{
assert_eq!(
dom.rebuild_to_vec().santize().edits,
dom.rebuild_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(1,) },
LoadTemplate { name: "template", index: 0, id: ElementId(2,) },
@@ -101,7 +101,7 @@ fn keyed_diffing_out_of_order_adds_3() {
);
}
/// Should result in moves onl
/// Should result in moves only
#[test]
fn keyed_diffing_out_of_order_adds_4() {
let mut dom = VirtualDom::new(|| {
@@ -127,7 +127,7 @@ fn keyed_diffing_out_of_order_adds_4() {
);
}
/// Should result in moves onl
/// Should result in moves only
#[test]
fn keyed_diffing_out_of_order_adds_5() {
let mut dom = VirtualDom::new(|| {
@@ -152,7 +152,7 @@ fn keyed_diffing_out_of_order_adds_5() {
);
}
/// Should result in moves onl
/// Should result in moves only
#[test]
fn keyed_diffing_additions() {
let mut dom = VirtualDom::new(|| {
@@ -169,7 +169,7 @@ fn keyed_diffing_additions() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(6) },
LoadTemplate { name: "template", index: 0, id: ElementId(7) },
@@ -194,7 +194,7 @@ fn keyed_diffing_additions_and_moves_on_ends() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
// create 11, 12
LoadTemplate { name: "template", index: 0, id: ElementId(5) },
@@ -224,7 +224,7 @@ fn keyed_diffing_additions_and_moves_in_middle() {
// LIS: 4, 5, 6
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
// create 5, 6
LoadTemplate { name: "template", index: 0, id: ElementId(5) },
@@ -258,7 +258,7 @@ fn controlled_keyed_diffing_out_of_order() {
// LIS: 5, 6
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
// remove 7
Remove { id: ElementId(4,) },
@@ -291,7 +291,7 @@ fn controlled_keyed_diffing_out_of_order_max_test() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
Remove { id: ElementId(5,) },
LoadTemplate { name: "template", index: 0, id: ElementId(5) },
@@ -320,7 +320,7 @@ fn remove_list() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
Remove { id: ElementId(5) },
Remove { id: ElementId(4) },
@@ -345,7 +345,7 @@ fn no_common_keys() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(4) },
LoadTemplate { name: "template", index: 0, id: ElementId(5) },
+23 -23
View File
@@ -18,7 +18,7 @@ fn list_creates_one_by_one() {
// load the div and then assign the empty fragment as a placeholder
assert_eq!(
dom.rebuild_to_vec().santize().edits,
dom.rebuild_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(1,) },
AssignId { path: &[0], id: ElementId(2,) },
@@ -29,7 +29,7 @@ fn list_creates_one_by_one() {
// Rendering the first item should replace the placeholder with an element
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(3,) },
HydrateText { path: &[0], value: "0".to_string(), id: ElementId(4,) },
@@ -40,7 +40,7 @@ fn list_creates_one_by_one() {
// Rendering the next item should insert after the previous
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(2,) },
HydrateText { path: &[0], value: "1".to_string(), id: ElementId(5,) },
@@ -51,7 +51,7 @@ fn list_creates_one_by_one() {
// ... and again!
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(6,) },
HydrateText { path: &[0], value: "2".to_string(), id: ElementId(7,) },
@@ -62,7 +62,7 @@ fn list_creates_one_by_one() {
// once more
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(8,) },
HydrateText { path: &[0], value: "3".to_string(), id: ElementId(9,) },
@@ -87,7 +87,7 @@ fn removes_one_by_one() {
// load the div and then assign the empty fragment as a placeholder
assert_eq!(
dom.rebuild_to_vec().santize().edits,
dom.rebuild_to_vec().sanitize().edits,
[
// The container
LoadTemplate { name: "template", index: 0, id: ElementId(1) },
@@ -109,14 +109,14 @@ fn removes_one_by_one() {
// Rendering the first item should replace the placeholder with an element
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[Remove { id: ElementId(6) }]
);
// Remove div(2)
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[Remove { id: ElementId(4) }]
);
@@ -124,7 +124,7 @@ fn removes_one_by_one() {
// todo: this should just be a remove with no placeholder
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
CreatePlaceholder { id: ElementId(4) },
ReplaceWith { id: ElementId(2), m: 1 }
@@ -135,7 +135,7 @@ fn removes_one_by_one() {
// todo: this should actually be append to, but replace placeholder is fine for now
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(2) },
HydrateText { path: &[0], value: "0".to_string(), id: ElementId(6) },
@@ -162,7 +162,7 @@ fn list_shrink_multiroot() {
});
assert_eq!(
dom.rebuild_to_vec().santize().edits,
dom.rebuild_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(1,) },
AssignId { path: &[0,], id: ElementId(2,) },
@@ -172,7 +172,7 @@ fn list_shrink_multiroot() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(3) },
HydrateText { path: &[0], value: "0".to_string(), id: ElementId(4) },
@@ -184,7 +184,7 @@ fn list_shrink_multiroot() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(2) },
HydrateText { path: &[0], value: "1".to_string(), id: ElementId(7) },
@@ -196,7 +196,7 @@ fn list_shrink_multiroot() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(10) },
HydrateText { path: &[0], value: "2".to_string(), id: ElementId(11) },
@@ -224,7 +224,7 @@ fn removes_one_by_one_multiroot() {
// load the div and then assign the empty fragment as a placeholder
assert_eq!(
dom.rebuild_to_vec().santize().edits,
dom.rebuild_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(1) },
//
@@ -251,19 +251,19 @@ fn removes_one_by_one_multiroot() {
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[Remove { id: ElementId(10) }, Remove { id: ElementId(12) }]
);
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[Remove { id: ElementId(6) }, Remove { id: ElementId(8) }]
);
dom.mark_dirty(ScopeId::APP);
assert_eq!(
dom.render_immediate_to_vec().santize().edits,
dom.render_immediate_to_vec().sanitize().edits,
[
CreatePlaceholder { id: ElementId(8) },
Remove { id: ElementId(2) },
@@ -318,7 +318,7 @@ fn remove_many() {
});
{
let edits = dom.rebuild_to_vec().santize();
let edits = dom.rebuild_to_vec().sanitize();
assert!(edits.templates.is_empty());
assert_eq!(
edits.edits,
@@ -331,7 +331,7 @@ fn remove_many() {
{
dom.mark_dirty(ScopeId::APP);
let edits = dom.render_immediate_to_vec().santize();
let edits = dom.render_immediate_to_vec().sanitize();
assert_eq!(
edits.edits,
[
@@ -344,7 +344,7 @@ fn remove_many() {
{
dom.mark_dirty(ScopeId::APP);
let edits = dom.render_immediate_to_vec().santize();
let edits = dom.render_immediate_to_vec().sanitize();
assert_eq!(
edits.edits,
[
@@ -363,7 +363,7 @@ fn remove_many() {
{
dom.mark_dirty(ScopeId::APP);
let edits = dom.render_immediate_to_vec().santize();
let edits = dom.render_immediate_to_vec().sanitize();
assert_eq!(
edits.edits,
[
@@ -379,7 +379,7 @@ fn remove_many() {
{
dom.mark_dirty(ScopeId::APP);
let edits = dom.render_immediate_to_vec().santize();
let edits = dom.render_immediate_to_vec().sanitize();
assert_eq!(
edits.edits,
[
+1 -1
View File
@@ -33,7 +33,7 @@ fn basic_syntax_is_a_template() -> Element {
#[test]
fn dual_stream() {
let mut dom = VirtualDom::new(basic_syntax_is_a_template);
let edits = dom.rebuild_to_vec().santize();
let edits = dom.rebuild_to_vec().sanitize();
use Mutation::*;
assert_eq!(edits.edits, {
+1 -1
View File
@@ -30,7 +30,7 @@ fn manual_diffing() {
*value.lock().unwrap() = "goodbye";
assert_eq!(
dom.rebuild_to_vec().santize().edits,
dom.rebuild_to_vec().sanitize().edits,
[
LoadTemplate { name: "template", index: 0, id: ElementId(3) },
HydrateText { path: &[0], value: "goodbye".to_string(), id: ElementId(4) },