mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-12 15:35:11 +00:00
6502728184
This adds a button which allows a user to make revision slider automatically expand on each diff page (disabled by default). User's choice is stored as a hidden user preference. This is a bit hacky as it squeezes a button on top of another button (100% wide expand/collapse button). This also adjusts styles of ToggleButtonWidget so the button looks more like a frameless button, although it is created as a framed one (to have inverted behaviour when button is in its "on" state). The button only gets visible when Resource Loader finishes loading JS and CSS to avoid button jumping around the top of slider window before "right" styles are applied. Bug: T142196 Change-Id: Id561485344cba9b136666fe31b086151467de19e
82 lines
2.5 KiB
Ruby
82 lines
2.5 KiB
Ruby
class DiffPage
|
|
include PageObject
|
|
|
|
p(:revisionslider_placeholder, css: '.mw-revslider-placeholder')
|
|
div(:revisionslider_wrapper, css: '.mw-revslider-slider-wrapper')
|
|
div(:revisionslider_auto_expand_button, css: '.mw-revslider-auto-expand-button')
|
|
div(:revisionslider_toggle_button, css: '.mw-revslider-toggle-button')
|
|
table(:revisionslider_loading, css: '.mw-revslider-diff-loading')
|
|
|
|
div(:revisionslider_help_dialog, css: '.revisionslider-help-dialog')
|
|
button(:revisionslider_help, css: '.mw-revision-slider-container > button')
|
|
a(:revisionslider_help_next, css: '.revisionslider-help-next > a')
|
|
a(:revisionslider_help_previous, css: '.revisionslider-help-previous > a')
|
|
a(:revisionslider_help_close_start, css: '.revisionslider-help-close-start > a')
|
|
a(:revisionslider_help_close_end, css: '.revisionslider-help-close-end > a')
|
|
|
|
div(:revisionslider_timeline_backwards, css: '.mw-revslider-arrow.mw-revslider-arrow-backwards')
|
|
div(:revisionslider_timeline_forwards, css: '.mw-revslider-arrow.mw-revslider-arrow-forwards')
|
|
|
|
div(:revisionslider_pointer_lower, css: '.mw-revslider-pointer-lower')
|
|
div(:revisionslider_pointer_upper, css: '.mw-revslider-pointer-upper')
|
|
|
|
div(:revisionslider_left_summary, id: 'mw-diff-otitle3')
|
|
div(:revisionslider_right_summary, id: 'mw-diff-ntitle3')
|
|
|
|
def revisionslider_rev(index = 1)
|
|
element('div', css: '.mw-revslider-revision[data-pos="' + index.to_s + '"]')
|
|
end
|
|
|
|
def revisionslider_tooltip(index = 1)
|
|
element('div', css: '.mw-revslider-revision-tooltip-' + index.to_s)
|
|
|
|
end
|
|
|
|
def wait_for_slider_to_load
|
|
wait_until do
|
|
!revisionslider_placeholder?
|
|
end
|
|
end
|
|
|
|
def wait_for_ajax_calls
|
|
sleep_period = 0.25
|
|
max_timeout_seconds = 2
|
|
timeout_loops = (max_timeout_seconds / sleep_period).to_i
|
|
|
|
while execute_script('return jQuery.active') != 0 && timeout_loops > 0
|
|
sleep(sleep_period)
|
|
timeout_loops -= 1
|
|
end
|
|
true
|
|
end
|
|
|
|
def wait_for_diff_to_load
|
|
wait_until do
|
|
!revisionslider_loading?
|
|
end
|
|
end
|
|
|
|
def wait_for_auto_expand_button_to_become_visible
|
|
wait_until do
|
|
revisionslider_auto_expand_button_element.visible?
|
|
end
|
|
end
|
|
|
|
def wait_for_tooltip(index = 1)
|
|
wait_until do
|
|
revisionslider_tooltip(index).visible?
|
|
end
|
|
end
|
|
|
|
def wait_for_no_tooltip(index = 1)
|
|
wait_until do
|
|
!revisionslider_tooltip(index).visible?
|
|
end
|
|
end
|
|
|
|
def wait_for_help_dialog_to_hide
|
|
wait_until do
|
|
!revisionslider_help_dialog_element.visible?
|
|
end
|
|
end
|
|
end |