toolkit/components/places/tests/unit/test_429505_remove_shortcuts.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/components/places/tests/unit/test_429505_remove_shortcuts.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim:set ts=2 sw=2 sts=2 et: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +/*
    1.11 +
    1.12 +- add a folder
    1.13 +- add a folder-shortcut to the new folder
    1.14 +- query for the shortcut
    1.15 +- remove the folder-shortcut
    1.16 +- confirm the shortcut is removed from the query results
    1.17 +
    1.18 +*/
    1.19 +
    1.20 +function run_test() {
    1.21 +    const IDX = PlacesUtils.bookmarks.DEFAULT_INDEX;
    1.22 +    var folderId = 
    1.23 +      PlacesUtils.bookmarks.createFolder(PlacesUtils.toolbarFolderId, "", IDX);
    1.24 +
    1.25 +    var queryId =
    1.26 +      PlacesUtils.bookmarks.insertBookmark(PlacesUtils.toolbarFolderId,
    1.27 +                                           uri("place:folder=" + folderId), IDX, "");
    1.28 +    
    1.29 +    var root = PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId, false, true).root;
    1.30 +
    1.31 +    var oldCount = root.childCount;
    1.32 +
    1.33 +    PlacesUtils.bookmarks.removeItem(queryId);
    1.34 +
    1.35 +    do_check_eq(root.childCount, oldCount-1);
    1.36 +
    1.37 +    root.containerOpen = false;
    1.38 +}

mercurial