From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../components/places/tests/unit/test_1085291.js | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 toolkit/components/places/tests/unit/test_1085291.js (limited to 'toolkit/components/places/tests/unit/test_1085291.js') diff --git a/toolkit/components/places/tests/unit/test_1085291.js b/toolkit/components/places/tests/unit/test_1085291.js new file mode 100644 index 0000000000..deb817c3cb --- /dev/null +++ b/toolkit/components/places/tests/unit/test_1085291.js @@ -0,0 +1,47 @@ +add_task(async function() { + // test that nodes inserted by incremental update for bookmarks of all types + // have the extra bookmark properties (bookmarkGuid, dateAdded, lastModified). + + // getFolderContents opens the root node. + let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.toolbarGuid) + .root; + + async function insertAndTest(bmInfo) { + bmInfo = await PlacesUtils.bookmarks.insert(bmInfo); + let node = root.getChild(root.childCount - 1); + Assert.equal(node.bookmarkGuid, bmInfo.guid); + Assert.equal(node.dateAdded, bmInfo.dateAdded * 1000); + Assert.equal(node.lastModified, bmInfo.lastModified * 1000); + } + + // Normal bookmark. + await insertAndTest({ + parentGuid: root.bookmarkGuid, + type: PlacesUtils.bookmarks.TYPE_BOOKMARK, + title: "Test Bookmark", + url: "http://test.url.tld", + }); + + // place: query + await insertAndTest({ + parentGuid: root.bookmarkGuid, + type: PlacesUtils.bookmarks.TYPE_BOOKMARK, + title: "Test Query", + url: `place:parent=${PlacesUtils.bookmarks.menuGuid}`, + }); + + // folder + await insertAndTest({ + parentGuid: root.bookmarkGuid, + type: PlacesUtils.bookmarks.TYPE_FOLDER, + title: "Test Folder", + }); + + // separator + await insertAndTest({ + parentGuid: root.bookmarkGuid, + type: PlacesUtils.bookmarks.TYPE_SEPARATOR, + }); + + root.containerOpen = false; +}); -- cgit v1.2.3