Cmcmahon has uploaded a new change for review.
https://gerrit.wikimedia.org/r/174962
Change subject: [BrowserTest] various rubocop updates
......................................................................
[BrowserTest] various rubocop updates
Change-Id: Ia11c32c74acf4c2226f84ea566f4074b193f4e20
---
M .rubocop_todo.yml
M
modules/ve-mw/tests/browser/features/step_definitions/language_screenshot_steps.rb
M modules/ve-mw/tests/browser/features/support/language_screenshot.rb
M modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb
M modules/ve-mw/tests/browser/spec/rectangle_spec.rb
5 files changed, 69 insertions(+), 73 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/62/174962/1
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index e22b64b..7699ca7 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -46,7 +46,3 @@
Style/LeadingCommentSpace:
Enabled: false
-# Offense count: 179
-# Cop supports --auto-correct.
-Style/SpaceAfterComma:
- Enabled: false
diff --git
a/modules/ve-mw/tests/browser/features/step_definitions/language_screenshot_steps.rb
b/modules/ve-mw/tests/browser/features/step_definitions/language_screenshot_steps.rb
index ccb609e..7f3f051 100644
---
a/modules/ve-mw/tests/browser/features/step_definitions/language_screenshot_steps.rb
+++
b/modules/ve-mw/tests/browser/features/step_definitions/language_screenshot_steps.rb
@@ -141,7 +141,7 @@
end
Then(/^I take screenshot of Formatting pull-down menu$/) do
-
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png",
[@current_page.ve_text_style_element,@current_page.formatting_option_menus_element])
+
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png",
[@current_page.ve_text_style_element,
@current_page.formatting_option_menus_element])
end
Then(/^I should see pull-down menu containing Page Settings$/) do
diff --git
a/modules/ve-mw/tests/browser/features/support/language_screenshot.rb
b/modules/ve-mw/tests/browser/features/support/language_screenshot.rb
index a2655af..dad782d 100644
--- a/modules/ve-mw/tests/browser/features/support/language_screenshot.rb
+++ b/modules/ve-mw/tests/browser/features/support/language_screenshot.rb
@@ -19,7 +19,7 @@
if offset_element
offset_rectangle = coordinates_from_page_element(offset_element)
else
- offset_rectangle = [0,0,0,0]
+ offset_rectangle = [0, 0, 0, 0]
end
rectangles = coordinates_from_page_elements(page_elements)
crop_rectangle = rectangle(rectangles, offset_rectangle)
@@ -42,7 +42,7 @@
image.save path
end
-def rectangle(rectangles, offset_rectangle = [0,0,0,0])
+def rectangle(rectangles, offset_rectangle = [0, 0, 0, 0])
top_left_x, top_left_y = top_left_x_y rectangles
bottom_right_x, bottom_right_y = bottom_right_x_y rectangles
diff --git
a/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb
b/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb
index 53209fb..d6d56b8 100644
--- a/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb
+++ b/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb
@@ -50,7 +50,7 @@
a(:first_reference, text: '[1]', index: 1)
div(:formatting_option_menus, class: 'oo-ui-toolGroup-tools
oo-ui-clippableElement-clippable', index: 1)
img(:formula_image, class: 'mwe-math-fallback-png-inline')
- span(:formula_insert_menu,class: 'oo-ui-tool-name-math')
+ span(:formula_insert_menu, class: 'oo-ui-tool-name-math')
a(:formula_link, css: 'span.oo-ui-tool-name-math > a.oo-ui-tool-link')
a(:heading, text: /Heading/)
span(:hamburger_menu, css: 'div.oo-ui-listToolGroup:nth-child(2) >
span:nth-child(1) > span:nth-child(3)')
diff --git a/modules/ve-mw/tests/browser/spec/rectangle_spec.rb
b/modules/ve-mw/tests/browser/spec/rectangle_spec.rb
index 42ae8ac..30d5f2e 100644
--- a/modules/ve-mw/tests/browser/spec/rectangle_spec.rb
+++ b/modules/ve-mw/tests/browser/spec/rectangle_spec.rb
@@ -3,46 +3,46 @@
# Rectangle is defined as set of co-ordinates represented by top left x, top
left y, width, height
describe 'Rectangle' do
it 'should return the co-ordinates of provided 1 rectangle' do
- input_rectangle = [0,0,1,1]
+ input_rectangle = [0, 0, 1, 1]
input_rectangles = [input_rectangle]
expect(rectangle(input_rectangles)).to eq(input_rectangle)
end
it 'should return the co-ordinates of the rectangle which is inside a
iframe' do
- input_rectangle = [50,50,10,10]
- iframe_rectangle = [100,100,20,20]
+ input_rectangle = [50, 50, 10, 10]
+ iframe_rectangle = [100, 100, 20, 20]
input_rectangles = [input_rectangle]
output_rectangle = [150, 150, 10, 10]
expect(rectangle(input_rectangles, iframe_rectangle)).to
eq(output_rectangle)
end
it 'if we provide 2 rectangles and if one contains the other then it should
return co-ordinates of bigger rectangle' do
- input_rectangle_1 = [0,0,1,1]
- input_rectangle_2 = [0,0,2,2]
+ input_rectangle_1 = [0, 0, 1, 1]
+ input_rectangle_2 = [0, 0, 2, 2]
input_rectangles = [input_rectangle_1, input_rectangle_2]
expect(rectangle(input_rectangles)).to eq(input_rectangle_2)
end
it 'if we provide 2 rectangles it should return co-ordinates of third
rectangle which contains both' do
- input_rectangle_1 = [0,0,1,1]
- input_rectangle_2 = [1,0,1,1]
+ input_rectangle_1 = [0, 0, 1, 1]
+ input_rectangle_2 = [1, 0, 1, 1]
input_rectangles_1 = [input_rectangle_1, input_rectangle_2]
- output_rectangle_1 = [0,0,2,1]
+ output_rectangle_1 = [0, 0, 2, 1]
expect(rectangle(input_rectangles_1)).to eq(output_rectangle_1)
- input_rectangle_3 = [1,1,1,1]
- input_rectangle_4 = [3,3,1,1]
+ input_rectangle_3 = [1, 1, 1, 1]
+ input_rectangle_4 = [3, 3, 1, 1]
input_rectangles_2 = [input_rectangle_3, input_rectangle_4]
- output_rectangle_2 = [1,1,3,3]
+ output_rectangle_2 = [1, 1, 3, 3]
expect(rectangle(input_rectangles_2)).to eq(output_rectangle_2)
end
it 'if we provide 3 rectangles it should return co-ordinates the rectangle
which contains all the input rectangles' do
- input_rectangle_1 = [1,1,1,1]
- input_rectangle_2 = [2,2,1,1]
- input_rectangle_3 = [3,3,1,1]
+ input_rectangle_1 = [1, 1, 1, 1]
+ input_rectangle_2 = [2, 2, 1, 1]
+ input_rectangle_3 = [3, 3, 1, 1]
input_rectangles = [input_rectangle_1, input_rectangle_2,
input_rectangle_3]
- output_rectangle_1 = [1,1,3,3]
+ output_rectangle_1 = [1, 1, 3, 3]
expect(rectangle(input_rectangles)).to eq(output_rectangle_1)
end
end
@@ -50,26 +50,26 @@
describe 'Calculate topleft co-ordinates' do
it 'if we provide 1 rectangle then it should return top left co-ordinates of
the input rectangle' do
- input_rectangle = [2,2,1,1]
+ input_rectangle = [2, 2, 1, 1]
input_rectangles = [input_rectangle]
- output_coordinates = [2,2]
+ output_coordinates = [2, 2]
expect(top_left_x_y(input_rectangles)).to eq(output_coordinates)
end
it 'if we provide 2 rectangles then it should return top left co-ordinates
of the biggest rectangle containing both rectangles' do
- input_rectangle_1 = [1,0,1,1]
- input_rectangle_2 = [0,0,1,1]
+ input_rectangle_1 = [1, 0, 1, 1]
+ input_rectangle_2 = [0, 0, 1, 1]
input_rectangles = [input_rectangle_1, input_rectangle_2]
- output_coordinates = [0,0]
+ output_coordinates = [0, 0]
expect(top_left_x_y(input_rectangles)).to eq(output_coordinates)
end
it 'if we provide 3 rectangles then it should return top left co-ordinates
of the biggest rectangle containing both rectangles' do
- input_rectangle_1 = [3,3,1,1]
- input_rectangle_2 = [2,2,1,1]
- input_rectangle_3 = [1,1,1,1]
+ input_rectangle_1 = [3, 3, 1, 1]
+ input_rectangle_2 = [2, 2, 1, 1]
+ input_rectangle_3 = [1, 1, 1, 1]
input_rectangles = [input_rectangle_1, input_rectangle_2,
input_rectangle_3]
- output_coordinates = [1,1]
+ output_coordinates = [1, 1]
expect(top_left_x_y(input_rectangles)).to eq(output_coordinates)
end
@@ -78,26 +78,26 @@
describe 'Topleft co-ordinates x' do
it 'if we provide 1 rectangle then it should return array of top left x
co-ordinate of the input rectangle' do
- input_rectangle = [2,2,1,1]
+ input_rectangle = [2, 2, 1, 1]
input_rectangles = [input_rectangle]
output_coordinates = [2]
expect(top_left_x_coordinates(input_rectangles)).to eq(output_coordinates)
end
it 'if we provide 2 rectangles then it should return array top left x
co-ordinates' do
- input_rectangle_1 = [0,0,1,1]
- input_rectangle_2 = [1,0,1,1]
+ input_rectangle_1 = [0, 0, 1, 1]
+ input_rectangle_2 = [1, 0, 1, 1]
input_rectangles = [input_rectangle_1, input_rectangle_2]
- output_coordinates = [0,1]
+ output_coordinates = [0, 1]
expect(top_left_x_coordinates(input_rectangles)).to eq(output_coordinates)
end
it 'if we provide 3 rectangles then it should return array of top left x
co-ordinates' do
- input_rectangle_1 = [3,3,1,1]
- input_rectangle_2 = [2,2,1,1]
- input_rectangle_3 = [1,1,1,1]
+ input_rectangle_1 = [3, 3, 1, 1]
+ input_rectangle_2 = [2, 2, 1, 1]
+ input_rectangle_3 = [1, 1, 1, 1]
input_rectangles = [input_rectangle_1, input_rectangle_2,
input_rectangle_3]
- output_coordinates = [3,2,1]
+ output_coordinates = [3, 2, 1]
expect(top_left_x_coordinates(input_rectangles)).to eq(output_coordinates)
end
@@ -106,26 +106,26 @@
describe 'Topleft co-ordinates y' do
it 'if we provide 1 rectangle then it should return array of top left y
co-ordinate of the input rectangle' do
- input_rectangle = [2,2,1,1]
+ input_rectangle = [2, 2, 1, 1]
input_rectangles = [input_rectangle]
output_coordinates = [2]
expect(top_left_y_coordinates(input_rectangles)).to eq(output_coordinates)
end
it 'if we provide 2 rectangles then it should return array top left y
co-ordinates' do
- input_rectangle_1 = [0,0,1,1]
- input_rectangle_2 = [1,0,1,1]
+ input_rectangle_1 = [0, 0, 1, 1]
+ input_rectangle_2 = [1, 0, 1, 1]
input_rectangles = [input_rectangle_1, input_rectangle_2]
- output_coordinates = [0,0]
+ output_coordinates = [0, 0]
expect(top_left_y_coordinates(input_rectangles)).to eq(output_coordinates)
end
it 'if we provide 3 rectangles then it should return array of top left y
co-ordinates' do
- input_rectangle_1 = [3,3,1,1]
- input_rectangle_2 = [2,2,1,1]
- input_rectangle_3 = [1,1,1,1]
+ input_rectangle_1 = [3, 3, 1, 1]
+ input_rectangle_2 = [2, 2, 1, 1]
+ input_rectangle_3 = [1, 1, 1, 1]
input_rectangles = [input_rectangle_1, input_rectangle_2,
input_rectangle_3]
- output_coordinates = [3,2,1]
+ output_coordinates = [3, 2, 1]
expect(top_left_y_coordinates(input_rectangles)).to eq(output_coordinates)
end
@@ -134,26 +134,26 @@
describe 'Calculate bottomright co-ordinates' do
it 'if we provide 1 rectangle then it should return bottom right
co-ordinates of the input rectangle' do
- input_rectangle = [2,2,1,1]
+ input_rectangle = [2, 2, 1, 1]
input_rectangles = [input_rectangle]
- output_coordinates = [3,3]
+ output_coordinates = [3, 3]
expect(bottom_right_x_y(input_rectangles)).to eq(output_coordinates)
end
it 'if we provide 2 rectangles then it should return bottom right
co-ordinates of the biggest rectangle containing both rectangles' do
- input_rectangle_1 = [1,0,1,1]
- input_rectangle_2 = [0,0,1,1]
+ input_rectangle_1 = [1, 0, 1, 1]
+ input_rectangle_2 = [0, 0, 1, 1]
input_rectangles = [input_rectangle_1, input_rectangle_2]
- output_coordinates = [2,1]
+ output_coordinates = [2, 1]
expect(bottom_right_x_y(input_rectangles)).to eq(output_coordinates)
end
it 'if we provide 3 rectangles then it should return bottom right
co-ordinates of the biggest rectangle containing both rectangles' do
- input_rectangle_1 = [3,3,1,1]
- input_rectangle_2 = [2,2,1,1]
- input_rectangle_3 = [1,1,1,1]
+ input_rectangle_1 = [3, 3, 1, 1]
+ input_rectangle_2 = [2, 2, 1, 1]
+ input_rectangle_3 = [1, 1, 1, 1]
input_rectangles = [input_rectangle_1, input_rectangle_2,
input_rectangle_3]
- output_coordinates = [4,4]
+ output_coordinates = [4, 4]
expect(bottom_right_x_y(input_rectangles)).to eq(output_coordinates)
end
@@ -162,26 +162,26 @@
describe 'Bottom right co-ordinates x' do
it 'if we provide 1 rectangle then it should return array of bottom right x
co-ordinate of the input rectangle' do
- input_rectangle = [2,2,1,1]
+ input_rectangle = [2, 2, 1, 1]
input_rectangles = [input_rectangle]
output_coordinates = [3]
expect(bottom_right_x_coordinates(input_rectangles)).to
eq(output_coordinates)
end
it 'if we provide 2 rectangles then it should return array bottom right x
co-ordinates' do
- input_rectangle_1 = [0,0,1,1]
- input_rectangle_2 = [1,0,1,1]
+ input_rectangle_1 = [0, 0, 1, 1]
+ input_rectangle_2 = [1, 0, 1, 1]
input_rectangles = [input_rectangle_1, input_rectangle_2]
- output_coordinates = [1,2]
+ output_coordinates = [1, 2]
expect(bottom_right_x_coordinates(input_rectangles)).to
eq(output_coordinates)
end
it 'if we provide 3 rectangles then it should return array of bottom right x
co-ordinates' do
- input_rectangle_1 = [3,3,1,1]
- input_rectangle_2 = [2,2,1,1]
- input_rectangle_3 = [1,1,1,1]
+ input_rectangle_1 = [3, 3, 1, 1]
+ input_rectangle_2 = [2, 2, 1, 1]
+ input_rectangle_3 = [1, 1, 1, 1]
input_rectangles = [input_rectangle_1, input_rectangle_2,
input_rectangle_3]
- output_coordinates = [4,3,2]
+ output_coordinates = [4, 3, 2]
expect(bottom_right_x_coordinates(input_rectangles)).to
eq(output_coordinates)
end
@@ -190,26 +190,26 @@
describe 'Bottom right co-ordinates y' do
it 'if we provide 1 rectangle then it should return array of bottom right y
co-ordinate of the input rectangle' do
- input_rectangle = [2,2,1,1]
+ input_rectangle = [2, 2, 1, 1]
input_rectangles = [input_rectangle]
output_coordinates = [3]
expect(bottom_right_y_coordinates(input_rectangles)).to
eq(output_coordinates)
end
it 'if we provide 2 rectangles then it should return array bottom right y
co-ordinates' do
- input_rectangle_1 = [0,0,1,1]
- input_rectangle_2 = [1,0,1,1]
+ input_rectangle_1 = [0, 0, 1, 1]
+ input_rectangle_2 = [1, 0, 1, 1]
input_rectangles = [input_rectangle_1, input_rectangle_2]
- output_coordinates = [1,1]
+ output_coordinates = [1, 1]
expect(bottom_right_y_coordinates(input_rectangles)).to
eq(output_coordinates)
end
it 'if we provide 3 rectangles then it should return array of bottom right y
co-ordinates' do
- input_rectangle_1 = [3,3,1,1]
- input_rectangle_2 = [2,2,1,1]
- input_rectangle_3 = [1,1,1,1]
+ input_rectangle_1 = [3, 3, 1, 1]
+ input_rectangle_2 = [2, 2, 1, 1]
+ input_rectangle_3 = [1, 1, 1, 1]
input_rectangles = [input_rectangle_1, input_rectangle_2,
input_rectangle_3]
- output_coordinates = [4,3,2]
+ output_coordinates = [4, 3, 2]
expect(bottom_right_y_coordinates(input_rectangles)).to
eq(output_coordinates)
end
--
To view, visit https://gerrit.wikimedia.org/r/174962
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia11c32c74acf4c2226f84ea566f4074b193f4e20
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Cmcmahon <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits