Add link test with more trailing text.

This commit is contained in:
Sergio Martínez Portela 2022-08-20 15:07:19 +02:00
parent 434fb8ab0e
commit 79fd20a472
2 changed files with 27 additions and 2 deletions

View File

@ -15,3 +15,5 @@
This is a link with no description to [[* First level]].
This is [[id:03-markup-first-level-id][a link to a section by id]].
This is a [[https://codigoparallevar.com/3][web link]] followed up with some text.

View File

@ -201,7 +201,7 @@ class TestSerde(unittest.TestCase):
doc = load(f)
links = list(doc.get_links())
self.assertEqual(len(links), 4)
self.assertEqual(len(links), 5)
self.assertEqual(links[0].value, "https://codigoparallevar.com/1")
self.assertEqual(links[0].description, "web link")
@ -214,6 +214,9 @@ class TestSerde(unittest.TestCase):
self.assertEqual(links[3].value, "id:03-markup-first-level-id")
self.assertEqual(links[3].description, "a link to a section by id")
self.assertEqual(links[4].value, "https://codigoparallevar.com/3")
self.assertEqual(links[4].description, "web link")
ex = Doc(
props=[
("TITLE", "03-Links"),
@ -261,6 +264,12 @@ class TestSerde(unittest.TestCase):
),
".\n",
),
SPAN("\n"),
SPAN(
" This is a ",
WEB_LINK("web link", "https://codigoparallevar.com/3"),
" followed up with some text.\n",
),
],
)
),
@ -273,7 +282,7 @@ class TestSerde(unittest.TestCase):
doc = load(f)
links = list(doc.get_links())
self.assertEqual(len(links), 4)
self.assertEqual(len(links), 5)
self.assertEqual(links[0].value, "https://codigoparallevar.com/1")
self.assertEqual(links[0].description, "web link")
links[0].value = "https://codigoparallevar.com/1-updated"
@ -294,6 +303,11 @@ class TestSerde(unittest.TestCase):
links[3].value = "id:03-markup-non-existent-level-id"
links[3].description = None
self.assertEqual(links[4].value, "https://codigoparallevar.com/3")
self.assertEqual(links[4].description, "web link")
links[4].value = "https://codigoparallevar.com/3-updated"
links[4].description = "web link #3 with update"
ex = Doc(
props=[
("TITLE", "03-Links"),
@ -345,6 +359,15 @@ class TestSerde(unittest.TestCase):
),
".\n",
),
SPAN("\n"),
SPAN(
" This is a ",
WEB_LINK(
"web link #3 with update",
"https://codigoparallevar.com/3-updated",
),
" followed up with some text.\n",
),
],
)
),