Make the cancel and apply button applicable for all modules

If a user does changes in module A, does not save or cancel,
goes to module B, does some changes, moves to other modules,
and finally presses Apply, all changes should get saved.

Similarly, if a user cancels, all changes should get cancelled.

This required moving the cancel and apply button outside of modules
and managed by the language settings framework.

Modules get mw.uls.settings.apply or mw.uls.settings.cancel triggers
to do whatever they want to do on apply or save.

Includes some refactoring related to this.

Bug: 53256
Change-Id: I7d773d33a980a78604b36e39bf96a5686870124e
This commit is contained in:
Santhosh Thottingal
2013-08-27 11:56:58 +05:30
committed by Amir E. Aharoni
parent 375c676fba
commit 3af403fee5
9 changed files with 51 additions and 80 deletions

View File

@@ -68,10 +68,10 @@ Then(/^the selected (.*?) font must be "(.*?)"$/) do |type, font|
end
When(/^I apply the changes$/) do
on(ULSPage).panel_button_display_apply_element.click
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
panel = @browser.driver.find_element(:id => 'language-settings-dialog')
wait.until { !panel.displayed? }
on(ULSPage).panel_button_apply_element.click
# Leave a little time for the settings to be saved. The settings window closes
# immediately, so it is not enough to wait for it to disappear.
sleep 2
end
Then(/^the (.*) font must be changed to the "(.*?)" font$/) do |type, font|

View File

@@ -27,12 +27,8 @@ Given(/^I navigate to the Language Settings panel$/) do
step 'I see the logged in language settings panel'
end
When(/^I click Apply Settings$/) do
on(InterlanguagePage).apply_settings_element.click
end
When(/^I click Cancel$/) do
on(InterlanguagePage).cancel_element.click
on(ULSPage).panel_button_cancel_element.click
end
When(/^I click on the link to select Malayalam$/) do

View File

@@ -4,10 +4,8 @@ module InterlanguagePageModule
include PageObject
a(:add_links, id: 'wbc-linkToItem-link')
span(:apply_settings, class: 'uls-settings-trigger')
a(:back_to_display, text: 'Back to display settings')
a(:back_to_input, text: 'Back to input settings')
button(:cancel, class: 'button uls-display-settings-cancel')
span(:cog, class: 'uls-settings-trigger')
button(:ellipsis_button, class: 'uls-more-languages button')
a(:english_link, text: 'English')

View File

@@ -10,7 +10,8 @@ class ULSPage
button(:panel_language, id: 'uls-display-settings-language-tab')
span(:panel_button_close, id: 'languagesettings-close')
button(:panel_button_display_apply, id: 'uls-displaysettings-apply')
button(:panel_button_apply, class: 'uls-settings-apply')
button(:panel_button_cancel, class: 'uls-settings-cancel')
button(:panel_disable_input_methods, class: 'uls-input-toggle-button')
button(:panel_enable_input_methods, class: 'uls-input-toggle-button')

View File

@@ -35,6 +35,3 @@ Feature: ULS trigger in personal toolbar
| user status | close method |
| logged in | I click X |
| logged out | I click Cancel |
# It is weird that this works, since the button is disabled until changes
# have been made
| logged out | I click Apply Settings |