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
Given(/^I navigate to the anonymous Language Settings panel$/) do
step 'I am on a page with interlanguage links'
step 'I click the cog icon by Languages in the sidebar'
step 'I see the logged out language settings panel'
step "I am on a page with interlanguage links"
step "I click the cog icon by Languages in the sidebar"
step "I see the logged out language settings panel"
end
Given(/^I navigate to the Language Settings panel$/) do
step 'I am on a page with interlanguage links'
step 'I click the cog icon by Languages in the sidebar'
step 'I see the logged in language settings panel'
step "I am on a page with interlanguage links"
step "I click the cog icon by Languages in the sidebar"
step "I see the logged in language settings panel"
end
When(/^I click Cancel$/) do
@@ -81,7 +81,7 @@ Then(/^I do not see the Language Settings panel$/) do
end
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
Then(/^I see Language Search$/) do
@@ -106,19 +106,19 @@ end
Then(/^I see Worldwide$/) do
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
end
end
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 see the logged out language settings panel'
step "I click the cog icon by Languages in the sidebar"
step "I see the logged out language settings panel"
end
Then(/^the cog icon brings up Language Settings again$/) do
step 'I click the cog icon by Languages in the sidebar'
step 'I see the Language Settings panel'
step "I click the cog icon by Languages in the sidebar"
step "I see the Language Settings panel"
end
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
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
Given(/^I set "(.*?)" as the interface language$/) do |language|
@@ -23,5 +23,5 @@ end
Then(/^my interface language is "(.*?)"$/) do |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

View File

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

View File

@@ -15,7 +15,7 @@ When(/^I click on the input method indicator$/) do
end
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
end
@@ -51,7 +51,7 @@ When(/^I click on the Malayalam InScript 2 menu item$/) do
end
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
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
# '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
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
on(PanelPage).select_font_for_content = 'System font'
on(PanelPage).select_font_for_content = "System font"
end
And(/^I set English font to OpenDyslexic$/) do
on(PanelPage).select_font_for_content = 'OpenDyslexic'
on(PanelPage).select_font_for_content = "OpenDyslexic"
end
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
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|
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

View File

@@ -65,7 +65,7 @@ When(/^I use the panel to change my (?:interface|input) language to "(.*?)"$/) d
end
Then(/^the panel is in English/) do
on(PanelPage).panel_language_element.text.should == 'Language'
on(PanelPage).panel_language_element.text.should == "Language"
end
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|
step 'I open the Universal Language Selector'
step 'I open Display panel of language settings'
step 'I open Fonts panel of language settings'
step "I open the Universal Language Selector"
step "I open Display panel of language settings"
step "I open Fonts panel of language settings"
on(PanelPage).selected_interface_font.should == font
end
Then(/^the selected input method for Malayalam is ml-inscript2$/) do
step 'I click on an input box'
step 'I should see the input method indicator'
step 'in it there must be an element with Malayalam text'
step "I click on an input box"
step "I should see the input method indicator"
step "in it there must be an element with Malayalam text"
end
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
When(/^I select (.*?) font for the content language$/) do |font|
step 'I open the Universal Language Selector'
step 'I open Display panel of language settings'
step 'I open Fonts panel of language settings'
step "I open the Universal Language Selector"
step "I open Display panel of language settings"
step "I open Fonts panel of language settings"
pending("Bug 56885") do
step "I select #{font} font for the content language for the live preview"
end
step 'I apply the changes'
step "I apply the changes"
end
Then(/^I should see the edit area text being displayed using "(.*?)" font$/) do |font|

View File

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

View File

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

View File

@@ -4,20 +4,20 @@ require "page-object"
module InterlanguagePageModule
include PageObject
a(:add_links, id: 'wbc-linkToItem-link')
a(:back_to_display, text: 'Back to display settings')
a(:back_to_input, text: 'Back to input settings')
span(:cog, class: 'uls-settings-trigger')
button(:ellipsis_button, class: 'uls-more-languages button')
a(:english_link, text: 'English')
a(:hindi_link, text: 'हिन्दी')
div(:input_settings, id: 'input-settings-block')
div(:language_list, class: 'row uls-language-list lcd')
text_field(:language_search, id: 'languagefilter')
button(:non_default_language, class: 'button uls-language-button', index: 1)
a(:talk, text: 'Discussion')
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(:edit_link, css: '#ca-edit a')
a(:interlang_link, css: '#p-lang li.interlanguage-link')
a(:add_links, id: "wbc-linkToItem-link")
a(:back_to_display, text: "Back to display settings")
a(:back_to_input, text: "Back to input settings")
span(:cog, class: "uls-settings-trigger")
button(:ellipsis_button, class: "uls-more-languages button")
a(:english_link, text: "English")
a(:hindi_link, text: "हिन्दी")
div(:input_settings, id: "input-settings-block")
div(:language_list, class: "row uls-language-list lcd")
text_field(:language_search, id: "languagefilter")
button(:non_default_language, class: "button uls-language-button", index: 1)
a(:talk, text: "Discussion")
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(:edit_link, css: "#ca-edit a")
a(:interlang_link, css: "#p-lang ul")
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -2,10 +2,10 @@ class MainPage
include PageObject
include URL
page_url URL.url('Main_Page')
page_url URL.url("Main_Page")
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")
end.to_s.match(/Autonym/) != nil
end

View File

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

View File

@@ -3,58 +3,58 @@ class PanelPage
include LanguageModule
include URL
page_url URL.url('?<%=params[:extra]%>')
page_url URL.url("?<%=params[:extra]%>")
div(:uls, class: 'uls-menu')
span(:uls_button_close, id: 'uls-close')
div(:uls, class: "uls-menu")
span(:uls_button_close, id: "uls-close")
div(:language_settings_dialog, id: 'language-settings-dialog')
div(:panel_display, id: 'display-settings-block')
div(:panel_input, id: 'input-settings-block')
button(:panel_fonts, id: 'uls-display-settings-fonts-tab')
button(:panel_language, id: 'uls-display-settings-language-tab')
div(:language_settings_dialog, id: "language-settings-dialog")
div(:panel_display, id: "display-settings-block")
div(:panel_input, id: "input-settings-block")
button(:panel_fonts, id: "uls-display-settings-fonts-tab")
button(:panel_language, id: "uls-display-settings-language-tab")
div(:panel_side_display, id: 'display-panel-trigger')
div(:panel_side_input, id: 'input-panel-trigger')
div(:panel_side_display, id: "display-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')
button(:panel_button_apply, class: 'uls-settings-apply')
button(:panel_button_cancel, class: 'uls-settings-cancel')
span(:panel_button_close, id: "languagesettings-close")
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')
button(:panel_disable_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_interface_font_selector, id: 'ui-font-selector')
select_list(:panel_content_font_selector, id: "content-font-selector")
select_list(:panel_interface_font_selector, id: "ui-font-selector")
# TODO: Rename to match convention
button(:other_language_button, class: 'button uls-language-button', index: 1)
button(:default_language_button, css: '.uls-language-button.down')
button(:other_language_button, class: "button uls-language-button", index: 1)
button(:default_language_button, css: ".uls-language-button.down")
# Triggers
span(:trigger_cog, class: 'uls-settings-trigger')
a(:trigger_personal, class: 'uls-trigger')
span(:trigger_cog, class: "uls-settings-trigger")
a(:trigger_personal, class: "uls-trigger")
select(:selected_content_font, id: 'content-font-selector')
select(:selected_interface_font, id: 'ui-font-selector')
select(:selected_content_font, id: "content-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?
div(:interface, id: 'footer')
div(:interface, id: "footer")
def content_font
font('#mw-content-text')
font("#mw-content-text")
end
def interface_font
font('body')
font("body")
end
def uls_onscreen?

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
class ResetPreferencesPage
include PageObject
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