@@ -75,6 +75,11 @@ def when_I_call_add_style(context, name, type_str, builtin_str):
7575 styles .add_style (name , type , builtin = builtin )
7676
7777
78+ @when ('I delete a style' )
79+ def when_I_delete_a_style (context ):
80+ context .document .styles ['No List' ].delete ()
81+
82+
7883# then =====================================================
7984
8085@then ('I can access a style by its UI name' )
@@ -157,9 +162,27 @@ def then_styles_name_is_a_style(context, name):
157162 assert isinstance (style , BaseStyle )
158163
159164
165+ @then ('the deleted style is not in the styles collection' )
166+ def then_the_deleted_style_is_not_in_the_styles_collection (context ):
167+ document = context .document
168+ try :
169+ document .styles ['No List' ]
170+ except KeyError :
171+ return
172+ raise AssertionError ('Style not deleted' )
173+
174+
160175@then ('the document has one additional style' )
161176def then_the_document_has_one_additional_style (context ):
162177 document = context .document
163178 style_count = len (document .styles )
164179 expected_style_count = context .style_count + 1
165180 assert style_count == expected_style_count
181+
182+
183+ @then ('the document has one fewer styles' )
184+ def then_the_document_has_one_fewer_styles (context ):
185+ document = context .document
186+ style_count = len (document .styles )
187+ expected_style_count = context .style_count - 1
188+ assert style_count == expected_style_count
0 commit comments