@@ -347,9 +347,12 @@ describe "Whitespace", ->
347
347
buffer .setText (" foo \n bar\t \n\n baz" )
348
348
349
349
it " saves the file without removing any trailing whitespace" , ->
350
- atom .commands .dispatch (workspaceElement, ' whitespace:save-with-trailing-whitespace' )
351
- expect (buffer .getText ()).toBe " foo \n bar\t \n\n baz"
352
- expect (buffer .isModified ()).toBe false
350
+ waitsFor (done ) ->
351
+ buffer .onDidSave ->
352
+ expect (buffer .getText ()).toBe " foo \n bar\t \n\n baz"
353
+ expect (buffer .isModified ()).toBe false
354
+ done ()
355
+ atom .commands .dispatch (workspaceElement, ' whitespace:save-with-trailing-whitespace' )
353
356
354
357
describe " when the 'whitespace:save-without-trailing-whitespace' command is run" , ->
355
358
beforeEach ->
@@ -358,9 +361,12 @@ describe "Whitespace", ->
358
361
buffer .setText (" foo \n bar\t \n\n baz" )
359
362
360
363
it " saves the file and removes any trailing whitespace" , ->
361
- atom .commands .dispatch (workspaceElement, ' whitespace:save-without-trailing-whitespace' )
362
- expect (buffer .getText ()).toBe " foo\n bar\n\n baz"
363
- expect (buffer .isModified ()).toBe false
364
+ waitsFor (done ) ->
365
+ buffer .onDidSave ->
366
+ expect (buffer .getText ()).toBe " foo\n bar\n\n baz"
367
+ expect (buffer .isModified ()).toBe false
368
+ done ()
369
+ atom .commands .dispatch (workspaceElement, ' whitespace:save-without-trailing-whitespace' )
364
370
365
371
describe " when the 'whitespace:convert-tabs-to-spaces' command is run" , ->
366
372
it " removes leading \\ t characters and replaces them with spaces using the configured tab length" , ->
0 commit comments