~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/javascript/tests/test_branchdiff.js

  • Committer: Colin Watson
  • Date: 2011-08-19 00:25:11 UTC
  • mfrom: (7675.1045.728 db-devel)
  • mto: This revision was merged to the branch mainline in revision 13909.
  • Revision ID: cjwatson@canonical.com-20110819002511-0x8hrqs1ckiqk53g
merge db-devel

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
        name: 'Test branch diff functions',
30
30
 
31
31
        /*
32
 
         * Diff overlays should reopen with multiple clicks.
 
32
         * Diff overlays should reopen with multiple clicks. The widget's
 
33
         * visible attribute must be toggled, too.
33
34
         */
34
35
        test_diff_overlay_multiple_opens: function() {
35
36
            // Setup mock client and initialize the link click handler.
36
37
            var mock_client = new MockClient();
37
38
            var link_node = Y.one('#test-diff-popup');
 
39
            var api_url = link_node.one('a.api-ref').getAttribute('href');
38
40
            module.link_popup_diff_onclick(link_node, mock_client);
39
41
            // Open the overlay once.
40
42
            link_node.one('a.diff-link').simulate('click');
41
 
            var overlay = Y.one('.yui3-pretty-overlay');
 
43
            var widget = module.rendered_overlays[api_url];
 
44
            var overlay = widget.get('boundingBox');
42
45
            Y.Assert.isNotNull(overlay);
43
46
            Y.Assert.areEqual(overlay.getStyle('display'), 'block');
 
47
            Y.Assert.isTrue(widget.get('visible'));
44
48
            // Close the overlay.
45
49
            overlay.one('.close a').simulate('click');
46
50
            Y.Assert.areEqual(overlay.getStyle('display'), 'none');
 
51
            Y.Assert.isFalse(widget.get('visible'));
47
52
            // Open it again.
48
53
            link_node.one('a.diff-link').simulate('click');
49
54
            Y.Assert.areEqual(overlay.getStyle('display'), 'block');
 
55
            Y.Assert.isTrue(widget.get('visible'));
50
56
        }
51
57
 
52
58
        }));