-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Conversation
I would like to back this with tests, but I could use a little guidance there. (I naively attempted to remove the |
@@ -9,6 +9,7 @@ define( [ "jquery", | |||
"../../core", | |||
"../../widget", | |||
"./textinput", | |||
"../../events", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jugglinmike thanks for catching this however I think this should depend on just "../../events/touch" i dont see any references to orientationchange, throttledresize, or navigate events in either widget.
@jugglinmike yes that is needed to initialize the library and make autoinit work however i think what we want to test here is that it works without autoinit and the rest of the library for this we have https://github.com/jquery/jquery-mobile/tree/master/tests/unit/individual-modules these are to make sure a build with just that widget works. I think this is what we need for slider and rangeslider. |
@jugglinmike Nice catch! |
Thanks! @arschmitz: In order to test this, I plan to simulate two mouse clicks on the slider/rangeslider. This doesn't seem like a unit test exactly, so I wanted to check with you to see if that's the same approach you had in mind. If so, does jQuery Mobile's test infrastructure have any tooling for pointer event simulation that I can re-use? |
(also: I've updated the dependency lists to specifically reference the |
@jugglinmike any interest in still working on tests for this? If so i'm happy to help in any way you need. |
@arschmitz Certainly! Could you tell me if I was on the right track with this comment? |
@jugglinmike sorry i thought i had responded to that but clearly I didn't. I think we need two types of tests here. one similar to these tests https://github.com/jquery/jquery-mobile/tree/master/tests/unit/individual-modules to make sure the widget properly initializes on its own this covers the second problem of broken builds. Then a second test like what you mention in your comment. For something like this we generally just trigger a click with proper event data you can see similar tests using simulated mouse events here https://github.com/jquery/jquery-mobile/blob/32902786925aa7b5ddc8d2b989bfc65a5fe80def/tests/unit/slider/slider_events.js#L248 @jugglinmike if you have any other questions please just let me know. |
Got the first tests in. Now working on the click tests... |
@arschmitz I've run up against a problem: I can't reproduce this in the test environment as it stands today. The environment explicitly depends on the This means that the change I'm proposing will be undetectable from that Some of the existing tests depend on the I want to hear your thoughts on that approach before I try that, though. |
@jugglinmike all of our normal tests explicitly depend on the init module I think we want to keep that as is at least for now. For tests which we explicitly don't want the init module, like for these tests I think we should add those to the individual module tests so in this case the additional tests would go in the slider_core and rangeslider_core files you added already. We probably want to reconsider the organization of these tests as we add more ( not just being all in a single folder as they are now but thats more or less unrelated ) |
Alrighty @arschmitz I've added the tests to the respective It's a lot of test code, so I'm sure there's plenty I got wrong in terms of structure for this project. Just let me know what needs changing! |
TravisCI is reporting a test error for the "TYPES=unit JQUERIES=git" build:
This looks unrelated. Can you verify, @arschmitz? |
This is indeed unrelated ill look at the tests shortly one thing i realized though is rather then depend on all of events we should be good with just vmouse since we are not using tap taphold swipe or scroll start which are the other touch events |
@arschmitz Updated to depend on the |
@jugglinmike awesome im going to pull this local and review it in detail ill let you know if i see anything. |
var rangeslider = $( "#plain" ).rangeslider(); | ||
var handles = rangeslider.parent().find( ".ui-slider-handle" ); | ||
var track = handles.closest( ".ui-slider-track" ); | ||
var offset = handles.offset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a single car statements and comma separate each variable on a separate line.
handle.trigger(down); | ||
handle.trigger(move); | ||
handle.trigger(up); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also: this semicolon is unnecessary. I'll remove it.
Thanks for the feedback, @arschmitz! I think I've addressed it all. I haven't squashed the changes in case that helps you review, but I'm happy to do so at your request. |
track = handles.closest( ".ui-slider-track" ), | ||
offset = handles.offset(); | ||
|
||
deepEqual( rangeslider.rangeslider( "widget" ).hasClass( "ui-rangeslider" ), true, "Has class ui-rangeslider" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
max line length 100chars
@jugglinmike sorry I missed those line lengths last night but iv tested local and double checked and everything looks good after these. So if you want to squash at the same ill push this to master when your done. Thanks for all the work on this! |
No worries, @arschmitz. I've wrapped the three lines you identified using the |
@jugglinmike looks great if you want to squash all the commits ill push it to master |
Both modules have a hard dependency on the "vmouse" module that should be expressed in AMD. Closes jquery-archivegh-7274
Alright @arschmitz . Although I think this should be (at least) two separate commits, I found one example of a multi-module commit in |
@jugglinmike ah you are right i think it should have been two commits but its fine . Thanks for the contribution! |
The commit message should also say "Re gh-5987". |
Both modules have a hard dependency on the "vmouse" module that should be expressed in AMD. Re jquery-archivegh-5987 Closes jquery-archivegh-7274
@gabrielschulhof Done. Think this is ready to merge? |
@jugglinmike it is ready i already pulled rebased tested and added the |
@arschmitz Another late night, maybe? :P |
@arschmitz - To which branch did you push this? For the commit message: merging will fix #7383 |
Both modules have a hard dependency on the "vmouse" module that should be expressed in AMD. Re jquery-archivegh-5987 Closes jquery-archivegh-7383 Closes jquery-archivegh-7274
Both the Slider and Rangeslider widgets depend on the
events
module to function correctly. The integration tests currently pass because they explicitly load theinit
module, which has a dependency on theevents
module.This implicit dependency causes the following problems: