From 7582c734b315457f42f685f3137225dee1869ac0 Mon Sep 17 00:00:00 2001 From: Tom Theisel Date: Mon, 22 Apr 2024 09:49:44 +1000 Subject: [PATCH] test: add nested list (#139) --- lab/src/pages/list/nested.astro | 59 +++++++++++++++++++++++++++++++++ lab/src/test/list.test.js | 9 +++++ 2 files changed, 68 insertions(+) create mode 100644 lab/src/pages/list/nested.astro diff --git a/lab/src/pages/list/nested.astro b/lab/src/pages/list/nested.astro new file mode 100644 index 0000000..a5d9306 --- /dev/null +++ b/lab/src/pages/list/nested.astro @@ -0,0 +1,59 @@ +--- +import Layout from "../../layouts/Default.astro"; +import { PortableText } from "astro-portabletext"; + +const blocks = [ + { + _type: "block", + style: "normal", + children: [ + { + _type: "span", + text: "1", + }, + ], + level: 1, + listItem: "bullet", + }, + { + _type: "block", + style: "normal", + level: 2, + listItem: "bullet", + children: [ + { + _type: "span", + text: "1.1", + }, + ], + }, + { + _type: "block", + style: "normal", + level: 3, + listItem: "bullet", + children: [ + { + _type: "span", + text: "1.1.1", + }, + ], + }, + { + _type: "block", + style: "normal", + children: [ + { + _type: "span", + text: "2", + }, + ], + level: 1, + listItem: "bullet", + }, +]; +--- + + + + diff --git a/lab/src/test/list.test.js b/lab/src/test/list.test.js index fa6d043..75d9502 100644 --- a/lab/src/test/list.test.js +++ b/lab/src/test/list.test.js @@ -33,4 +33,13 @@ list("unknown", async () => { assert.is($el.attr("data-portabletext-unknown"), "list"); }); +list("nested", async () => { + const $ = await fetchContent("list/nested"); + + assert.match( + $("body").html().trim(), + /^