Re: [econsensus] Update the version of jQuery being used to the latest one. (#159)

11 views
Skip to first unread message

Sarah Bird

unread,
Aug 9, 2013, 1:43:46 PM8/9/13
to Aptivate - Tech, econsens...@googlegroups.com
Hi all,

After getting myself confused on Friday about live and whatnot I've had sometime to think about this more.

1) I am sure it is not necessary to upgrade jquery to implement actionitems. It may be more convenient, but it can't be necessary (because you could just write the plain javascript if you really needed to).
2) The client side javascript is a bit of a mess. I would propose doing an overhaul of the javascript properly.

3) THIS IS AN EXCELLENT OPPORTUNITY. We have no tests in place to validate whether things are still working. The selenium webtest branch is all setup raring to go. Writing some selenium web-tests to test the client side javascript functionality would be an excellent way of providing test coverage we want anyway and giving us a level of comfort when upgrading.

Best,

Bird

On Fri, Aug 9, 2013 at 9:37 AM, Tom <duck...@gmail.com> wrote:
As a less-techy, I'm interested to understand more about:

- presumably we'll want to do this *sometime* ?

- what are the implications of upgrading in terms of time hit? Create branch, run tests, and see?

I guess this thinking process applies to most projects, for various upgrade-able things. Be good to share some best practice.

Cheers,
Tom

From: daniell <notifi...@github.com>
Date: Fri, 09 Aug 2013 09:23:07 -0700
To: aptivate/econsensus<econs...@noreply.github.com>
Subject: [econsensus] Update the version of jQuery being used to the latest one. (#159)

For various reasons, it has become desirable to update the version of jQuery we're using to the latest one. These include making it easier to use client side validation on action item forms to allow for in-line adding and updating of action items, as well as problems with the 'live' method we're currently depending on.

There are a few things that would need updating, but is there any good reason not to do this?


Reply to this email directly or view it on GitHub.




--
skype: birdsarah
email: sb...@alum.mit.edu
web: www.sarahbird.org | www.bonvaya.com

Marko Samastur

unread,
Aug 10, 2013, 2:50:00 AM8/10/13
to econsens...@googlegroups.com
On 8/9/13 7:43 PM, Sarah Bird wrote:
> Hi all,
>
> After getting myself confused on Friday about live and whatnot I've had
> sometime to think about this more.
>
> 1) I am sure it is not necessary to upgrade jquery to implement
> actionitems. It may be more convenient, but it can't be necessary
> (because you could just write the plain javascript if you really needed to).

That's true, but switching to 1.7 would still be a good idea.

.live() was removed in 1.9 and switch to 1.7 would mean that existing
code would still work, but new code could use .on() (added in 1.7) so
technical debt would not increase.

Unless of course we would like to stop using jQuery :)

Agree with the rest.

Marko

Sarah Bird

unread,
Aug 10, 2013, 1:13:40 PM8/10/13
to econsens...@googlegroups.com
Yes. But with the code in a mess and no tests I'd prefer to put things in place to check things are still working. I'd also like to separate action items implementation from jquery upgrade.


        Marko

--
You received this message because you are subscribed to the Google Groups "econsensusdiscuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to econsensusdisc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Marko Samastur

unread,
Aug 10, 2013, 3:50:49 PM8/10/13
to econsens...@googlegroups.com, tech
Hi Sarah,

Release notes for 1.7:
http://blog.jquery.com/2011/11/03/jquery-1-7-released/

While in principle every new code can cause a regression, there's not
much there where you would expect one. API-wise it's practically the
same with what we have in 1.6.4 except that includes .on/.off methods.

Code's mess and lack of tests is an orthogonal problem. Not only can we
not tell what's broken and what not (with 1.6.4. or 1.7.2), the process
of finding out and fixing it will be exactly the same with both of them.
Keeping current version does not gain you anything.

I am not saying we should switch to 1.7 and then immediately deploy. And
I picked 1.7 instead of a more recent version because I think it is
highly unlikely it would cause problems.

If we won't write Javascript for action items, then it doesn't matter
which lib we use (or if we switch). If we will, then we will likely
handle events at some point where it would be neat if we used .on/.off
instead of older (and partially already removed methods).

But enough of my view. What do you think should be done and in what order?

My understanding is that you would start with Javascript tests, but then
what? Clean existing Javascript code or proceed with action items?

Best,

Marko
> <mailto:econsensusdiscuss%2Bunsu...@googlegroups.com>.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
> --
> skype: birdsarah
> email: sb...@alum.mit.edu <mailto:sb...@alum.mit.edu>
> web: www.sarahbird.org <http://www.sarahbird.org> | www.bonvaya.com
> <http://www.bonvaya.com>

Jo Paulger

unread,
Aug 11, 2013, 8:57:22 AM8/11/13
to econsens...@googlegroups.com, tech
As far as I'm concerned, the only reason we haven't upgraded jquery is lack of time. 

I am aware though that there's a bit of work to do when we do because we're currently using .live() in order to bind event handlers to elements that don't yet exist at page load (those elements are only loaded when an user clicks to add or edit Feedback at which point we shove in the html for the form). It's not clear to me whether .on() allows for this, or if we'd need to add some javascript to bind the event handlers that would run at the point where that extra html is created, rather than on document load.

I'm not comfortable with the tangle of js that's inline in the template either, so it would be good to separate/tidy it, and would be great to create some carefully chosen tests.

Jo.

Marko Samastur

unread,
Aug 11, 2013, 9:24:41 AM8/11/13
to econsens...@googlegroups.com, tech
On 8/11/13 2:57 PM, Jo Paulger wrote:
> loaded when an user clicks to add or edit Feedback at which point we
> shove in the html for the form). It's not clear to me whether .on()
> allows for this, or if we'd need to add some javascript to bind the
> event handlers that would run at the point where that extra html is
> created, rather than on document load.

It does and 1.7 has both, old live() and newer on().

Marko

Jo Paulger

unread,
Aug 11, 2013, 9:56:29 AM8/11/13
to econsens...@googlegroups.com, tech

On 11 August 2013 14:24, Marko Samastur <mar...@gaivo.net> wrote:
It's not clear to me whether .on()
> allows for this, or if we'd need to add some javascript to bind the
> event handlers that would run at the point where that extra html is
> created, rather than on document load.

It does

OK great. Thanks.

Jo Paulger

unread,
Aug 12, 2013, 4:38:46 AM8/12/13
to Daniel Levy, Sarah Bird, econsens...@googlegroups.com, tech
Hi Daniel,

Sounds good, and great that you'll be spending lots of time on econsensus! :D

With regards action items, I started on the finishing off work on that branch back in January (squirms at how long I've been "in progress" on this). I've pushed my WIP branch to github - there is a little bit of Javascript tidying and a few bug fixes which would be good to keep. IIRC, the action items work was (at least originally) on Sarah's github account, but unless Sarah's done any more work on it there, it should all be in that branch of mine. This branch is of course pre-dye merge/refactor so things (like settings.py) are still in the old location. I'll reforward you the email about those changes next.

Hope that helps!

Jo


On 12 August 2013 09:19, Daniel Levy <dan...@aptivate.org> wrote:
Hi Sarah, Jo,

Given this conversation, I would like to do the following:
  1. Go through all the Javascript and create selenium tests (I would appreciate help finding all the things that need testing).
  2. Upgrade jQuery to a later version (which one will be less important once the tests are in place).
  3. Refactor the current Javascript.
  4. Add the Javascript for action items.

I don't appear to be on another project until September, so I'll have lots of time for this. Shall I proceed?

Regards,

Daniel

-- 
Daniel Levy

Aptivate | http://www.aptivate.org/ | +44 (0)1223 967838
Citylife House, Sturton St, Cambridge, CB1 2QF

Aptivate is a not-for-profit company registered in England and Wales
with company number 04980791. 

Sarah Bird

unread,
Aug 12, 2013, 8:26:39 PM8/12/13
to Daniel Levy, Jo Paulger, econsens...@googlegroups.com, tech
Sounds good. Not working this week, but happy to provide more guidance when I'm back.

Bird

On 12 August 2013 01:19, Daniel Levy <dan...@aptivate.org> wrote:
Hi Sarah, Jo,

Given this conversation, I would like to do the following:
  1. Go through all the Javascript and create selenium tests (I would appreciate help finding all the things that need testing).
  2. Upgrade jQuery to a later version (which one will be less important once the tests are in place).
  3. Refactor the current Javascript.
  4. Add the Javascript for action items.

I don't appear to be on another project until September, so I'll have lots of time for this. Shall I proceed?

Regards,

Daniel


On 10/08/13 20:50, Marko Samastur wrote:
-- 
Daniel Levy

Aptivate | http://www.aptivate.org/ | +44 (0)1223 967838
Citylife House, Sturton St, Cambridge, CB1 2QF

Aptivate is a not-for-profit company registered in England and Wales
with company number 04980791. 



--
Sarah Bird
sa...@aptivate.org
skype: birdsarah

Daniel Levy

unread,
Aug 13, 2013, 11:16:41 AM8/13/13
to econsens...@googlegroups.com, Daniel Levy, Jo Paulger, tech
I've started work on adding Selenium tests for these. So far I've done tests for:
  • displaying the add action item form
  • clicking cancel on the add action item form
  • submitting the add action item form with valid data
  • submitting the add action item form  with invalid data
  • displaying the edit action item form 
  • clicking cancel on the edit action item form 
  • submitting the edit action item form with valid data
  • submitting the edit action item form with invalid data
My list of things still to test is as follows:
  • Repeat the above for feedback forms
  • Check the functionality of the plus buttons
  • Check that the figures for feedback types are updated when feedback is added or changes type
If anyone can think of anything else I should be testing then please let me know.
Reply all
Reply to author
Forward
0 new messages