Prefer double-quoted strings in Ruby code

Bug: 57597
Change-Id: I12b96411abe255130e156e20fa41eef558460196
This commit is contained in:
mayankmadan
2013-11-27 01:21:33 +05:30
committed by Nikerabbit
parent bbeb82f809
commit 78152b95c0
23 changed files with 138 additions and 138 deletions

View File

@@ -16,15 +16,15 @@ Given(/^I am on a talk page without interlanguage links$/) do
end end
Given(/^I navigate to the anonymous Language Settings panel$/) do Given(/^I navigate to the anonymous Language Settings panel$/) do
step 'I am on a page with interlanguage links' step "I am on a page with interlanguage links"
step 'I click the cog icon by Languages in the sidebar' step "I click the cog icon by Languages in the sidebar"
step 'I see the logged out language settings panel' step "I see the logged out language settings panel"
end end
Given(/^I navigate to the Language Settings panel$/) do Given(/^I navigate to the Language Settings panel$/) do
step 'I am on a page with interlanguage links' step "I am on a page with interlanguage links"
step 'I click the cog icon by Languages in the sidebar' step "I click the cog icon by Languages in the sidebar"
step 'I see the logged in language settings panel' step "I see the logged in language settings panel"
end end
When(/^I click Cancel$/) do When(/^I click Cancel$/) do
@@ -81,7 +81,7 @@ Then(/^I do not see the Language Settings panel$/) do
end end
Then(/^I see Common Languages$/) do Then(/^I see Common Languages$/) do
on(InterlanguagePage).language_list.should match Regexp.escape('Common languages') on(InterlanguagePage).language_list.should match Regexp.escape("Common languages")
end end
Then(/^I see Language Search$/) do Then(/^I see Language Search$/) do
@@ -106,19 +106,19 @@ end
Then(/^I see Worldwide$/) do Then(/^I see Worldwide$/) do
on(InterlanguagePage) do |page| on(InterlanguagePage) do |page|
page.language_list.should match Regexp.escape('Worldwide') page.language_list.should match Regexp.escape("Worldwide")
page.english_link_element.should be_visible page.english_link_element.should be_visible
end end
end end
Then(/^I click the cog icon to open language settings again$/) do Then(/^I click the cog icon to open language settings again$/) do
step 'I click the cog icon by Languages in the sidebar' step "I click the cog icon by Languages in the sidebar"
step 'I see the logged out language settings panel' step "I see the logged out language settings panel"
end end
Then(/^the cog icon brings up Language Settings again$/) do Then(/^the cog icon brings up Language Settings again$/) do
step 'I click the cog icon by Languages in the sidebar' step "I click the cog icon by Languages in the sidebar"
step 'I see the Language Settings panel' step "I see the Language Settings panel"
end end
Then(/^I should see the How to use link near the Malayalam transliteration item$/) do Then(/^I should see the How to use link near the Malayalam transliteration item$/) do

View File

@@ -6,7 +6,7 @@ Given(/^I am logged out$/) do
end end
Given(/^I am logged in$/) do Given(/^I am logged in$/) do
visit(LoginPage).login_with(ENV['MEDIAWIKI_USER'], ENV['MEDIAWIKI_PASSWORD']) visit(LoginPage).login_with(ENV["MEDIAWIKI_USER"], ENV["MEDIAWIKI_PASSWORD"])
end end
Given(/^I set "(.*?)" as the interface language$/) do |language| Given(/^I set "(.*?)" as the interface language$/) do |language|
@@ -23,5 +23,5 @@ end
Then(/^my interface language is "(.*?)"$/) do |language| Then(/^my interface language is "(.*?)"$/) do |language|
code = on(PanelPage).language_to_code(language) code = on(PanelPage).language_to_code(language)
on(PanelPage).interface_element.attribute('lang').should == code on(PanelPage).interface_element.attribute("lang").should == code
end end

View File

@@ -3,7 +3,7 @@ Given(/^I open ULS$/) do
end end
Then(/^the active content font must be the same as font prior to the preview$/) do Then(/^the active content font must be the same as font prior to the preview$/) do
pending('bug #56081') do pending("bug #56081") do
on(PanelPage).content_font.should == @original_content_font on(PanelPage).content_font.should == @original_content_font
end end
end end
@@ -13,8 +13,8 @@ Then(/^the active interface font must be the same as font prior to the preview$/
end end
Then(/^the selected content font must be "(.*?)"$/) do |font| Then(/^the selected content font must be "(.*?)"$/) do |font|
step 'I open Display panel of language settings' step "I open Display panel of language settings"
step 'I open Fonts panel of language settings' step "I open Fonts panel of language settings"
on(PanelPage).selected_content_font.should == font on(PanelPage).selected_content_font.should == font
end end

View File

@@ -15,7 +15,7 @@ When(/^I click on the input method indicator$/) do
end end
When(/^I open the input method menu$/) do When(/^I open the input method menu$/) do
step 'I click on an input box' step "I click on an input box"
on(IMEPage).input_method_element.when_present.click on(IMEPage).input_method_element.when_present.click
end end
@@ -51,7 +51,7 @@ When(/^I click on the Malayalam InScript 2 menu item$/) do
end end
When(/^I press Control-M$/) do When(/^I press Control-M$/) do
on(IMEPage).search_input_element.send_keys [:control, 'm'] on(IMEPage).search_input_element.send_keys [:control, "m"]
end end
When(/^I go to another random page$/) do When(/^I go to another random page$/) do
@@ -60,7 +60,7 @@ end
Then(/^in it there must be an element with Malayalam text$/) do Then(/^in it there must be an element with Malayalam text$/) do
# 'input_method_enabled' alone only returns [] # 'input_method_enabled' alone only returns []
on(IMEPage).input_method_enabled_element.text.should == 'ഇൻസ്ക്രിപ്റ്റ് 2' on(IMEPage).input_method_enabled_element.text.should == "ഇൻസ്ക്രിപ്റ്റ് 2"
end end
Given(/^I visit a random page with (.+) skin and (.+) as the interface language$/) do |skin, language| Given(/^I visit a random page with (.+) skin and (.+) as the interface language$/) do |skin, language|

View File

@@ -1,13 +1,13 @@
When(/^I set English font to System$/) do When(/^I set English font to System$/) do
on(PanelPage).select_font_for_content = 'System font' on(PanelPage).select_font_for_content = "System font"
end end
And(/^I set English font to OpenDyslexic$/) do And(/^I set English font to OpenDyslexic$/) do
on(PanelPage).select_font_for_content = 'OpenDyslexic' on(PanelPage).select_font_for_content = "OpenDyslexic"
end end
Then(/^the selected content font must be OpenDyslexic$/) do Then(/^the selected content font must be OpenDyslexic$/) do
on(PanelPage).select_font_for_content.should == 'OpenDyslexic' on(PanelPage).select_font_for_content.should == "OpenDyslexic"
end end
And(/^I select a language different than English for display language$/) do And(/^I select a language different than English for display language$/) do
@@ -20,5 +20,5 @@ end
Then(/^I should see the text in the language panel in (.+?)$/) do |language| Then(/^I should see the text in the language panel in (.+?)$/) do |language|
code = on(PanelPage).language_to_code(language) code = on(PanelPage).language_to_code(language)
on(PanelPage).uls_display_settings_element.attribute('lang').should == code on(PanelPage).uls_display_settings_element.attribute("lang").should == code
end end

View File

@@ -65,7 +65,7 @@ When(/^I use the panel to change my (?:interface|input) language to "(.*?)"$/) d
end end
Then(/^the panel is in English/) do Then(/^the panel is in English/) do
on(PanelPage).panel_language_element.text.should == 'Language' on(PanelPage).panel_language_element.text.should == "Language"
end end
When(/^I switch to "Input" panel of language settings/) do When(/^I switch to "Input" panel of language settings/) do

View File

@@ -1,14 +1,14 @@
Then(/^the selected interface font must be (.*?)$/) do |font| Then(/^the selected interface font must be (.*?)$/) do |font|
step 'I open the Universal Language Selector' step "I open the Universal Language Selector"
step 'I open Display panel of language settings' step "I open Display panel of language settings"
step 'I open Fonts panel of language settings' step "I open Fonts panel of language settings"
on(PanelPage).selected_interface_font.should == font on(PanelPage).selected_interface_font.should == font
end end
Then(/^the selected input method for Malayalam is ml-inscript2$/) do Then(/^the selected input method for Malayalam is ml-inscript2$/) do
step 'I click on an input box' step "I click on an input box"
step 'I should see the input method indicator' step "I should see the input method indicator"
step 'in it there must be an element with Malayalam text' step "in it there must be an element with Malayalam text"
end end
When(/^I select the ml-inscript2 input method in the panel$/) do When(/^I select the ml-inscript2 input method in the panel$/) do

View File

@@ -15,13 +15,13 @@ When(/^I start editing a page$/) do
end end
When(/^I select (.*?) font for the content language$/) do |font| When(/^I select (.*?) font for the content language$/) do |font|
step 'I open the Universal Language Selector' step "I open the Universal Language Selector"
step 'I open Display panel of language settings' step "I open Display panel of language settings"
step 'I open Fonts panel of language settings' step "I open Fonts panel of language settings"
pending("Bug 56885") do pending("Bug 56885") do
step "I select #{font} font for the content language for the live preview" step "I select #{font} font for the content language for the live preview"
end end
step 'I apply the changes' step "I apply the changes"
end end
Then(/^I should see the edit area text being displayed using "(.*?)" font$/) do |font| Then(/^I should see the edit area text being displayed using "(.*?)" font$/) do |font|

View File

@@ -1,2 +1,2 @@
require_relative 'hooks' require_relative "hooks"
require 'mediawiki/selenium' require "mediawiki/selenium"

View File

@@ -1,8 +1,8 @@
Before('@language') do |scenario| Before("@language") do |scenario|
@language = true @language = true
@scenario = scenario @scenario = scenario
end end
After('@reset-preferences-after') do |scenario| After("@reset-preferences-after") do |scenario|
visit(ResetPreferencesPage).submit_element.click if @browser.exist? visit(ResetPreferencesPage).submit_element.click if @browser.exist?
end end

View File

@@ -4,20 +4,20 @@ require "page-object"
module InterlanguagePageModule module InterlanguagePageModule
include PageObject include PageObject
a(:add_links, id: 'wbc-linkToItem-link') a(:add_links, id: "wbc-linkToItem-link")
a(:back_to_display, text: 'Back to display settings') a(:back_to_display, text: "Back to display settings")
a(:back_to_input, text: 'Back to input settings') a(:back_to_input, text: "Back to input settings")
span(:cog, class: 'uls-settings-trigger') span(:cog, class: "uls-settings-trigger")
button(:ellipsis_button, class: 'uls-more-languages button') button(:ellipsis_button, class: "uls-more-languages button")
a(:english_link, text: 'English') a(:english_link, text: "English")
a(:hindi_link, text: 'हिन्दी') a(:hindi_link, text: "हिन्दी")
div(:input_settings, id: 'input-settings-block') div(:input_settings, id: "input-settings-block")
div(:language_list, class: 'row uls-language-list lcd') div(:language_list, class: "row uls-language-list lcd")
text_field(:language_search, id: 'languagefilter') text_field(:language_search, id: "languagefilter")
button(:non_default_language, class: 'button uls-language-button', index: 1) button(:non_default_language, class: "button uls-language-button", index: 1)
a(:talk, text: 'Discussion') a(:talk, text: "Discussion")
span(:x, id: 'languagesettings-close') span(:x, id: "languagesettings-close")
a(:how_to_use_ml_transliteration, href: 'https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:UniversalLanguageSelector/Input_methods/ml-transliteration') a(:how_to_use_ml_transliteration, href: "https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:UniversalLanguageSelector/Input_methods/ml-transliteration")
a(:edit_link, css: '#ca-edit a') a(:edit_link, css: "#ca-edit a")
a(:interlang_link, css: '#p-lang li.interlanguage-link') a(:interlang_link, css: "#p-lang ul")
end end

View File

@@ -3,16 +3,16 @@ module LanguageModule
def language_to_code(language) def language_to_code(language)
case language case language
when 'German' when "German"
'de' "de"
when 'English' when "English"
'en' "en"
when 'Finnish' when "Finnish"
'fi' "fi"
when 'Hebrew' when "Hebrew"
'he' "he"
when 'Hindi' when "Hindi"
'hi' "hi"
else else
pending pending
end end

View File

@@ -1,9 +1,9 @@
module URL module URL
def self.url(name) def self.url(name)
if ENV['MEDIAWIKI_URL'] if ENV["MEDIAWIKI_URL"]
mediawiki_url = ENV['MEDIAWIKI_URL'] mediawiki_url = ENV["MEDIAWIKI_URL"]
else else
mediawiki_url = 'http://en.wikipedia.beta.wmflabs.org/wiki/' mediawiki_url = "http://en.wikipedia.beta.wmflabs.org/wiki/"
end end
"#{mediawiki_url}#{name}" "#{mediawiki_url}#{name}"
end end

View File

@@ -1,5 +1,5 @@
class EditPage class EditPage
include PageObject include PageObject
textarea(:editarea, id: 'wpTextbox1') textarea(:editarea, id: "wpTextbox1")
end end

View File

@@ -3,17 +3,17 @@ class IMEPage
include LanguageModule include LanguageModule
include URL include URL
page_url URL.url('?<%=params[:extra]%>') page_url URL.url("?<%=params[:extra]%>")
div(:input_method, class: 'imeselector imeselector-toggle') div(:input_method, class: "imeselector imeselector-toggle")
a(:input_method_enabled, class: 'ime-name imeselector-toggle') a(:input_method_enabled, class: "ime-name imeselector-toggle")
h3(:input_method_ime_list_title, class: 'ime-list-title') h3(:input_method_ime_list_title, class: "ime-list-title")
ul(:input_method_language_list, class: 'ime-language-list') ul(:input_method_language_list, class: "ime-language-list")
div(:input_method_selector_menu, class: 'imeselector-menu') div(:input_method_selector_menu, class: "imeselector-menu")
text_field(:language_filter, id: 'languagefilter') text_field(:language_filter, id: "languagefilter")
li(:malayalam_inscript2, data_ime_inputmethod: 'ml-inscript2') li(:malayalam_inscript2, data_ime_inputmethod: "ml-inscript2")
a(:more_languages, class: 'ime-selector-more-languages') a(:more_languages, class: "ime-selector-more-languages")
text_field(:search_input, id: 'searchInput') text_field(:search_input, id: "searchInput")
def ime_input_method_menu_onscreen? def ime_input_method_menu_onscreen?
@browser.execute_script( " @browser.execute_script( "

View File

@@ -4,7 +4,7 @@ class InterlanguagePage
include URL include URL
def self.url def self.url
URL.url('Boleyn_family') URL.url("Boleyn_family")
end end
page_url url page_url url

View File

@@ -2,18 +2,18 @@ class LoginPage
include PageObject include PageObject
include URL include URL
page_url URL.url('Special:UserLogin') page_url URL.url("Special:UserLogin")
div(:feedback, class: 'errorbox') div(:feedback, class: "errorbox")
button(:login, id: 'wpLoginAttempt') button(:login, id: "wpLoginAttempt")
text_field(:password, id: 'wpPassword1') text_field(:password, id: "wpPassword1")
a(:password_strength, text: 'password strength') a(:password_strength, text: "password strength")
a(:phishing, text: 'phishing') a(:phishing, text: "phishing")
text_field(:username, id: 'wpName1') text_field(:username, id: "wpName1")
a(:username_displayed, title: /Your user page/) a(:username_displayed, title: /Your user page/)
def logged_in_as_element def logged_in_as_element
@browser.div(id: 'mw-content-text').p.b @browser.div(id: "mw-content-text").p.b
end end
def login_with(username, password) def login_with(username, password)
self.username = username self.username = username

View File

@@ -2,10 +2,10 @@ class MainPage
include PageObject include PageObject
include URL include URL
page_url URL.url('Main_Page') page_url URL.url("Main_Page")
def non_interlanguage_links_use_autonym_font? def non_interlanguage_links_use_autonym_font?
@browser.elements(css: '#p-lang li:not(.interlanguage-link)').collect do |element| @browser.elements(css: "#p-lang li:not(.interlanguage-link)").collect do |element|
element.style("font-family") element.style("font-family")
end.to_s.match(/Autonym/) != nil end.to_s.match(/Autonym/) != nil
end end

View File

@@ -3,7 +3,7 @@ class NoInterlanguagePage
include URL include URL
def self.url def self.url
URL.url('Think_Like_a_Cat') URL.url("Think_Like_a_Cat")
end end
page_url url page_url url

View File

@@ -3,58 +3,58 @@ class PanelPage
include LanguageModule include LanguageModule
include URL include URL
page_url URL.url('?<%=params[:extra]%>') page_url URL.url("?<%=params[:extra]%>")
div(:uls, class: 'uls-menu') div(:uls, class: "uls-menu")
span(:uls_button_close, id: 'uls-close') span(:uls_button_close, id: "uls-close")
div(:language_settings_dialog, id: 'language-settings-dialog') div(:language_settings_dialog, id: "language-settings-dialog")
div(:panel_display, id: 'display-settings-block') div(:panel_display, id: "display-settings-block")
div(:panel_input, id: 'input-settings-block') div(:panel_input, id: "input-settings-block")
button(:panel_fonts, id: 'uls-display-settings-fonts-tab') button(:panel_fonts, id: "uls-display-settings-fonts-tab")
button(:panel_language, id: 'uls-display-settings-language-tab') button(:panel_language, id: "uls-display-settings-language-tab")
div(:panel_side_display, id: 'display-panel-trigger') div(:panel_side_display, id: "display-panel-trigger")
div(:panel_side_input, id: 'input-panel-trigger') div(:panel_side_input, id: "input-panel-trigger")
ul(:autonym, class: 'three columns end') ul(:autonym, class: "three columns end")
span(:panel_button_close, id: 'languagesettings-close') span(:panel_button_close, id: "languagesettings-close")
button(:panel_button_apply, class: 'uls-settings-apply') button(:panel_button_apply, class: "uls-settings-apply")
button(:panel_button_cancel, class: 'uls-settings-cancel') button(:panel_button_cancel, class: "uls-settings-cancel")
button(:panel_disable_input_methods, class: 'uls-input-toggle-button') button(:panel_disable_input_methods, class: "uls-input-toggle-button")
button(:panel_enable_input_methods, class: 'uls-input-toggle-button') button(:panel_enable_input_methods, class: "uls-input-toggle-button")
select_list(:panel_content_font_selector, id: 'content-font-selector') select_list(:panel_content_font_selector, id: "content-font-selector")
select_list(:panel_interface_font_selector, id: 'ui-font-selector') select_list(:panel_interface_font_selector, id: "ui-font-selector")
# TODO: Rename to match convention # TODO: Rename to match convention
button(:other_language_button, class: 'button uls-language-button', index: 1) button(:other_language_button, class: "button uls-language-button", index: 1)
button(:default_language_button, css: '.uls-language-button.down') button(:default_language_button, css: ".uls-language-button.down")
# Triggers # Triggers
span(:trigger_cog, class: 'uls-settings-trigger') span(:trigger_cog, class: "uls-settings-trigger")
a(:trigger_personal, class: 'uls-trigger') a(:trigger_personal, class: "uls-trigger")
select(:selected_content_font, id: 'content-font-selector') select(:selected_content_font, id: "content-font-selector")
select(:selected_interface_font, id: 'ui-font-selector') select(:selected_interface_font, id: "ui-font-selector")
select(:font_for_content, id: 'content-font-selector') select(:font_for_content, id: "content-font-selector")
div(:uls_display_settings, class: 'uls-display-settings') div(:uls_display_settings, class: "uls-display-settings")
radio_button(:ml_inscript2_radio, id: 'ml-inscript2') radio_button(:ml_inscript2_radio, id: "ml-inscript2")
# Is there way to access the html element? # Is there way to access the html element?
div(:interface, id: 'footer') div(:interface, id: "footer")
def content_font def content_font
font('#mw-content-text') font("#mw-content-text")
end end
def interface_font def interface_font
font('body') font("body")
end end
def uls_onscreen? def uls_onscreen?

View File

@@ -2,11 +2,11 @@ class PreferencesPage
include PageObject include PageObject
include URL include URL
page_url URL.url('Special:Preferences') page_url URL.url("Special:Preferences")
select(:set_interface_language, id: 'mw-input-wplanguage') select(:set_interface_language, id: "mw-input-wplanguage")
button(:save, id: 'prefcontrol') button(:save, id: "prefcontrol")
a(:editing_tab, id: 'preftab-editing') a(:editing_tab, id: "preftab-editing")
select(:editing_font, id: 'mw-input-wpeditfont') select(:editing_font, id: "mw-input-wpeditfont")
end end

View File

@@ -4,15 +4,15 @@ class RandomPage
include PageObject include PageObject
include URL include URL
page_url URL.url('Special:Random') page_url URL.url("Special:Random")
span(:cog, title: 'Language settings') span(:cog, title: "Language settings")
a(:create_a_book, text: 'Create a book') a(:create_a_book, text: "Create a book")
a(:download_as_pdf, text: 'Download as PDF') a(:download_as_pdf, text: "Download as PDF")
a(:download_the_file, text: 'Download the file') a(:download_the_file, text: "Download the file")
li(:main_page, id: 'n-mainpage-description') li(:main_page, id: "n-mainpage-description")
a(:malayalam_link, title: 'Malayalam') a(:malayalam_link, title: "Malayalam")
a(:print_export, text: 'Print/export') a(:print_export, text: "Print/export")
a(:printable_version, text: 'Printable version') a(:printable_version, text: "Printable version")
button(:search_button, id: 'searchButton') button(:search_button, id: "searchButton")
end end

View File

@@ -1,7 +1,7 @@
class ResetPreferencesPage class ResetPreferencesPage
include PageObject include PageObject
include URL include URL
page_url URL.url('Special:Preferences/reset') page_url URL.url("Special:Preferences/reset")
button(:submit, class: 'mw-htmlform-submit') button(:submit, class: "mw-htmlform-submit")
end end