diff options
| author | Ben Beltran <ben@nsovocal.com> | 2019-03-14 23:19:58 +0100 |
|---|---|---|
| committer | Ben Beltran <ben@nsovocal.com> | 2019-03-14 23:19:58 +0100 |
| commit | b009b50e81b6c1d0d691505b5f5c0418f559bfc0 (patch) | |
| tree | 5fae800e76219eba28634cb236565f9b4bb7a2f7 /atom/packages/pretty-json/spec | |
| parent | 4efcafab7f0aa454f9ebe767133654bc9f44e12c (diff) | |
Remove Atom config
Diffstat (limited to 'atom/packages/pretty-json/spec')
| -rw-r--r-- | atom/packages/pretty-json/spec/index-spec.coffee | 186 |
1 files changed, 0 insertions, 186 deletions
diff --git a/atom/packages/pretty-json/spec/index-spec.coffee b/atom/packages/pretty-json/spec/index-spec.coffee deleted file mode 100644 index 2f95fcd..0000000 --- a/atom/packages/pretty-json/spec/index-spec.coffee +++ /dev/null @@ -1,186 +0,0 @@ -{WorkspaceView} = require 'atom' - -describe "pretty json", -> - [editor, editorView] = [] - - prettify = (callback) -> - editorView.trigger "pretty-json:prettify" - runs(callback) - - minify = (callback) -> - editorView.trigger "pretty-json:minify" - runs(callback) - - sortedPrettify = (callback) -> - editorView.trigger "pretty-json:sort-and-prettify" - runs(callback) - - beforeEach -> - waitsForPromise -> atom.packages.activatePackage('pretty-json') - waitsForPromise -> atom.packages.activatePackage('language-json') - - atom.workspaceView = new WorkspaceView - atom.workspaceView.openSync() - - editorView = atom.workspaceView.getActiveView() - editor = editorView.getEditor() - - describe "when no text is selected", -> - it "doesn't change anything", -> - editor.setText """ - Start - { "a": "b", "c": "d" } - End - """ - - prettify -> - expect(editor.getText()).toBe """ - Start - { "a": "b", "c": "d" } - End - """ - - describe "when a valid json text is selected", -> - it "formats it correctly", -> - editor.setText """ - Start - { "a": "b", "c": "d" } - End - """ - editor.setSelectedBufferRange([[1,0], [1, 22]]) - - prettify -> - expect(editor.getText()).toBe """ - Start - { - "a": "b", - "c": "d" - } - End - """ - - describe "when an invalid json text is selected", -> - it "doesn't change anything", -> - editor.setText """ - Start - {] - End - """ - editor.setSelectedBufferRange([[1,0], [1, 2]]) - - prettify -> - expect(editor.getText()).toBe """ - Start - {] - End - """ - - describe "JSON file", -> - beforeEach -> - editor.setGrammar(atom.syntax.selectGrammar('test.json')) - - describe "with invalid JSON", -> - it "doesn't change anything", -> - editor.setText """ - {] - """ - - prettify -> - expect(editor.getText()).toBe """ - {] - """ - - describe "with valid JSON", -> - it "formats the whole file correctly", -> - editor.setText """ - { "a": "b", "c": "d" } - """ - - prettify -> - expect(editor.getText()).toBe """ - { - "a": "b", - "c": "d" - } - """ - - describe "Sort and prettify", -> - beforeEach -> - editor.setGrammar(atom.syntax.selectGrammar('test.json')) - - describe "with invalid JSON", -> - it "doesn't change anything", -> - editor.setText """ - {] - """ - - sortedPrettify -> - expect(editor.getText()).toBe """ - {] - """ - - describe "with valid JSON", -> - it "formats the whole file correctly", -> - editor.setText """ - { "c": "d", "a": "b" } - """ - - sortedPrettify -> - expect(editor.getText()).toBe """ - { - "a": "b", - "c": "d" - } - """ - - describe "Minify JSON file", -> - beforeEach -> - editor.setGrammar(atom.syntax.selectGrammar('test.json')) - - it "Returns same string from invalid JSON", -> - editor.setText """ - { - [ - } - """ - - minify -> - expect(editor.getText()).toBe """ - { - [ - } - """ - - it "Minifies valid JSON", -> - editor.setText """ - { - "a": "b", - "c": "d", - "num": 123 - } - """ - - minify -> - expect(editor.getText()).toBe """ - {"a":"b","c":"d","num":123} - """ - - describe "Minify selected JSON", -> - it "Minifies JSON data", -> - editor.setText """ - Start - { - "a": "b", - "c": "d", - "num": 123 - } - End - """ - editor.setSelectedBufferRange([[1,0], [5, 1]]) - - minify -> - expect(editor.getText()).toBe """ - Start - {"a":"b","c":"d","num":123} - End - """ |