1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

Editor | Enhancement | Text block vs title or description merge (#2303)

* merge text in description or title on backspace

* tests

* stubs on featured, desc, paragraph blocks

* fixing names of properties

* fix tests

Co-authored-by: konstantiniiv <ki@anytype.io>
This commit is contained in:
Konstantin Ivanov 2022-05-25 19:21:44 +03:00 committed by GitHub
parent 549225bef0
commit 48251c032b
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 383 additions and 3 deletions

View file

@ -26,6 +26,29 @@ fun StubTitle(
fields = Block.Fields.empty()
)
fun StubFeatured(
children: List<Id> = emptyList()
): Block = Block(
id = MockDataFactory.randomUuid(),
content = Block.Content.FeaturedRelations,
children = children,
fields = Block.Fields.empty()
)
fun StubDescription(
id: Id = MockDataFactory.randomUuid(),
text: String = MockDataFactory.randomString()
): Block = Block(
id = id,
content = Block.Content.Text(
text = text,
style = Block.Content.Text.Style.DESCRIPTION,
marks = emptyList()
),
children = emptyList(),
fields = Block.Fields.empty()
)
fun StubCheckbox(
text: String = MockDataFactory.randomString(),
children: List<Id> = emptyList(),
@ -43,6 +66,22 @@ fun StubCheckbox(
fields = Block.Fields.empty()
)
fun StubParagraph(
id: Id = MockDataFactory.randomUuid(),
text: String = MockDataFactory.randomString(),
children: List<Id> = emptyList(),
marks: List<Block.Content.Text.Mark> = emptyList()
): Block = Block(
id = id,
content = Block.Content.Text(
text = text,
style = Block.Content.Text.Style.P,
marks = marks
),
children = children,
fields = Block.Fields.empty()
)
fun StubBulleted(
text: String = MockDataFactory.randomString(),
children: List<Id> = emptyList(),
@ -118,4 +157,14 @@ fun StubCallout(
),
children = children,
fields = Block.Fields.empty()
)
fun StubRelation(
relationKey: String = MockDataFactory.randomString(),
format: RelationFormat
): Relation = Relation(
key = relationKey,
name = MockDataFactory.randomString(),
format = format,
source = Relation.Source.values().random()
)