? Success

User tests: Successful: Unsuccessful:

avatar MrBenGriffin
MrBenGriffin
3 Mar 2014

Tracker 32989. If we are escaping tooltips for attributes, we need to escape the entire markup.
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32989&start=0

avatar MrBenGriffin MrBenGriffin - open - 3 Mar 2014
avatar wilsonge
wilsonge - comment - 3 Mar 2014

Hi,
You can just edit the tests to reflect this :) https://github.com/joomla/joomla-cms/blob/staging/tests/unit/suites/libraries/cms/html/JHtmlTest.php#L1388 They are found in this file. You can see what is passed in and what you expect to come out. If you can edit them to reflect your changes. If you're unsure let me know and I'll submit a PR to your branch to update them so they pass when I get home this evening

avatar MrBenGriffin
MrBenGriffin - comment - 3 Mar 2014

Brilliant! Thanks for that, I will have a go!

avatar wilsonge
wilsonge - comment - 3 Mar 2014

No worries :) Thanks for the submitting the code!!

avatar MrBenGriffin
MrBenGriffin - comment - 3 Mar 2014

Okay, I have added pull-requests for 7 related test files, cf. #3226 #3227 #3228 #3229 #3230

avatar MrBenGriffin
MrBenGriffin - comment - 3 Mar 2014

I did my very best but travis seems to be failing all my test pull-requests now!
I've got time to help out - but I still may need some assistance to get this all to work, I'm still new to this setup, as you know!

avatar wilsonge
wilsonge - comment - 3 Mar 2014

Not at all - i remember when I was new to this 18 months ago :)

Sorry it's my fault I should have been clearer what you need to do is make your pull requests to this branch. So you go to your fork of Joomla. Then you use the drop down to move to branch patch-1 then edit the test files there so all your changes are in the same place.

The reason the new PR's are failing is because this fix in this PR hasn't been applied to that branch if that makes sense? If it doesn't shout and I'll try and explain better :)

avatar MrBenGriffin
MrBenGriffin - comment - 3 Mar 2014

George, you are being incredibly helpful. Do (I think!) all the commits are in the same branch 'patch-1'. Should I open a new pull request with the changes, or ...?

avatar MrBenGriffin MrBenGriffin - change - 3 Mar 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-03-03 15:07:41
avatar MrBenGriffin MrBenGriffin - close - 3 Mar 2014
avatar MrBenGriffin MrBenGriffin - close - 3 Mar 2014
avatar MrBenGriffin MrBenGriffin - change - 3 Mar 2014
Status Closed New
avatar MrBenGriffin MrBenGriffin - reopen - 3 Mar 2014
avatar MrBenGriffin MrBenGriffin - reopen - 3 Mar 2014
avatar wilsonge
wilsonge - comment - 3 Mar 2014

No your completely fine in this PR. Any changes you make to the branch are automatically added to the PR :)

avatar MrBenGriffin
MrBenGriffin - comment - 3 Mar 2014

Okay great :+1: :D Yes, I just saw that I had missed a couple of tests.

avatar wilsonge
wilsonge - comment - 3 Mar 2014

One last test to fix :P It would appear you've decided to tweak the most well tested function in Joomla lol. Never seen this many tests that have needed changes :)

avatar MrBenGriffin
MrBenGriffin - comment - 3 Mar 2014

Hah. I have to say that many of the tests appear to be redundant (from where I am seeing them).. but let's not worry about rewriting the tooltip test strategy right now :D

avatar wilsonge
wilsonge - comment - 3 Mar 2014

Generally our test strategy is at best dodgy. But yeah this isn't probably the time to worry about it yet :)

avatar MrBenGriffin
MrBenGriffin - comment - 3 Mar 2014

okay, so i went through that file a bit more carefully.. another 1, then another 7 tests for the tooltip, all of which needed escaping..

avatar wilsonge
wilsonge - comment - 3 Mar 2014

Nice job! Don't you just love unit tests though :D

avatar MrBenGriffin
MrBenGriffin - comment - 3 Mar 2014

Hah! yes. I do really - but it's easy to feel aggravated by them! So once Travis gives this a clean bill of health, does it go through to some editorial board for review? Is that you?

avatar Bakual
Bakual - comment - 3 Mar 2014

The workflow is that once Travis is fine, testers are needed to test the patch and make sure it doesn't break anything. Everyone can test things. After testing, the results (good or bad) should be added to the tracker item.
After at least two successful tests are logged, someone from JBS will set the tracker to "Ready to Commit" and then a maintainer will have a final look over it and merge it.

avatar MrBenGriffin
MrBenGriffin - comment - 3 Mar 2014

Thomas, thanks!

avatar infograf768
infograf768 - comment - 4 Mar 2014

It looks like there are some code style issues with { }:
should be for example:
else
{
$result = $title;
}
-------not
else {
$result = $title;
}

avatar MrBenGriffin
MrBenGriffin - comment - 4 Mar 2014

hi - ok, sorry - used to a different set of house-rules. I can make the changes as required tomorrow. I will google for, and then review, the code style documentation for Joomla!.

avatar Bakual
Bakual - comment - 4 Mar 2014
avatar MrBenGriffin
MrBenGriffin - comment - 5 Mar 2014

The code style should now be good. I noticed a common pattern elsewhere in the code, which was not to include a newline when the comment was following a brace. This seems to ignore the style ruling:
"Always have a single blank line before a comment or block of comments." So I corrected that pattern. If I am in error (or if the style guide is in error) I apologise now.

avatar Bakual
Bakual - comment - 5 Mar 2014

Yes, codestyle is an ongoing process. We require it only for new contributions. That is only the lines you touch need to follow codestyle, you don't necessary need to fix the other ones.

If you want help improving our code, there is a codestyle initiative which is explained here: https://groups.google.com/d/msg/joomla-dev-cms/3nosYaSl3Tk/5KMXFEoMFjgJ

This seems to ignore the style ruling:
"Always have a single blank line before a comment or block of comments." So I corrected that pattern.

I would have to check what phpcs is enforcing here, but I think if the comment is after an curly brace ({ or }) we don't need a new line before it.

avatar MrBenGriffin
MrBenGriffin - comment - 5 Mar 2014

Thanks for that. Well, there seemed to be a good mix of 'include a newline after a brace' and not so, so I just normalised it. In future I will modify my own codestyle only, and submit separate PR for code style amends, in accordance with the initiative. Should I now revert the changes I made in this instance?

avatar Bakual
Bakual - comment - 5 Mar 2014

Should I now revert the changes I made in this instance?

If you can, revert it and check with phpcs and the Joomla codestyle rules. They would be here: https://github.com/joomla/coding-standards.
If it shows as error, you are welcome to leave it changed. If it passes the checks, you can revert it in the PR as well if you want.

avatar MrBenGriffin MrBenGriffin - change - 5 Mar 2014
Labels Added: ?
Removed: ?
avatar MrBenGriffin
MrBenGriffin - comment - 5 Mar 2014

The file now works against phpcs standard=Joomla.

However, I notice that there appears to be a conflict between the written styleguide and the Joomla standard in phpcs - namely, that the styleguide says "Always have a single blank line before a comment or block of comments." which is in direct conflict when the comment at the beginning of a control structure. phpcs errors with: "Blank line found at start of control structure" in this case.

So it seems to me that the styleguide should say "Always have a single blank line before a comment or block of comments unless the comment (or block) is at the beginning of a code structure".

I have added a PR 65 (!) to the coding-standards project. cf. joomla/coding-standards#65

avatar wilsonge
wilsonge - comment - 5 Mar 2014

Yeah I agree the written code style should be updated :)

avatar wilsonge
wilsonge - comment - 5 Mar 2014

joomla/coding-standards#66 how does that look?

avatar MrBenGriffin
MrBenGriffin - comment - 7 Mar 2014

I have noticed that there are a few places in Joomla code where unescaped elements are being used in attributes directly in the code, such as /components/com_users/views/profile/tmpl/edit.php
(line 84).

This breaks xml (and html) rules. Should I add these to this patch, or should I leave this patch be now?

I see that the Zend IDE is also picking this up as being broken (but it was for a different reason).

avatar MrBenGriffin
MrBenGriffin - comment - 7 Mar 2014

Instructions for testing
This test will highlight a single instance of the issue that the pull request addresses.

On a fresh install of Joomla 3.2.3, using 'Default English' install.

Go to home page of website (Getting Started, with blue flower).
Login using the login form

View source of the home page.
Line 66, attribute data-jmodtip is

"<strong>Edit module</strong><br />Main Menu<br />Position: position-1"

It should be

"&lt;strong&gt;Edit module&lt;/strong&gt;&lt;br /&gt;Main Menu&lt;br /&gt;Position: position-1"

cf. http://www.w3.org/TR/html-markup/syntax.html

avatar Kubik-Rubik
Kubik-Rubik - comment - 26 Jul 2014

@test @MrBenGriffin Works as described.

(But I would not use return more than once in the function. Create a return variable und return it in the end of the function. And also use elseif for better performance.)

Can be moved to RTC.

avatar mbabker mbabker - close - 3 Aug 2014
avatar mbabker mbabker - change - 3 Aug 2014
Status New Closed
Closed_Date 2014-03-03 15:07:41 2014-08-03 17:55:05
avatar mbabker mbabker - close - 3 Aug 2014
avatar Sophist-UK Sophist-UK - reference | 5dab261 - 7 Oct 14

Add a Comment

Login with GitHub to post a comment