Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2598)

Unified Diff: chrome/test/data/webui/md_bookmarks/item_test.js

Issue 2735953002: MD Bookmarks: Integrate new data store with UI elements (Closed)
Patch Set: calamity@ review Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webui/md_bookmarks/item_test.js
diff --git a/chrome/test/data/webui/md_bookmarks/item_test.js b/chrome/test/data/webui/md_bookmarks/item_test.js
index 8c1507fc48df215691a3a171a1fe535e9b97d21a..05d7fac3c7d8eeeb3c87213d4f9fc37b25e3e668 100644
--- a/chrome/test/data/webui/md_bookmarks/item_test.js
+++ b/chrome/test/data/webui/md_bookmarks/item_test.js
@@ -4,51 +4,36 @@
suite('<bookmarks-item>', function() {
var item;
+ var store;
var TEST_ITEM = createItem('0');
setup(function() {
+ store = new bookmarks.TestStore({
+ nodes: testTree(createFolder('1', [createItem(['0'])])),
+ });
+ bookmarks.Store.instance_ = store;
+
item = document.createElement('bookmarks-item');
+ item.itemId = '0';
replaceBody(item);
- item.item = TEST_ITEM;
});
test('changing the url changes the favicon', function() {
var favicon = item.$.icon.style.backgroundImage;
- item.set('item.url', 'http://www.mail.google.com');
+ store.data.nodes['0'] = createItem('0', {url: 'https://mail.google.com'});
+ store.notifyObservers();
assertNotEquals(favicon, item.$.icon.style.backgroundImage);
});
- test('changing isFolder_ hides/unhides the folder/icon', function() {
- item.isFolder_ = true;
- assertFalse(item.$['folder-icon'].hidden);
- assertTrue(item.$.icon.hidden);
-
- item.isFolder_ = false;
+ test('changing to folder hides/unhides the folder/icon', function() {
+ // Starts test as an item.
assertTrue(item.$['folder-icon'].hidden);
assertFalse(item.$.icon.hidden);
- });
- test('pressing the buttons fires the right event', function() {
- var counter = [0, 0, 0];
- document.addEventListener('select-item', function(e) {
- if (e.detail.range)
- counter[0]++;
- else if (e.detail.add)
- counter[1]++;
- else
- counter[2]++;
- });
-
- customClick(item);
- assertDeepEquals([0, 0, 1], counter);
-
- customClick(item, {shiftKey: true});
- assertDeepEquals([1, 0, 1], counter);
+ // Change to a folder.
+ item.itemId = '1';
- customClick(item, {ctrlKey: true});
- assertDeepEquals([1, 1, 1], counter);
-
- customClick(item, {shiftKey: true, ctrlKey: true});
- assertDeepEquals([2, 1, 1], counter);
+ assertFalse(item.$['folder-icon'].hidden);
+ assertTrue(item.$.icon.hidden);
});
});
« no previous file with comments | « chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.cc ('k') | chrome/test/data/webui/md_bookmarks/list_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698