~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/javascript/tests/test_subscription.js

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-04-25 17:46:32 UTC
  • mfrom: (12915.1.1 bug770217)
  • Revision ID: launchpad@pqm.canonical.com-20110425174632-eea1apitu05z78s2
[r=benji][bug=770217] structural subscriptions should trigger
        appropriate description and options on bug's +subscriptions page

Show diffs side-by-side

added added

removed removed

Lines of Context:
960
960
        }
961
961
    },
962
962
 
 
963
    setUp: function() {
 
964
        window.LP = {cache: {subscription_info: []}};
 
965
    },
 
966
 
 
967
    tearDown: function() {
 
968
        delete window.LP;
 
969
    },
 
970
 
963
971
    test_multiple_direct_subscriptions: function() {
964
972
        // It should not be possible to have multiple direct,
965
973
        // personal subscriptions.
993
1001
            direct_info.increases);
994
1002
    },
995
1003
 
 
1004
    test_only_structural_subscriptions: function() {
 
1005
        // There are only structural subscriptions.
 
1006
        var info = {
 
1007
            direct: _constructCategory(),
 
1008
            from_duplicates: _constructCategory()
 
1009
        };
 
1010
        info.count = info.direct.count + info.from_duplicates.count;
 
1011
        window.LP.cache.subscription_info.push(true);
 
1012
 
 
1013
        direct_info = module._get_direct_subscription_information(info);
 
1014
        Y.Assert.areSame(
 
1015
            module._reasons.NOT_PERSONALLY_SUBSCRIBED,
 
1016
            direct_info.reason);
 
1017
        Y.ArrayAssert.itemsAreEqual(
 
1018
            ['mute-direct-subscription',
 
1019
             'select-only-direct-subscription-metadata',
 
1020
             'select-only-direct-subscription-lifecycle'],
 
1021
            direct_info.reductions);
 
1022
        Y.ArrayAssert.itemsAreEqual(
 
1023
            [],
 
1024
            direct_info.increases);
 
1025
    },
 
1026
 
996
1027
    test_no_direct_subscriptions: function() {
997
1028
        // There is no direct subscription, but there are
998
1029
        // other subscriptions.