[#32665] Feature jquery keepalive#2494
[#32665] Feature jquery keepalive#2494Chris-Jones-Gill wants to merge 10 commits intojoomla:masterfrom Chris-Jones-Gill:feature-jquery-keepalive
Conversation
.gitignore
Outdated
There was a problem hiding this comment.
This file should not be part of the PR imho.
There was a problem hiding this comment.
Ooops, it should not have been. How do I remove it?
|
You need to fix the unit tests for this :) To do so just remove the JHtml framework part of the array out here: https://github.com/KISS-Web-Design/joomla-cms/blob/feature-jquery-keepalive/tests/unit/suites/libraries/cms/html/JHtmlBehaviorTest.php#L640 If you being really good you might even add to the test to make sure jQuery is present |
|
What about moving the keepAlive function to the Also I'd like to see newlines at the beginning and end of script, otherwise rendered page source code becomes unreadable when there are few scripts placed one after another. // Attach keep alive to document
JFactory::getDocument()->addScriptDeclaration('
jQuery(document).ready(function() {
window.setInterval(
function(){ new jQuery.ajax({ type: "GET" }); },
' . $refreshTime . '
);
});
'); |
|
Thanks, didn't notice the failing test (my bad). I will fix it and update this PR. @piotr-cz I will add the newlines in, but the jQuery().ready is not the recommended syntax - according to the jQuery API. $( document ).ready( handler ) $( handler )Chris. |
There was a problem hiding this comment.
Nice :) You haven't defined $document so the test is failing and also this is in the switcher test not the keepalive test (although jquery is being included in this function - so you can leave this set of lines if you want :) )
There was a problem hiding this comment.
D'oh! Shouldn't try to rush things. Hopefully the latest commit corrects my mistakes. If not I will wait until I've had a good nights sleep before fixing.
Thanks for the feedback.
There was a problem hiding this comment.
Both jQuery tests still failing which is odd - beginning to wonder if we'd need to mock it in some way as something very odd is going on there.
There was a problem hiding this comment.
I suggest taking a look at how JHtmlJquery tests are set up and copying
that effort should fix your issues
On Friday, November 15, 2013, George Wilson wrote:
In tests/unit/suites/libraries/cms/html/JHtmlBehaviorTest.php:
@@ -233,6 +233,12 @@ public function testSwitcher()
JFactory::$application = $mock;
$this->assertArrayHasKey('/media/jui/js/jquery.min.js',$document->_scripts,Both jQuery tests still failing which is odd - beginning to wonder if we'd
need to mock it in some way as something very odd is going on there.—
Reply to this email directly or view it on GitHubhttps://github.com//pull/2494/files#r7705190
.
… instance BEFORE referencing it. D'oh! Added the jQuery test to testSwitcher by mistake previously, but as it is a valid test it has been corrected and left in.
…live because they are failing and I don't understand why - as the jQuery test is not part of the original test structure, removing what I added (hoping to improve the test, but failing) is probably the best idea for now. The test for jQuery presence could be added at a later date by someone who understands the test structure and phpUnit better than I.
|
From what I can tell, the code looks good. We just need some test instructions and good tests. @KISS-Web-Design can you provide instructions on testing this? |
|
No problem, I'll write something up and post it here and on the tracker. Chris. On Wednesday, 11 December 2013, Matt Thomas wrote:
Chris Jones-Gill |
Awesome, thanks. |
Test InstructionsYou will need to be comfortable using the web inspector tools of your preferred browser, I use Chrome Inspector and Firebug (on Firefox). 1. Before applying the patch ensure that the MooTools keepAlive function is loaded.visit Check the <head> for the following code It will look something like this Wait for at least 15 minutes, then use the inspector to check that the site has been reloaded in the background - evidenced by a GET of the page. It will look something like this 2. Apply the patch, and reload the site page.Or navigate back to Check the <head> for the following code It will look something like this Wait for at least 15 minutes, then use the inspector to check that the site has been reloaded in the background - evidenced by a GET of the page. It will look something like this 3. Respond hereWith a +1, success, or other positive test result affirmation. Thanks for testing. Chris. |
|
Thanks for the instructions. Just a note: The test results should be posted in the tracker. Of course you can also add them here, but the tracker is currently still the point of thruth. |
|
@Bakual , I have also posted the same instructions on the tracker - but there are some people that don't have tracker accounts (or refuse to use it), so I would rather have test results posted here and there than exclude people. I don't mind doing a copy/paste from here to the tracker to keep all the results together. |
|
@KISS-Web-Design agreed :) |
|
Closed in favor of #3376 |




Change the keepalive function to use jQuery instead of MooTools.
Tracker http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32665&start=600