diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-29 23:12:14 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-29 23:12:14 +0200 |
commit | daa76d848d52b59b11760ac630c2de5044af688b (patch) | |
tree | ea1388133474e8d05c501dc00e2860355b6dce04 /tests/js/menuTests.js | |
parent | 0f48a14dadb8df1f3d17825b1bc7062d9a0b6225 (diff) |
added click handlers and buttons for menu.js
Diffstat (limited to 'tests/js/menuTests.js')
-rw-r--r-- | tests/js/menuTests.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/js/menuTests.js b/tests/js/menuTests.js index b0bebbed2..604cd160d 100644 --- a/tests/js/menuTests.js +++ b/tests/js/menuTests.js @@ -188,4 +188,32 @@ test('Removing a parent node should remove its children', function(){ equal(NewsTests.popMenu._children.length, 2); equal(NewsTests.popMenu.getSize(), 2); +}); + + +/** + * Unread count tests + */ +test('Setting an unread count of 0 should add the all_read class', function(){ + NewsTests.popMenu.updateNode(News.MenuNodeType.Folder, 1, {unreadCount: 0}); + var node = NewsTests.popMenu._findNode(News.MenuNodeType.Folder, 1); + equal(node._unreadCount, 0); + ok(node._$htmlElement.hasClass('all_read')); +}); + +test('Setting an unread count of 0 and then 12 should remove the all_read and hidden class', function(){ + NewsTests.popMenu.updateNode(News.MenuNodeType.Folder, 1, {unreadCount: 0}); + NewsTests.popMenu.triggerHideRead(); + NewsTests.popMenu.updateNode(News.MenuNodeType.Folder, 1, {unreadCount: 12}); + var node = NewsTests.popMenu._findNode(News.MenuNodeType.Folder, 1); + equal(node._unreadCount, 12); + ok(!node._$htmlElement.hasClass('all_read')); + ok(!node._$htmlElement.hasClass('hidden')); +}); + +test('Setting an unread count of 0 and triggering the hiding of read feeds should add the hidden class', function(){ + NewsTests.popMenu.updateNode(News.MenuNodeType.Folder, 1, {unreadCount: 0}); + NewsTests.popMenu.triggerHideRead(); + var node = NewsTests.popMenu._findNode(News.MenuNodeType.Folder, 1); + ok(node._$htmlElement.hasClass('hidden')); });
\ No newline at end of file |