Skip to content

Commit 675c833

Browse files
authored
feat: add test for appflowy_editor attributes (#1931)
1 parent d3ee346 commit 675c833

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

frontend/appflowy_flutter/packages/appflowy_editor/test/core/document/attributes_test.dart

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,37 @@ void main() async {
5454
'b': 3,
5555
'c': 4,
5656
});
57+
expect(invertAttributes(null, base), {
58+
'a': null,
59+
'b': null,
60+
});
61+
expect(invertAttributes(other, null), {
62+
'b': 3,
63+
'c': 4,
64+
});
5765
});
66+
test(
67+
"hasAttributes",
68+
() {
69+
final base = {
70+
'a': 1,
71+
'b': 2,
72+
};
73+
final other = {
74+
'c': 3,
75+
'd': 4,
76+
};
77+
78+
var x = hashAttributes(base);
79+
var y = hashAttributes(base);
80+
// x & y should have same hash code
81+
expect(x == y, true);
82+
83+
y = hashAttributes(other);
84+
85+
// x & y should have different hash code
86+
expect(x == y, false);
87+
},
88+
);
5889
});
5990
}

0 commit comments

Comments
 (0)