mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
137 lines
5.8 KiB
XML
137 lines
5.8 KiB
XML
<?xml version="1.0"?>
|
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
|
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
|
<window title="Testing Application"
|
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
xmlns:html="http://www.w3.org/1999/xhtml">
|
|
|
|
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
|
|
|
<body xmlns="http://www.w3.org/1999/xhtml" />
|
|
|
|
<script type="application/javascript">
|
|
<![CDATA[
|
|
|
|
var gLastFolderAction = "";
|
|
var gLastBookmarkAction = "";
|
|
|
|
test_Bookmarks();
|
|
|
|
function test_Bookmarks() {
|
|
var root = Application.bookmarks;
|
|
ok(root, "Check access to bookmark root");
|
|
ok(!root.parent, "Check root parent (should be null)");
|
|
|
|
var rootKidCount = root.all.length;
|
|
|
|
// test adding folders
|
|
var testFolder = root.addFolder("FUEL");
|
|
ok(testFolder, "Check folder creation");
|
|
is(testFolder.type, "folder", "Check 'folder.type' after creation");
|
|
ok(testFolder.parent, "Check parent after folder creation");
|
|
|
|
rootKidCount++;
|
|
is(root.all.length, rootKidCount, "Check root folder child count after adding a child folder");
|
|
|
|
testFolder.events.addListener("change", onFolderChange);
|
|
testFolder.description = "FUEL folder";
|
|
is(testFolder.description, "FUEL folder", "Check setting 'folder.description'");
|
|
is(gLastFolderAction, "bookmarkProperties/description", "Check event handler for setting 'folder.description'");
|
|
|
|
testFolder.title = "fuel-is-cool";
|
|
is(testFolder.title, "fuel-is-cool", "Check setting 'folder.title'");
|
|
is(gLastFolderAction, "title", "Check event handler for setting 'folder.title'");
|
|
|
|
testFolder.annotations.set("testing/folder", "annotate-this", 0);
|
|
ok(testFolder.annotations.has("testing/folder"), "Checking existence of added annotation");
|
|
is(gLastFolderAction, "testing/folder", "Check event handler for setting annotation");
|
|
gLastFolderAction = "";
|
|
is(testFolder.annotations.get("testing/folder"), "annotate-this", "Checking existence of added annotation");
|
|
testFolder.annotations.remove("testing/folder");
|
|
ok(!testFolder.annotations.has("testing/folder"), "Checking existence of removed annotation");
|
|
is(gLastFolderAction, "testing/folder", "Check event handler for removing annotation");
|
|
|
|
|
|
testFolder.events.addListener("addchild", onFolderAddChild);
|
|
testFolder.events.addListener("removechild", onFolderRemoveChild);
|
|
|
|
var testBookmark = testFolder.addBookmark("Mozilla", "http://www.mozilla.com/");
|
|
ok(testBookmark, "Check bookmark creation");
|
|
ok(testBookmark.parent, "Check parent after bookmark creation");
|
|
is(gLastFolderAction, "addchild", "Check event handler for adding a child to a folder");
|
|
is(testBookmark.type, "bookmark", "Check 'bookmark.type' after creation");
|
|
is(testBookmark.title, "Mozilla", "Check 'bookmark.title' after creation");
|
|
is(testBookmark.uri, "http://www.mozilla.com/", "Check 'bookmark.uri' after creation");
|
|
|
|
is(testFolder.all.length, 1, "Check test folder child count after adding a child bookmark");
|
|
|
|
testBookmark.events.addListener("change", onBookmarkChange);
|
|
testBookmark.description = "mozcorp";
|
|
is(testBookmark.description, "mozcorp", "Check setting 'bookmark.description'");
|
|
is(gLastBookmarkAction, "bookmarkProperties/description", "Check event handler for setting 'bookmark.description'");
|
|
|
|
testBookmark.keyword = "moz"
|
|
is(testBookmark.keyword, "moz", "Check setting 'bookmark.keyword'");
|
|
is(gLastBookmarkAction, "keyword", "Check event handler for setting 'bookmark.keyword'");
|
|
|
|
testBookmark.title = "MozCorp"
|
|
is(testBookmark.title, "MozCorp", "Check setting 'bookmark.title'");
|
|
is(gLastBookmarkAction, "title", "Check event handler for setting 'bookmark.title'");
|
|
|
|
testBookmark.uri = "http://www.mozilla.org/"
|
|
is(testBookmark.uri, "http://www.mozilla.org/", "Check setting 'bookmark.uri'");
|
|
is(gLastBookmarkAction, "uri", "Check event handler for setting 'bookmark.uri'");
|
|
|
|
testBookmark.annotations.set("testing/bookmark", "annotate-this", 0);
|
|
ok(testBookmark.annotations.has("testing/bookmark"), "Checking existence of added annotation");
|
|
is(gLastBookmarkAction, "testing/bookmark", "Check event handler for setting annotation");
|
|
gLastBookmarkAction = "";
|
|
is(testBookmark.annotations.get("testing/bookmark"), "annotate-this", "Checking existence of added annotation");
|
|
testBookmark.annotations.remove("testing/bookmark");
|
|
ok(!testBookmark.annotations.has("testing/bookmark"), "Checking existence of removed annotation");
|
|
is(gLastBookmarkAction, "testing/bookmark", "Check event handler for removing annotation");
|
|
|
|
testBookmark.events.addListener("remove", onBookmarkRemove);
|
|
testBookmark.remove();
|
|
is(gLastBookmarkAction, "remove", "Check event handler for removing bookmark");
|
|
is(gLastFolderAction, "removechild", "Check event handler for removing a child from a folder");
|
|
is(testFolder.all.length, 0, "Check test folder child count after removing a child bookmark");
|
|
|
|
testFolder.events.addListener("remove", onFolderRemove);
|
|
testFolder.remove();
|
|
is(gLastFolderAction, "remove", "Check event handler for removing child folder");
|
|
rootKidCount--;
|
|
is(root.all.length, rootKidCount, "Check root folder child count after removing a child folder");
|
|
}
|
|
|
|
function onFolderChange(evt) {
|
|
gLastFolderAction = evt.data;
|
|
}
|
|
|
|
function onFolderRemove(evt) {
|
|
gLastFolderAction = evt.type;
|
|
}
|
|
|
|
function onFolderAddChild(evt) {
|
|
gLastFolderAction = evt.type;
|
|
}
|
|
|
|
function onFolderRemoveChild(evt) {
|
|
gLastFolderAction = evt.type;
|
|
}
|
|
|
|
function onBookmarkChange(evt) {
|
|
gLastBookmarkAction = evt.data;
|
|
}
|
|
|
|
function onBookmarkRemove(evt) {
|
|
gLastBookmarkAction = evt.type;
|
|
}
|
|
|
|
]]>
|
|
</script>
|
|
|
|
</window>
|