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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/places/tests/chrome/test_selectItems_on_nested_tree.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,66 @@
     1.4 +<?xml version="1.0"?>
     1.5 +
     1.6 +<!--
     1.7 +    Any copyright is dedicated to the Public Domain.
     1.8 +    http://creativecommons.org/licenses/publicdomain/
     1.9 +   -->
    1.10 +
    1.11 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
    1.12 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
    1.13 +                 type="text/css"?>
    1.14 +
    1.15 +<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
    1.16 +<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
    1.17 +<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
    1.18 +
    1.19 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    1.20 +        title="549192:  History view not updated after deleting entry"
    1.21 +        onload="runTest();">
    1.22 +
    1.23 +  <script type="application/javascript"
    1.24 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
    1.25 +  <script type="application/javascript" src="head.js" />
    1.26 +
    1.27 +  <body xmlns="http://www.w3.org/1999/xhtml" />
    1.28 +
    1.29 +  <tree id="tree"
    1.30 +        type="places"
    1.31 +        flex="1">
    1.32 +    <treecols>
    1.33 +      <treecol label="Title" id="title" anonid="title" primary="true" ordinal="1" flex="1"/>
    1.34 +    </treecols>
    1.35 +    <treechildren flex="1"/>
    1.36 +  </tree>
    1.37 +
    1.38 +  <script type="application/javascript"><![CDATA[
    1.39 +    /**
    1.40 +     * Ensure that selectItems doesn't recurse infinitely in nested trees.
    1.41 +     */
    1.42 +
    1.43 +    function runTest() {
    1.44 +      PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
    1.45 +                                           NetUtil.newURI("place:folder=UNFILED_BOOKMARKS"),
    1.46 +                                           PlacesUtils.bookmarks.DEFAULT_INDEX,
    1.47 +                                           "shortcut");
    1.48 +      PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
    1.49 +                                           NetUtil.newURI("place:folder=UNFILED_BOOKMARKS&maxResults=10"),
    1.50 +                                           PlacesUtils.bookmarks.DEFAULT_INDEX,
    1.51 +                                           "query");
    1.52 +      let folderId = PlacesUtils.bookmarks.createFolder(PlacesUtils.unfiledBookmarksFolderId,
    1.53 +                                                        "folder",
    1.54 +                                                        PlacesUtils.bookmarks.DEFAULT_INDEX);
    1.55 +      let itemId = PlacesUtils.bookmarks.insertBookmark(folderId,
    1.56 +                                                        NetUtil.newURI("http://www.mozilla.org/"),
    1.57 +                                                        PlacesUtils.bookmarks.DEFAULT_INDEX,
    1.58 +                                                        "bookmark");
    1.59 +      // Setup the places tree contents.
    1.60 +      var tree = document.getElementById("tree");
    1.61 +      tree.place = "place:folder=UNFILED_BOOKMARKS";
    1.62 +
    1.63 +      // Select the last bookmark.
    1.64 +      tree.selectItems([itemId]);
    1.65 +      is (tree.selectedNode.itemId, itemId, "The right node was selected");
    1.66 +    }
    1.67 +
    1.68 +  ]]></script>
    1.69 +</window>

mercurial