browser/components/places/tests/chrome/test_selectItems_on_nested_tree.xul

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:636cf404fcc3
1 <?xml version="1.0"?>
2
3 <!--
4 Any copyright is dedicated to the Public Domain.
5 http://creativecommons.org/licenses/publicdomain/
6 -->
7
8 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
9 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
10 type="text/css"?>
11
12 <?xml-stylesheet href="chrome://browser/content/places/places.css"?>
13 <?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
14 <?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
15
16 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
17 title="549192: History view not updated after deleting entry"
18 onload="runTest();">
19
20 <script type="application/javascript"
21 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
22 <script type="application/javascript" src="head.js" />
23
24 <body xmlns="http://www.w3.org/1999/xhtml" />
25
26 <tree id="tree"
27 type="places"
28 flex="1">
29 <treecols>
30 <treecol label="Title" id="title" anonid="title" primary="true" ordinal="1" flex="1"/>
31 </treecols>
32 <treechildren flex="1"/>
33 </tree>
34
35 <script type="application/javascript"><![CDATA[
36 /**
37 * Ensure that selectItems doesn't recurse infinitely in nested trees.
38 */
39
40 function runTest() {
41 PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
42 NetUtil.newURI("place:folder=UNFILED_BOOKMARKS"),
43 PlacesUtils.bookmarks.DEFAULT_INDEX,
44 "shortcut");
45 PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
46 NetUtil.newURI("place:folder=UNFILED_BOOKMARKS&maxResults=10"),
47 PlacesUtils.bookmarks.DEFAULT_INDEX,
48 "query");
49 let folderId = PlacesUtils.bookmarks.createFolder(PlacesUtils.unfiledBookmarksFolderId,
50 "folder",
51 PlacesUtils.bookmarks.DEFAULT_INDEX);
52 let itemId = PlacesUtils.bookmarks.insertBookmark(folderId,
53 NetUtil.newURI("http://www.mozilla.org/"),
54 PlacesUtils.bookmarks.DEFAULT_INDEX,
55 "bookmark");
56 // Setup the places tree contents.
57 var tree = document.getElementById("tree");
58 tree.place = "place:folder=UNFILED_BOOKMARKS";
59
60 // Select the last bookmark.
61 tree.selectItems([itemId]);
62 is (tree.selectedNode.itemId, itemId, "The right node was selected");
63 }
64
65 ]]></script>
66 </window>

mercurial