launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #02282
[Merge] lp:~gmb/launchpad/subscribe-using-api-bug-697619 into lp:launchpad
Graham Binns has proposed merging lp:~gmb/launchpad/subscribe-using-api-bug-697619 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
#697619 The subscription widget should fire an event when its form is submitted
https://bugs.launchpad.net/bugs/697619
For more details, see:
https://code.launchpad.net/~gmb/launchpad/subscribe-using-api-bug-697619/+merge/45353
This branch fixes bug 697619 by making the new subscribe widget fire a
subscriptionwizard:save event when its form is submitted. In a
subsequent branch we'll use this event to hook the new widget up to the
existing subscription functionality.
--
https://code.launchpad.net/~gmb/launchpad/subscribe-using-api-bug-697619/+merge/45353
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gmb/launchpad/subscribe-using-api-bug-697619 into lp:launchpad.
=== modified file 'lib/lp/bugs/javascript/bug_subscription_widget.js'
--- lib/lp/bugs/javascript/bug_subscription_widget.js 2010-12-14 10:42:45 +0000
+++ lib/lp/bugs/javascript/bug_subscription_widget.js 2011-01-06 11:48:18 +0000
@@ -39,6 +39,11 @@
steps: wizard_steps
});
namespace.subscription_wizard.render('#subscribe-wizard');
+ namespace.subscription_wizard.form_node.on(
+ 'submit', Y.bind(function(e) {
+ e.preventDefault();
+ Y.fire('subscriptionwizard:save');
+ }));
Y.fire('subscriptionwizard:ready');
};
=== modified file 'lib/lp/bugs/javascript/tests/test_bug_subscription_widget.js'
--- lib/lp/bugs/javascript/tests/test_bug_subscription_widget.js 2010-12-14 10:42:45 +0000
+++ lib/lp/bugs/javascript/tests/test_bug_subscription_widget.js 2011-01-06 11:48:18 +0000
@@ -4,7 +4,7 @@
base: '../../../../canonical/launchpad/icing/yui/',
filter: 'raw',
combine: false,
- fetchCSS: false
+ fetchCSS: true,
}).use(
'event', 'event-simulate', 'lazr.testing.mockio',
'lp.bugs.bug_subscription_wizard', 'node', 'test',
@@ -263,6 +263,30 @@
subscribe_form_body,
subscription_wizard.get('steps')[0].get('form_content'));
Assert.isTrue(subscription_wizard.get('visible'));
+ },
+
+ test_submitting_wizard_form_fires_event: function() {
+ // When the wizard form is submitted, a
+ // subscriptionwizard:save event is fired.
+ var subscriptionwizard_save_fired = false;
+ Y.on(
+ 'subscriptionwizard:save',
+ Y.bind(function(e) { subscriptionwizard_save_fired = true; }));
+ Y.on(
+ 'subscriptionwizard:ready',
+ Y.bind(function(e) {
+ var subscription_wizard =
+ Y.lp.bugs.bug_subscription_wizard.subscription_wizard;
+ var submit_button =
+ Y.one('input[type=submit]');
+ Y.Event.simulate(Y.Node.getDOMNode(submit_button), 'click');
+ Assert.isTrue(subscriptionwizard_save_fired);
+ }));
+
+ Y.lp.bugs.bug_subscription_wizard.initialize_subscription_wizard(
+ subscribe_node, 'http://example.com', mock_io);
+ mock_io.simulateXhr(success_response, false);
+ Y.lp.bugs.bug_subscription_wizard.show_wizard();
}
}));