← Back to team overview

launchpad-dev team mailing list archive

Results from upgrading YUI3 PR2 to Beta1

 

Hi everyone,

So I decided to do an experiment where I would upgrade one widget from YUI3 PR2 to YUI3 Beta1. The results are promising: it wasn't much work at all, half a day. However, when you do encounter a problem, even with tests, it can take some work to track the solution down.

I've attached a diff of the changes: 20 lines changed. Not bad at all. Here is a list of what I had to do:

- ATTRS set/get renamed to setter/getter
- Y.use('yuitest') becomes Y.use('test')
- Rename Y.Plugin to Y.Plugin.Base
- Rename plugin's config.owner to config.host
- Make use of Plugin.get('host') instead of this._owner
- Watch out for Y.on() - the signature has changed, and the fourth 'context' argument no longer works. Replace with Node.on(), or Y.bind(). - Node.queryAll()'s signature changed. It now returns an empty sentinel object with size() == 0 if no results were found, instead of returning 'null'.

I also have a migration branch here: lp:~mars/lazr-js/yui3b1

All the fix sites can be found by grepping the source files. The real unknown, and potential time sink, is upgrading lazr.PrettyOverlay() and lazr.AutoComplete, since those get close to the guts of the implementation.

The other big problem is deploying the new version of lazr-js. You can not mix and match the lazr-js, Launchpad, and YUI versions. Right now the upgrade will be "all or nothing", and I really don't like that. If anyone has a suggestion as to how we can tackle this, then please let me know.

Best,
Maris
=== modified file 'src/inlineedit/editor.js'
--- src/inlineedit/editor.js	2009-03-16 16:14:15 +0000
+++ src/inlineedit/editor.js	2009-08-03 21:00:10 +0000
@@ -149,7 +149,7 @@
      */
     submit_button: {
         value: null,
-        set: function(v) { return this._setNode(v); }
+        setter: function(v) { return this._setNode(v); }
     },
 
     /**
@@ -161,7 +161,7 @@
      */
     cancel_button: {
         value: null,
-        set: function(v) { return this._setNode(v); }
+        setter: function(v) { return this._setNode(v); }
     },
 
     /**
@@ -172,7 +172,7 @@
      */
     error_message: {
         value: null,
-        set: function(v) { return this._setNode(v); }
+        setter: function(v) { return this._setNode(v); }
     },
 
     /**
@@ -554,7 +554,7 @@
         /**
          * Fires after the input box has been resized vertically (which
          * may involve asynchronous animation).
-         * 
+         *
          * @event shrink
          */
         this.publish(RESIZED);
@@ -891,7 +891,7 @@
      * @type Node
      */
     trigger: {
-        set: function(node) {
+        setter: function(node) {
             if (this.get(RENDERED)) {
                 this._bindTrigger(node);
             }
@@ -907,7 +907,7 @@
      * @type Node
      */
     text: {
-        set: function(v) {
+        setter: function(v) {
             return Y.Node.get(v);
         },
         validator: function(v) {
@@ -924,7 +924,7 @@
      * @readOnly
      */
     value: {
-        get: function() {
+        getter: function() {
             // Return the normalized text.
             return this.get(TEXT).get('text');
         },
@@ -940,7 +940,7 @@
      */
     accept_empty: {
         value: false,
-        get: function() {
+        getter: function() {
             if (this.editor) {
                 return this.editor.get(ACCEPT_EMPTY);
             }
@@ -1229,7 +1229,7 @@
         if (this._click_handler) {
             this._click_handler.detach();
         }
-        this._click_handler = Y.on('click', this._triggerEdit, node, this);
+        this._click_handler = node.on('click', this._triggerEdit, this);
     },
 
 

=== modified file 'src/inlineedit/tests/inline_edit.js'
--- src/inlineedit/tests/inline_edit.js	2009-03-11 13:30:00 +0000
+++ src/inlineedit/tests/inline_edit.js	2009-08-04 03:20:11 +0000
@@ -4,7 +4,7 @@
     base: '../../../lib/yui/current/build/',
     filter: 'raw',
     combine: false
-    }).use('lazr.editor', 'node', 'event', 'yuitest', 'console', function(Y) {
+    }).use('lazr.editor', 'node', 'event', 'test', 'console', function(Y) {
 
 var Assert = Y.Assert;  // For easy access to isTrue(), etc.
 
@@ -873,16 +873,16 @@
             box.queryAll('.yui-ieditor-btns-single-line').size(),
             "Single-line editor should have exactly 1 button box.");
         Assert.areEqual(
-            null,
-            box.queryAll('.yui-ieditor-btns-multi-line'),
+            0,
+            box.queryAll('.yui-ieditor-btns-multi-line').size(),
             "Single-line editor should not have multi-line button boxes.");
     },
 
     test_multi_line_button_boxes: function() {
         var box = this.multi.editor.get('contentBox');
         Assert.areEqual(
-            null,
-            box.queryAll('.yui-ieditor-btns-single-line'),
+            0,
+            box.queryAll('.yui-ieditor-btns-single-line').size(),
             "Multi-line editor should not have single-line button boxes.");
         Assert.areEqual(
             2,
@@ -1101,7 +1101,7 @@
 
     test_undersize_adds_lines: function() {
         var roomy = this._pretendResize(this.large_size, this.long_line);
-        var tight = this._pretendResize(this.small_size); 
+        var tight = this._pretendResize(this.small_size);
         this._assertLower(
             roomy,
             tight,
@@ -1110,7 +1110,7 @@
 
     test_oversize_removes_lines: function() {
         var tight = this._pretendResize(this.small_size, this.long_line);
-        var roomy = this._pretendResize(this.large_size); 
+        var roomy = this._pretendResize(this.large_size);
         this._assertLower(
             roomy,
             tight,
@@ -1154,7 +1154,8 @@
 Y.Test.Runner.add(suite);
 
 var yconsole = new Y.Console({
-    newestOnTop: false
+    newestOnTop: false,
+    width: '35em'
 });
 yconsole.render('#log');
 

=== modified file 'src/testing/assets/testlogger.css'
--- src/testing/assets/testlogger.css	2009-02-20 17:41:32 +0000
+++ src/testing/assets/testlogger.css	2009-08-03 19:43:04 +0000
@@ -1,6 +1,6 @@
 /* Taken and customized from testlogger.css */
-#log .yui-console-content { width: 44em }
-#log .yui-console .yui-console-bd { height: 30em }
+/*#log .yui-console-content { width: 44em }*/
+/*#log .yui-console .yui-console-bd { height: 30em }*/
 #log .yui-console .yui-console-controls { display: none; }
 #log .yui-console .yui-console-hd { display: none; }
 #log .yui-console .yui-console-ft { position: absolute; top: 0; }

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups