forked from blwasham/dotFiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snippets.cson
140 lines (118 loc) · 2.5 KB
/
snippets.cson
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# '.source.coffee':
# 'Console log':
# 'prefix': 'log'
# 'body': 'console.log $1'
#
# Each scope (e.g. '.source.coffee' above) can only be declared once.
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it in the
# Atom Flight Manual:
# https://atom.io/docs/latest/using-atom-basic-customization#cson
'.source.js':
'console.log':
'prefix': 'cl'
'body': """
console.log("$1", $1);$0
"""
'console.log2':
'prefix': 'c2'
'body': """
console.log("$1", $2);$0
"""
'describe':
'prefix': 'des'
'body': """
describe('$1', () => {
$0
}); // $1
"""
'let':
'prefix': 'let'
'body': """
let $1;
beforeEach(() => $1 = '{$1}');
$0
"""
'let2':
'prefix': 'let2'
'body': """
let $1, $2;
beforeEach(() => $1 = '{$1}');
beforeEach(() => $2 = '{$2}');
$0
"""
'let3':
'prefix': 'let3'
'body': """
let $1, $2, $3;
beforeEach(() => $1 = '{$1}');
beforeEach(() => $2 = '{$2}');
beforeEach(() => $3 = '{$3}');
$0
"""
'should':
'prefix': 'should'
'body': """
it('should $1', () => {
expect($2.$3($4)).toEqual($5);
});
"""
'spy':
'prefix': 'spy'
'body': """
beforeEach(() => $1 = jasmine.createSpy('$1').and.returnValue($2));
afterEach(() => expect($1).toHaveBeenCalledWith($3));
$0
"""
'when':
'prefix': 'when'
'body': """
describe('when $1', () => {
beforeEach(() => spyOn($2,'$3').and.returnValue($4));
afterEach(() => expect($2.$3).toHaveBeenCalledWith($5));
$0
});
"""
'beforeEach':
'prefix': 'bef'
'body': """
beforeEach(() => $1);
"""
'afterEach':
'prefix': 'aft'
'body': """
afterEach(() => $1);
"""
'it':
'prefix': 'it'
'body': """
it('should $1', () => {
$2
});
"""
'test':
'prefix': 'test'
'body': """
/* globals $1 */
(function() {
'use strict';
describe('$1', () => {
beforeEach(() => {
bard.appModule('${2:CHANGE_ME}');
bard.inject(this, '$1');
});
$0
}); // $1
})();
"""