← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/launchpad/initseries-bug-829375 into lp:launchpad

 

Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/initseries-bug-829375 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #829375 in Launchpad itself: ""Copy options" on +initseries has no default."
  https://bugs.launchpad.net/launchpad/+bug/829375

For more details, see:
https://code.launchpad.net/~rvb/launchpad/initseries-bug-829375/+merge/72432

This branch fixes the default value for the "Copy options:" widget on +initseries. Drive-by fix: do not call hideSpinner on 'end' because this.error_handler.getFailureHandler() already calls it so hideSpinner gets called twice in case of a failure.

= Tests =

lib/lp/registry/javascript/distroseries/tests/test_initseries.html
(added testDefaultRebuildChoice)

= Q/A =

Load this page and make sure "Copy options:" is set to "copy".
https://dogfood.launchpad.net/rvbinitchecks/anothertest/+initseries
-- 
https://code.launchpad.net/~rvb/launchpad/initseries-bug-829375/+merge/72432
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/initseries-bug-829375 into lp:launchpad.
=== modified file 'lib/lp/registry/javascript/distroseries/initseries.js'
--- lib/lp/registry/javascript/distroseries/initseries.js	2011-08-09 15:57:31 +0000
+++ lib/lp/registry/javascript/distroseries/initseries.js	2011-08-22 14:26:35 +0000
@@ -83,9 +83,11 @@
                     self.hideErrors();
                     self.showSpinner();
                 },
-                success: Y.bind(this.success, this),
-                failure: this.error_handler.getFailureHandler(),
-                end: Y.bind(this.hideSpinner, this)
+                success: function() {
+                    self.hideSpinner();
+                    self.success();
+                },
+                failure: this.error_handler.getFailureHandler()
             },
             parameters: {
                 name: this.context.name,
@@ -220,7 +222,7 @@
             .set("choices", [
                 {text: "Copy Source and Rebuild", value: "rebuild"},
                 {text: "Copy Source and Binaries", value: "copy"}])
-            .set("choice", "Copy Source and Binaries")
+            .set("choice", "copy")
             .render(form_table_body);
     var form_actions =
         new DeriveDistroSeriesActionsWidget({

=== modified file 'lib/lp/registry/javascript/distroseries/tests/test_initseries.js'
--- lib/lp/registry/javascript/distroseries/tests/test_initseries.js	2011-08-09 15:51:53 +0000
+++ lib/lp/registry/javascript/distroseries/tests/test_initseries.js	2011-08-22 14:26:35 +0000
@@ -184,6 +184,14 @@
                 form_actions.deriveFromChoices.get("parents"));
         },
 
+        testDefaultRebuildChoice: function() {
+            var cache = {is_first_derivation: true};
+            var form_actions = initseries.setupWidgets(cache);
+            Assert.areEqual(
+                "copy",
+                form_actions.packageCopyOptions.get('choice').value);
+        },
+
         testIsNotFirstDerivation: function() {
             var cache = {
                 is_first_derivation: false,