OLD | NEW |
1 /* | 1 /* |
2 This file is part of the Juju GUI, which lets users view and manage Juju | 2 This file is part of the Juju GUI, which lets users view and manage Juju |
3 environments within a graphical interface (https://launchpad.net/juju-gui). | 3 environments within a graphical interface (https://launchpad.net/juju-gui). |
4 Copyright (C) 2012-2013 Canonical Ltd. | 4 Copyright (C) 2012-2013 Canonical Ltd. |
5 | 5 |
6 This program is free software: you can redistribute it and/or modify it under | 6 This program is free software: you can redistribute it and/or modify it under |
7 the terms of the GNU Affero General Public License version 3, as published by | 7 the terms of the GNU Affero General Public License version 3, as published by |
8 the Free Software Foundation. | 8 the Free Software Foundation. |
9 | 9 |
10 This program is distributed in the hope that it will be useful, but WITHOUT | 10 This program is distributed in the hope that it will be useful, but WITHOUT |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 assert(Y.Object.hasKey(sample, 'revno')); | 672 assert(Y.Object.hasKey(sample, 'revno')); |
673 | 673 |
674 // Commits should be ordered new to old. | 674 // Commits should be ordered new to old. |
675 var checkDate = new Date(); | 675 var checkDate = new Date(); |
676 Y.Array.each(commits, function(commit) { | 676 Y.Array.each(commits, function(commit) { |
677 assert(checkDate > commit.date); | 677 assert(checkDate > commit.date); |
678 checkDate = commit.date; | 678 checkDate = commit.date; |
679 }); | 679 }); |
680 }); | 680 }); |
681 | 681 |
| 682 it('must be able to determine if an icon should be shown', function() { |
| 683 var approved_with_icon = new models.BrowserCharm({ |
| 684 id: 'cs:precise/mysql-2', |
| 685 is_approved: true, |
| 686 files: ['icon.svg'] |
| 687 }); |
| 688 var approved_without_icon = new models.BrowserCharm({ |
| 689 id: 'cs:precise/mysql-2', |
| 690 is_approved: true, |
| 691 files: [] |
| 692 }); |
| 693 var unapproved_with_icon = new models.BrowserCharm({ |
| 694 id: 'cs:precise/mysql-2', |
| 695 is_approved: false, |
| 696 files: ['icon.svg'] |
| 697 }); |
| 698 var unapproved_without_icon = new models.BrowserCharm({ |
| 699 id: 'cs:precise/mysql-2', |
| 700 is_approved: false, |
| 701 files: [] |
| 702 }); |
| 703 assert.isTrue(approved_with_icon.get('shouldShowIcon')); |
| 704 assert.isFalse(approved_without_icon.get('shouldShowIcon')); |
| 705 assert.isFalse(unapproved_with_icon.get('shouldShowIcon')); |
| 706 assert.isFalse(unapproved_without_icon.get('shouldShowIcon')); |
| 707 }); |
| 708 |
682 it('tracks recent commits in the last 30 days', function() { | 709 it('tracks recent commits in the last 30 days', function() { |
683 instance = new models.BrowserCharm(data.charm); | 710 instance = new models.BrowserCharm(data.charm); |
684 var commits = instance.get('recent_commits'), | 711 var commits = instance.get('recent_commits'), |
685 today = new Date(); | 712 today = new Date(); |
686 | 713 |
687 // adjust the dates on there manually because the tests will be run on | 714 // adjust the dates on there manually because the tests will be run on |
688 // different days throwing things off. | 715 // different days throwing things off. |
689 Y.each([0, 1, 2], function(index) { | 716 Y.each([0, 1, 2], function(index) { |
690 commits[index].date = new Date(); | 717 commits[index].date = new Date(); |
691 commits[index].date.setDate(today.getDate() - (1 + index)); | 718 commits[index].date.setDate(today.getDate() - (1 + index)); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 assert.isFalse(mysql.hasErrors(), mysql.get('id')); | 789 assert.isFalse(mysql.hasErrors(), mysql.get('id')); |
763 }); | 790 }); |
764 | 791 |
765 it('can be filtered so that it returns only visible models', function() { | 792 it('can be filtered so that it returns only visible models', function() { |
766 var filtered = list.visible(); | 793 var filtered = list.visible(); |
767 assert.strictEqual(2, filtered.size()); | 794 assert.strictEqual(2, filtered.size()); |
768 assert.deepEqual([django, wordpress], filtered.toArray()); | 795 assert.deepEqual([django, wordpress], filtered.toArray()); |
769 }); | 796 }); |
770 | 797 |
771 }); | 798 }); |
OLD | NEW |