launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #05006
[Merge] lp:~nigelbabu/launchpad/js-regression-849121 into lp:launchpad
Nigel Babu has proposed merging lp:~nigelbabu/launchpad/js-regression-849121 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #849121 in Launchpad itself: "Autolinked bugs should also have title attribute with bug title"
https://bugs.launchpad.net/launchpad/+bug/849121
For more details, see:
https://code.launchpad.net/~nigelbabu/launchpad/js-regression-849121/+merge/75858
= Description =
Fixes the JavaScript edge case of having no branches or no bugs. Added more javascript tests to catch the edge cases.
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/app/javascript/lp-links.js
lib/lp/app/javascript/tests/test_lp_links.js
--
https://code.launchpad.net/~nigelbabu/launchpad/js-regression-849121/+merge/75858
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~nigelbabu/launchpad/js-regression-849121 into lp:launchpad.
=== modified file 'lib/lp/app/javascript/lp-links.js'
--- lib/lp/app/javascript/lp-links.js 2011-09-15 19:10:53 +0000
+++ lib/lp/app/javascript/lp-links.js 2011-09-17 16:07:19 +0000
@@ -28,6 +28,9 @@
// We have a collection of valid and invalid links containing links of
// type link_type, so we need to remove the existing link_class,
// replace it with an invalid-link class, and set the link title.
+ if(!Y.Lang.isValue(link_info[link_type])) {
+ return;
+ }
var invalid_links = link_info[link_type].invalid || {};
var valid_links = link_info[link_type].valid || {};
=== modified file 'lib/lp/app/javascript/tests/test_lp_links.js'
--- lib/lp/app/javascript/tests/test_lp_links.js 2011-09-15 15:34:13 +0000
+++ lib/lp/app/javascript/tests/test_lp_links.js 2011-09-17 16:07:19 +0000
@@ -8,7 +8,7 @@
var mock_io = new Y.lp.testing.mockio.MockIo();
suite.add(new Y.Test.Case({
- name: 'test_bugs',
+ name: 'test_bugs_branches',
setUp: function() {
links.check_valid_lp_links(mock_io);
@@ -30,6 +30,41 @@
});
},
+ test_bugs_branches: function () {
+ var validbug = Y.one('#valid-bug');
+ var invalidbug = Y.one('#invalid-bug');
+ var validbranch = Y.one('#valid-branch');
+ var invalidbranch = Y.one('#invalid-branch');
+ Y.Assert.isTrue(validbug.hasClass('bug-link'));
+ Y.Assert.isTrue(invalidbug.hasClass('invalid-link'));
+ Y.Assert.areSame(
+ 'jokosher exposes personal details in its actions portlet',
+ validbug.get('title')
+ );
+ Y.Assert.isTrue(validbranch.hasClass('branch-short-link'));
+ Y.Assert.isTrue(invalidbranch.hasClass('invalid-link'));
+ }
+ }));
+
+ suite.add(new Y.Test.Case({
+ name: 'test_bugs',
+
+ setUp: function() {
+ links.check_valid_lp_links(mock_io);
+ var response = {
+ "bug_links": {
+ "valid": {
+ "/bugs/14": [
+ "jokosher exposes personal details ",
+ "in its actions portlet"].join('')},
+ "invalid": {
+ "/bugs/200": "Bug 200 cannot be found"}}};
+ mock_io.success({
+ responseText: Y.JSON.stringify(response),
+ responseHeaders: {'Content-type': 'application/json'}
+ });
+ },
+
test_bugs: function () {
var validbug = Y.one('#valid-bug');
var invalidbug = Y.one('#invalid-bug');
@@ -39,6 +74,23 @@
'jokosher exposes personal details in its actions portlet',
validbug.get('title')
);
+ }
+ }));
+
+ suite.add(new Y.Test.Case({
+ name: 'test_bugs',
+
+ setUp: function() {
+ links.check_valid_lp_links(mock_io);
+ var response = {
+ "branch_links": {
+ "invalid": {
+ "/+branch/invalid":
+ "No such product: 'invalid'."}}};
+ mock_io.success({
+ responseText: Y.JSON.stringify(response),
+ responseHeaders: {'Content-type': 'application/json'}
+ });
},
test_branch: function () {