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

Don't assume that save is synchronous in specs #155

Merged
merged 1 commit into from
May 23, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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