Skip to content

Commit 9005304

Browse files
author
Mattia Roccoberton
committed
Update specs
1 parent 4a042e7 commit 9005304

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

spec/system/dynamic_fields_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ def test_unset_css(target, options = {})
5353
expect(page).to have_css(target)
5454
end
5555

56-
def test_change_css(target, attrs1, attrs2, options = {})
56+
def test_change_css(target, options = {})
5757
spec_message("test change CSS on #{target} ...")
5858

59-
expect(page).to have_css(target, attrs1)
59+
expect(page).to have_css(target, **options[:attrs1])
6060
block_given? ? yield : apply_action(options[:action])
61-
expect(page).to have_css(target, attrs2)
61+
expect(page).to have_css(target, **options[:attrs2])
6262
return if options[:one_way]
6363

6464
block_given? ? yield : apply_action(options[:action], inverse: true)
65-
expect(page).to have_css(target, attrs1)
65+
expect(page).to have_css(target, **options[:attrs1])
6666
end
6767

6868
context 'with some dynamic fields' do
@@ -132,17 +132,17 @@ def test_change_css(target, attrs1, attrs2, options = {})
132132
# --- hide
133133
spec_message('check data-then="hide" action')
134134
target = '#post_data_field_241_input .inline-hints'
135-
test_change_css(target, { visible: :visible }, { visible: :hidden }, action: [:click, '#post_data_field_241'])
135+
test_change_css(target, { attrs1: { visible: :visible }, attrs2: { visible: :hidden }, action: [:click, '#post_data_field_241'] })
136136

137137
# --- fade
138138
spec_message('check data-then="fade" action')
139139
target = '#post_data_field_251_input .inline-hints'
140-
test_change_css(target, { visible: :visible }, { visible: :hidden }, action: [:click, '#post_data_field_251'])
140+
test_change_css(target, { attrs1: { visible: :visible }, attrs2: { visible: :hidden }, action: [:click, '#post_data_field_251'] })
141141

142142
# --- slide
143143
spec_message('check data-then="slide" action')
144144
target = '#post_data_field_261_input .inline-hints'
145-
test_change_css(target, { visible: :visible }, { visible: :hidden }, action: [:click, '#post_data_field_261'])
145+
test_change_css(target, { attrs1: { visible: :visible }, attrs2: { visible: :hidden }, action: [:click, '#post_data_field_261'] })
146146

147147
# --- setText
148148
spec_message('check data-then="setText ..." action')
@@ -154,7 +154,7 @@ def test_change_css(target, attrs1, attrs2, options = {})
154154
spec_message('check data-then="addStyle ..." action')
155155
style1 = { style: { 'margin-right': '20px' } }
156156
style2 = { style: 'margin-right: 20px; font-size: 10px; padding: 3px' }
157-
test_change_css('#post_data_field_281', style1, style2, action: [:click, '#post_data_field_281'])
157+
test_change_css('#post_data_field_281', { attrs1: style1, attrs2: style2, action: [:click, '#post_data_field_281'] })
158158

159159
# --- gtarget
160160
spec_message('check data-gtarget="..."')

0 commit comments

Comments
 (0)