srctree

Robin Linden parent 9fa0779e 28a20987
style: Take custom properties into account when comparing styled nodes

inlinesplit
style/styled_node.h added: 20, removed: 3, total 17
@@ -154,7 +154,8 @@ private:
};
 
[[nodiscard]] inline bool operator==(style::StyledNode const &a, style::StyledNode const &b) noexcept {
return a.node == b.node && a.properties == b.properties && a.children == b.children;
return a.node == b.node && a.properties == b.properties && a.custom_properties == b.custom_properties
&& a.children == b.children;
}
 
inline std::string_view dom_name(StyledNode const &node) {
 
style/styled_node_test.cpp added: 20, removed: 3, total 17
@@ -508,5 +508,21 @@ int main() {
style::FontWeight::bold());
});
 
etest::test("==, custom properties", [] {
dom::Node dom = dom::Element{"baka"};
 
style::StyledNode with{
.node = dom,
.custom_properties{{"--a", "bold"}},
};
 
style::StyledNode without{.node = dom};
 
expect(with != without);
 
without.custom_properties = {{"--a", "bold"}};
expect_eq(with, without);
});
 
return etest::run_all_tests();
}