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