Commit graph

114 commits

Author SHA1 Message Date
Leszek Manicki a434e9503d Fix Pointer and PointerView tests
Initialization tests for both classes were checking
if the rendered view or the view related to the pointer
contained an element with particular CSS class.
The structure of the view has apparently changed as it
no longer contains an element with a particular class
but the view's DIV itself get the CSS class.
Assertion in tests has been wrong and did not catch the
change (in particular, apparently jQuery's find returned
an empty object which does not evaluate to false in qunit assertion).

This changes initialization tests to check the CSS class of the view element.
It also reflects the removal of left/right pointer distinction made in
I9d56314ea4cf46402df56e0a038bfb965521896.

This also rename both test modules as they had misleading names.

Change-Id: I5956022af332c9915e983a020732edbe1dd75aef
2016-05-17 13:48:40 +02:00
addshore ec80c4fa6f Get rid of left and right pointers.
As the pointers can switch side the idea
of having a left and right one will just lead
to confusion, so lets kill that idea now! :D

Change-Id: I9d56314ea4cf46402df56e0a038bfb9655218960
2016-05-13 11:23:11 +00:00
addshore 44904e8687 Avoid changing the URL during SliderView test
This was super annoying as if you went to refresh
the test page to run the tests again it would take
you to some broken diff page instead...

Change-Id: I43ca8edd005aa3ef72b74a5d812cbe39bccaf332
2016-05-13 11:23:00 +00:00
addshore fc74a35709 Use correct time offset based on server and user settings
If the user has a time offset that will be used.

If the user uses the default then the offset is
still retrieved from mw.user.options.values.timecorrection

If the user is anon then mw.config.values.extRevisionSliderTimeOffset
is used which is added as a JS var by the Hook

Bug: T135109
Change-Id: Iab56bbeb6a1dd2ea08b73983341485623ff63ef1
2016-05-13 11:02:20 +00:00
addshore 8ba5d9acea Add size & minor flag to tooltip
Bug: T135118
Change-Id: I2bc90a2f8a03693df092a4785cfe2fdfcc85730a
2016-05-13 11:57:31 +01:00
Jakob Warkotsch 139368093e Adds the missing first revision to the slider.
The first revision was previously not included because revision size was
calculated by subtracting the size in bytes of a revision from the size
of the previous revision which lead to a problem with the first
revision. The first revision's relative size is now equal to its actual
size.

Bug: T135003
Change-Id: I71441ed33673b06407be0fc566c96c3955dddbf9
2016-05-12 15:25:37 +00:00
addshore cfac82978c Fix commented out tests
Change-Id: I283228cc03dcc64107720f9092a2f41483f74853
2016-05-10 18:14:10 +01:00
Jakob Warkotsch 980f2ca917 Create Slider module.
* threw out most of the things from init.js
* turned Slider + View into respective modules
* pointers should remember position (except on page load) and correctly
  slide back to their position/to the side

Some things still need testing and refactoring.

Addshore: - CS fixes and comment out current failing tests

Bug: T134395
Change-Id: I78a7095e1d9902314163b1443448f47ef0484d4e
2016-05-10 17:38:46 +01:00
Jakob Warkotsch 54720944a0 Create Pointer module.
This creates a module for the draggable pointers for the RevisionSlider
mainly to encapsulate both the pointers' state and their HTML code.

Some animation methods such as slideToSide and slideToPosition
that are still flying around in init.js weren't added to the
module since I thought they should be part of the not yet existing
Slider module.

Change-Id: I1292bfb0bbd68f8d2de04b3b5e5f3133ec6363b8
2016-05-06 12:37:01 +00:00
WMDE-Fisch 308d24c8c5 Added jscs checks for tests
Change-Id: Ice2d37f40105d082fd10ebc7a83bd1ef02919eb4
2016-05-03 12:07:47 +02:00
WMDE-Fisch a0f22fd88b Refactored getSection into Revision class and added tests
Change-Id: I6c6fa5194482c25aa3f2285aebfee11cd713285d
2016-05-02 15:21:40 +02:00
Jakob Warkotsch 8c6676f939 Create module for Revision type.
This pulls out some of the code around revisions into a decoupled and
tested module.

Change-Id: Ib2a4f96f0e0b9a96ec85d300d97cd52dcaffe89e
2016-04-28 12:38:24 +02:00
addshore 800d93c9ce Remove empty php test file
Change-Id: Ib119672ba450de22bd6cd58ffc8f58b99054c258
2016-04-20 08:40:40 +01:00
Jakob Warkotsch 23b5b2f112 Initial commit.
This turns the prototype code of the Revision Slider into a MediaWiki
extension.
With this extension enabled the slider should appear on diff pages
already but it won't actually show diffs when adjusting the slider
pointers.

Things that changed so far in the prototype JS code:
- pulled out the rainbow function and made it use Math.floor instead of
 the ~~ binary operator
- pulled out the API request that fetches the revisions into its own
 module
- cleaned up and documented some parts of the code

The code is still very much WIP and JSCS still has a couple of
complaints.

Bug: T132576
Change-Id: I2e22365f3b93a76d5b8d3997242b5fed996c6d78
2016-04-19 16:35:37 +02:00