@@ -29,6 +29,7 @@ def given_a_tab_stop_inches_from_paragraph_left_edge(context, in_or_out):
29
29
tab_idx = {'out' : 0 , 'in' : 1 }[in_or_out ]
30
30
document = Document (test_docx ('tab-stops' ))
31
31
paragraph_format = document .paragraphs [2 ].paragraph_format
32
+ context .tab_stops = paragraph_format .tab_stops
32
33
context .tab_stop = paragraph_format .tab_stops [tab_idx ]
33
34
34
35
@@ -69,10 +70,15 @@ def when_I_assign_member_to_tab_stop_leader(context, member):
69
70
70
71
71
72
@when ('I assign {value} to tab_stop.position' )
72
- def when_I_assign_value_to_tab_stop_value (context , value ):
73
+ def when_I_assign_value_to_tab_stop_position (context , value ):
73
74
context .tab_stop .position = int (value )
74
75
75
76
77
+ @when ('I change the tab at {index} position to {value}' )
78
+ def when_I_change_the_tab_at_index_position_to_value (context , index , value ):
79
+ context .tab_stops [int (index )].position = int (value )
80
+
81
+
76
82
@when ('I call tab_stops.clear_all()' )
77
83
def when_I_call_tab_stops_clear_all (context ):
78
84
tab_stops = context .tab_stops
@@ -128,6 +134,14 @@ def then_tab_stop_position_is_position(context, position):
128
134
assert tab_stop .position == int (position )
129
135
130
136
137
+ # Use this rather than the above method when you change the position,
138
+ # as setting position invalidates context.tab_stop
139
+ @then ('tab_stops at position {index} is {value}' )
140
+ def then_tab_stops_at_position_index_is_value (context , index , value ):
141
+ tab_stops = context .tab_stops
142
+ assert tab_stops [int (index )].position == int (value )
143
+
144
+
131
145
@then ('the removed tab stop is no longer present in tab_stops' )
132
146
def then_the_removed_tab_stop_is_no_longer_present_in_tab_stops (context ):
133
147
tab_stops = context .tab_stops
0 commit comments