Refactoring Applying the live preview of interface font
We renamed get*font to just *font Change-Id: Ib6992849a2bf927d2e2d465231df58857e506a62
This commit is contained in:
@@ -35,6 +35,6 @@ Feature: Font selection
|
||||
And the selected interface font must be "Systemschriftart"
|
||||
|
||||
Scenario: Applying the live preview of interface font
|
||||
And I select "OpenDyslexic" font for the interface language for the live preview
|
||||
When I select "OpenDyslexic" font for the interface language for the live preview
|
||||
And I apply the changes
|
||||
Then the interface font must be changed to the "OpenDyslexic" font
|
||||
|
||||
@@ -12,8 +12,8 @@ end
|
||||
Given(/^I set "(.*?)" as the interface language$/) do |language|
|
||||
code = on(PanelPage).language_to_code(language)
|
||||
visit(PanelPage, :using_params => {:extra => "setlang=#{code}"})
|
||||
@original_content_font = on(PanelPage).get_content_font
|
||||
@original_interface_font = on(PanelPage).get_interface_font
|
||||
@original_content_font = on(PanelPage).content_font
|
||||
@original_interface_font = on(PanelPage).interface_font
|
||||
end
|
||||
|
||||
Given(/^I temporarily use "(.*?)" as the interface language$/) do |language|
|
||||
|
||||
@@ -12,12 +12,12 @@ end
|
||||
|
||||
Then(/^the active content font must be the same as font prior to the preview$/) do
|
||||
pending('bug #56081') do
|
||||
on(PanelPage).get_content_font.should == @original_content_font
|
||||
on(PanelPage).content_font.should == @original_content_font
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^the active interface font must be the same as font prior to the preview$/) do
|
||||
on(PanelPage).get_interface_font.should == @original_interface_font
|
||||
on(PanelPage).interface_font.should == @original_interface_font
|
||||
end
|
||||
|
||||
Then(/^the selected content font must be "(.*?)"$/) do |font|
|
||||
@@ -31,3 +31,7 @@ Then(/^the selected interface font must be "(.*?)"$/) do |font|
|
||||
step 'I open fonts panel of language settings'
|
||||
on(PanelPage).selected_interface_font.should == font
|
||||
end
|
||||
|
||||
Then(/^the interface font must be changed to the "(.*?)" font$/) do |font|
|
||||
on(PanelPage).interface_font.should match("^#{font}")
|
||||
end
|
||||
|
||||
@@ -46,13 +46,6 @@ end
|
||||
|
||||
When(/^I apply the changes$/) do
|
||||
on(PanelPage).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 4
|
||||
end
|
||||
|
||||
Then(/^the interface font must be changed to the "(.*?)" font$/) do |font|
|
||||
on(PanelPage).get_interface_font.should match("^#{font}")
|
||||
end
|
||||
|
||||
Then(/^I can disable input methods$/) do
|
||||
|
||||
@@ -42,14 +42,11 @@ class PanelPage
|
||||
# Is there way to access the html element?
|
||||
div(:interface, id: 'footer')
|
||||
|
||||
def get_content_font
|
||||
get_font('#mw-content-text')
|
||||
def content_font
|
||||
font('#mw-content-text')
|
||||
end
|
||||
def get_font(selector)
|
||||
@browser.execute_script( "return $( '#{selector}' ).css( 'font-family' );" )
|
||||
end
|
||||
def get_interface_font
|
||||
get_font('body')
|
||||
def interface_font
|
||||
font('body')
|
||||
end
|
||||
def language_to_code(language)
|
||||
case language
|
||||
@@ -67,4 +64,9 @@ class PanelPage
|
||||
pending
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def font(selector)
|
||||
@browser.execute_script( "return $( '#{selector}' ).css( 'font-family' );" )
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user