Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #155 from atom/mb-handle-async-save
Browse files Browse the repository at this point in the history
Don't assume that save is synchronous in specs
  • Loading branch information
Max Brunsfeld authored May 23, 2017
2 parents 88f4355 + dad6a6f commit 771a9f1
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions spec/whitespace-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,12 @@ describe "Whitespace", ->
buffer.setText("foo \nbar\t \n\nbaz")

it "saves the file without removing any trailing whitespace", ->
atom.commands.dispatch(workspaceElement, 'whitespace:save-with-trailing-whitespace')
expect(buffer.getText()).toBe "foo \nbar\t \n\nbaz"
expect(buffer.isModified()).toBe false
waitsFor (done) ->
buffer.onDidSave ->
expect(buffer.getText()).toBe "foo \nbar\t \n\nbaz"
expect(buffer.isModified()).toBe false
done()
atom.commands.dispatch(workspaceElement, 'whitespace:save-with-trailing-whitespace')

describe "when the 'whitespace:save-without-trailing-whitespace' command is run", ->
beforeEach ->
Expand All @@ -358,9 +361,12 @@ describe "Whitespace", ->
buffer.setText("foo \nbar\t \n\nbaz")

it "saves the file and removes any trailing whitespace", ->
atom.commands.dispatch(workspaceElement, 'whitespace:save-without-trailing-whitespace')
expect(buffer.getText()).toBe "foo\nbar\n\nbaz"
expect(buffer.isModified()).toBe false
waitsFor (done) ->
buffer.onDidSave ->
expect(buffer.getText()).toBe "foo\nbar\n\nbaz"
expect(buffer.isModified()).toBe false
done()
atom.commands.dispatch(workspaceElement, 'whitespace:save-without-trailing-whitespace')

describe "when the 'whitespace:convert-tabs-to-spaces' command is run", ->
it "removes leading \\t characters and replaces them with spaces using the configured tab length", ->
Expand Down

0 comments on commit 771a9f1

Please sign in to comment.