toolkit/components/places/tests/unit/test_bookmarks_html_singleframe.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_bookmarks_html_singleframe.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,32 @@
     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 +// Test for bug #801450
    1.11 +
    1.12 +// Get Services
    1.13 +Cu.import("resource://gre/modules/BookmarkHTMLUtils.jsm");
    1.14 +
    1.15 +function run_test()
    1.16 +{
    1.17 +  run_next_test();
    1.18 +}
    1.19 +
    1.20 +add_task(function test_bookmarks_html_singleframe()
    1.21 +{
    1.22 +  let bookmarksFile = OS.Path.join(do_get_cwd().path, "bookmarks_html_singleframe.html");
    1.23 +  yield BookmarkHTMLUtils.importFromFile(bookmarksFile, true);
    1.24 +
    1.25 +  let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarksMenuFolderId).root;
    1.26 +  do_check_eq(root.childCount, 1);
    1.27 +  let folder = root.getChild(0);
    1.28 +  PlacesUtils.asContainer(folder).containerOpen = true;
    1.29 +  do_check_eq(folder.title, "Subtitle");
    1.30 +  do_check_eq(folder.childCount, 1);
    1.31 +  let bookmark = folder.getChild(0);
    1.32 +  do_check_eq(bookmark.uri, "http://www.mozilla.org/");
    1.33 +  do_check_eq(bookmark.title, "Mozilla");
    1.34 +  folder.containerOpen = false;
    1.35 +});

mercurial