← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~deryck/launchpad/fix-test-multicheckbox-js into lp:launchpad

 

Deryck Hodge has proposed merging lp:~deryck/launchpad/fix-test-multicheckbox-js into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~deryck/launchpad/fix-test-multicheckbox-js/+merge/54911

This gets the test working again.  It is failing in Windmill builds since the content URL is http when run via Windmill and file when run via the browser directly.  The fix is to check on the pathname.

I could get fancy and RegEx the host name away and do an areEqual assert, but that will be slower for little gain.  Confirming the path seems good enough for this test to me.
-- 
https://code.launchpad.net/~deryck/launchpad/fix-test-multicheckbox-js/+merge/54911
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~deryck/launchpad/fix-test-multicheckbox-js into lp:launchpad.
=== modified file 'lib/lp/app/javascript/tests/test_multicheckboxwidget.js'
--- lib/lp/app/javascript/tests/test_multicheckboxwidget.js	2011-03-24 03:14:00 +0000
+++ lib/lp/app/javascript/tests/test_multicheckboxwidget.js	2011-03-25 18:12:37 +0000
@@ -157,9 +157,13 @@
         // the DOM is correctly updated.
         this.createWidget();
         simulate(this.widget.get('boundingBox'), '#edit-test-save', 'click');
-        var test_content = 'file:///api/devel/item1';
+        var test_content_path = '/api/devel/item1';
         var items = Y.one('[id="edit-test-items"]');
-        Y.Assert.areEqual(test_content, items.get('innerHTML'));
+        var expected_content = items.get('innerHTML');
+        // Assert that the content contains the path, to avoid
+        // conflicts with file:// or http:// URLs depending on
+        // how this test is run.
+        Y.Assert.isTrue(expected_content.indexOf(test_content_path) > 0);
     }
 
 }));