def test_can_remote_multiple_excluded_marks(): schema = Schema({ "nodes": { "doc": { "content": "text*" }, "text": {} }, "marks": { "big": { "excludes": "small1 small2" }, "small1": {}, "small2": {} }, }) tr = Transform( schema.node( "doc", None, schema.text("hi", [schema.mark("small1"), schema.mark("small2")]), )) assert len(tr.doc.first_child.marks) == 2 tr.add_mark(0, 2, schema.mark("big")) assert len(tr.doc.first_child.marks) == 1
def test_does_not_remove_non_excluded_marks_of_the_same_type(): schema = Schema({ "nodes": { "doc": { "content": "text*" }, "text": {} }, "marks": { "comment": { "excludes": "", "attrs": { "id": {} } } }, }) tr = Transform( schema.node("doc", None, schema.text("hi", [schema.mark("comment", {"id": 10})]))) tr.add_mark(0, 2, schema.mark("comment", {"id": 20})) assert len(tr.doc.first_child.marks) == 2