diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-30 00:00:20 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-30 00:00:20 +0200 |
commit | 3969be1203227619d547c8207eb0a9cd9e7fd203 (patch) | |
tree | eb636cae2d1cce87924ec30e6db997d0594c0759 /tests | |
parent | daa76d848d52b59b11760ac630c2de5044af688b (diff) |
more unittests for menu.js
Diffstat (limited to 'tests')
-rw-r--r-- | tests/js/menuTests.js | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/tests/js/menuTests.js b/tests/js/menuTests.js index 604cd160d..5aa8a4dc2 100644 --- a/tests/js/menuTests.js +++ b/tests/js/menuTests.js @@ -26,6 +26,7 @@ NewsTests.jsonStruct = [ type: News.MenuNodeType.Feed, unreadCount: 4, children: [], + icon: 'img/testing.png' }, { id: 3, @@ -182,8 +183,6 @@ test('Removing a non existent node should not change anything', function(){ test('Removing a parent node should remove its children', function(){ var child = NewsTests.popMenu.removeNode(News.MenuNodeType.Folder, 1); ok(child !== undefined); - - // top length should stay the same equal(NewsTests.$popMenuDomElem.children().length, 2); equal(NewsTests.popMenu._children.length, 2); equal(NewsTests.popMenu.getSize(), 2); @@ -192,6 +191,38 @@ test('Removing a parent node should remove its children', function(){ /** + * Updating nodes tests + */ +test('Updating a node should update the object', function(){ + var data = { + unreadCount: 112, + title: 'no way', + icon: 'test.png' + }; + + NewsTests.popMenu.updateNode(News.MenuNodeType.Feed, 2, data); + var node = NewsTests.popMenu._findNode(News.MenuNodeType.Feed, 2); + equal(node._unreadCount, data.unreadCount); + equal(node._title, data.title); + equal(node._icon, data.icon); +}); + + +test('Updating a node should update the dom', function(){ + var data = { + unreadCount: 112, + title: 'no way', + icon: 'test.png' + }; + + NewsTests.popMenu.updateNode(News.MenuNodeType.Feed, 2, data); + var node = NewsTests.popMenu._findNode(News.MenuNodeType.Feed, 2); + equal(node._$htmlElement.children('.title').html(), data.title); + //equal(node._$htmlElement.css('background-image'), data.icon); this fails in firefox, dunno why +}); + + +/** * Unread count tests */ test('Setting an unread count of 0 should add the all_read class', function(){ |