diff --git a/common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee b/common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee index 8d75b1822d..25f862d133 100644 --- a/common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee +++ b/common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee @@ -10,8 +10,11 @@ describe 'MarkdownEditingDescriptor', -> it 'recognizes x as a selection if there is non-whitespace after x', -> revisedSelection = MarkdownEditingDescriptor.insertMultipleChoice('a\nx b\nc\nx \nd\n x e') expect(revisedSelection).toEqual('( ) a\n(x) b\n( ) c\n( ) x \n( ) d\n(x) e\n') - it 'removes multiple newlines', -> - revisedSelection = MarkdownEditingDescriptor.insertMultipleChoice('a\nx b\n\n\nc') + it 'recognizes x as a selection if it is first non whitespace and has whitespace with other non-whitespace', -> + revisedSelection = MarkdownEditingDescriptor.insertMultipleChoice(' x correct\n x \nex post facto\nb x c\nx c') + expect(revisedSelection).toEqual('(x) correct\n( ) x \n( ) ex post facto\n( ) b x c\n(x) c\n') + it 'removes multiple newlines but not last one', -> + revisedSelection = MarkdownEditingDescriptor.insertMultipleChoice('a\nx b\n\n\nc\n') expect(revisedSelection).toEqual('( ) a\n(x) b\n( ) c\n') describe 'insertCheckboxChoice', ->