@@ -4,7 +4,7 @@ Feature: Expand and collapse things
44 When I insert "var a = { b: 1, c: 'def' };"
55 And I turn on js2-mode and js2-refactor-mode
66 And I go to the front of the word "b"
7- And I press "C-c C-m eo "
7+ And I press "C-c C-m ee "
88 Then I should see:
99 """
1010 var a = {
@@ -17,7 +17,7 @@ Feature: Expand and collapse things
1717 When I insert "var a = { b: 1, c: 'def, ghi' };"
1818 And I turn on js2-mode and js2-refactor-mode
1919 And I go to the front of the word "b"
20- And I press "C-c C-m eo "
20+ And I press "C-c C-m ee "
2121 Then I should see:
2222 """
2323 var a = {
@@ -36,7 +36,7 @@ Feature: Expand and collapse things
3636 """
3737 And I turn on js2-mode and js2-refactor-mode
3838 And I go to the front of the word "b"
39- And I press "C-c C-m co "
39+ And I press "C-c C-m cc "
4040 Then I should see "var a = { b: 1, c: 'def' };"
4141
4242 Scenario : Contracting objects with comma
@@ -49,14 +49,14 @@ Feature: Expand and collapse things
4949 """
5050 And I turn on js2-mode and js2-refactor-mode
5151 And I go to the front of the word "b"
52- And I press "C-c C-m co "
52+ And I press "C-c C-m cc "
5353 Then I should see "var a = { b: 1, c: 'def, ghi' };"
5454
5555 Scenario : Expanding functions
5656 When I insert "function f (a, b, c) { var t = a + b + c; return t; }"
5757 And I turn on js2-mode and js2-refactor-mode
5858 And I go to the front of the word "var"
59- And I press "C-c C-m eu "
59+ And I press "C-c C-m ee "
6060 Then I should see:
6161 """
6262 function f (a, b, c) {
@@ -69,7 +69,7 @@ Feature: Expand and collapse things
6969 When I insert "function f (a, b, c) { var t = a + b + c; var arr = [1, 2, 3, a, b]; return [t, arr]; }"
7070 And I turn on js2-mode and js2-refactor-mode
7171 And I go to the front of the word "var"
72- And I press "C-c C-m eu "
72+ And I press "C-c C-m ee "
7373 Then I should see:
7474 """
7575 function f (a, b, c) {
@@ -83,7 +83,7 @@ Feature: Expand and collapse things
8383 When I insert "function f (a, b, c) { var t = a + b + c; var o = {e1: a, e2: b + 1, e3: 'xyzzy'}; return o; }"
8484 And I turn on js2-mode and js2-refactor-mode
8585 And I go to the front of the word "var"
86- And I press "C-c C-m eu "
86+ And I press "C-c C-m ee "
8787 Then I should see:
8888 """
8989 function f (a, b, c) {
@@ -92,18 +92,18 @@ Feature: Expand and collapse things
9292 return o;
9393 }
9494 """
95-
95+
9696 Scenario : Expanding arrow functions
9797 When I insert "var arrowFunc = (a, b, c) => { return a + b + c; }"
9898 And I turn on js2-mode and js2-refactor-mode
9999 And I go to the front of the word "return"
100- And I press "C-c C-m eu "
100+ And I press "C-c C-m ee "
101101 Then I should see:
102102 """
103103 var arrowFunc = (a, b, c) => {
104104 return a + b + c;
105105 }
106- """
106+ """
107107
108108 Scenario : Contracting arrow functions
109109 When I insert:
@@ -114,7 +114,7 @@ Feature: Expand and collapse things
114114 """
115115 And I turn on js2-mode and js2-refactor-mode
116116 And I go to the front of the word "return"
117- And I press "C-c C-m cu "
117+ And I press "C-c C-m cc "
118118 Then I should see:
119119 """
120120 var arrowFunc = (a, b, c) => { return a + b + c; }
@@ -130,7 +130,7 @@ Feature: Expand and collapse things
130130 """
131131 And I turn on js2-mode and js2-refactor-mode
132132 And I go to the front of the word "var"
133- And I press "C-c C-m cu "
133+ And I press "C-c C-m cc "
134134 Then I should see "function f (a, b, c) { var t = a + b + c; return t; }"
135135
136136 Scenario : Contracting functions containing arrays
@@ -144,7 +144,7 @@ Feature: Expand and collapse things
144144 """
145145 And I turn on js2-mode and js2-refactor-mode
146146 And I go to the front of the word "var"
147- And I press "C-c C-m cu "
147+ And I press "C-c C-m cc "
148148 Then I should see "function f (a, b, c) { var t = a + b + c; var arr = [1, 2, 3, a, b]; return [t, arr]; }"
149149
150150 Scenario : Contracting functions containing object literals
@@ -158,7 +158,7 @@ Feature: Expand and collapse things
158158 """
159159 And I turn on js2-mode and js2-refactor-mode
160160 And I go to the front of the word "var"
161- And I press "C-c C-m cu "
161+ And I press "C-c C-m cc "
162162 Then I should see "function f (a, b, c) { var t = a + b + c; var o = {e1: a, e2: b + 1, e3: 'xyzzy'}; return o; }"
163163
164164 Scenario : Expanding function call arguments
@@ -168,7 +168,7 @@ Feature: Expand and collapse things
168168 """
169169 And I turn on js2-mode and js2-refactor-mode
170170 And I go to the front of the word "overlay"
171- And I press "C-c C-m ec "
171+ And I press "C-c C-m ee "
172172 Then I should see:
173173 """
174174 m(
@@ -178,7 +178,7 @@ Feature: Expand and collapse things
178178 );
179179 """
180180 And I go to the front of the word "tr"
181- And I press "C-c C-m ec "
181+ And I press "C-c C-m ee "
182182 Then I should see:
183183 """
184184 m(
@@ -248,7 +248,7 @@ Feature: Expand and collapse things
248248 When I insert "var a = [ b, 1, c, 3.1415927 ];"
249249 And I turn on js2-mode and js2-refactor-mode
250250 And I go to the front of the word "b"
251- And I press "C-c C-m ea "
251+ And I press "C-c C-m ee "
252252 Then I should see:
253253 """
254254 var a = [
@@ -271,7 +271,7 @@ Feature: Expand and collapse things
271271 """
272272 And I turn on js2-mode and js2-refactor-mode
273273 And I go to the front of the word "b"
274- And I press "C-c C-m ca "
274+ And I press "C-c C-m cc "
275275 Then I should see "var a = [ b, 1, c, 3.1415927 ];"
276276
277277 Scenario : Expanding arrays with comment
@@ -284,7 +284,7 @@ Feature: Expand and collapse things
284284 """
285285 And I turn on js2-mode and js2-refactor-mode
286286 And I go to character "b"
287- And I press "C-c C-m ea "
287+ And I press "C-c C-m ee "
288288 Then I should see:
289289 """
290290 var a = [
@@ -293,3 +293,94 @@ Feature: Expand and collapse things
293293 4
294294 ];
295295 """
296+
297+ Scenario : Expanding and contracting node at point
298+ When I insert:
299+ """
300+ var a = [1, 2, 3];
301+ var b = {c:4, d:5};
302+ function abc(x,y){x+=z; return x+y;}
303+ func(6,7);
304+ """
305+ And I turn on js2-mode and js2-refactor-mode
306+ And I go to the front of the word "1"
307+ And I press "C-c C-m ee"
308+ Then I should see:
309+ """
310+ var a = [
311+ 1,
312+ 2,
313+ 3
314+ ];
315+ var b = {c:4, d:5};
316+ function abc(x,y){x+=z; return x+y;}
317+ func(6,7);
318+ """
319+ When I press "C-c C-m cc"
320+ Then I should see:
321+ """
322+ var a = [ 1, 2, 3 ];
323+ var b = {c:4, d:5};
324+ function abc(x,y){x+=z; return x+y;}
325+ func(6,7);
326+ """
327+ When I go to the front of the word "4"
328+ And I press "C-c C-m ee"
329+ Then I should see:
330+ """
331+ var a = [ 1, 2, 3 ];
332+ var b = {
333+ c:4,
334+ d:5
335+ };
336+ function abc(x,y){x+=z; return x+y;}
337+ func(6,7);
338+ """
339+ When I press "C-c C-m cc"
340+ Then I should see:
341+ """
342+ var a = [ 1, 2, 3 ];
343+ var b = { c:4, d:5 };
344+ function abc(x,y){x+=z; return x+y;}
345+ func(6,7);
346+ """
347+ When I go to the front of the word "z"
348+ And I press "C-c C-m ee"
349+ Then I should see:
350+ """
351+ var a = [ 1, 2, 3 ];
352+ var b = { c:4, d:5 };
353+ function abc(x,y){
354+ x+=z;
355+ return x+y;
356+ }
357+ func(6,7);
358+ """
359+ When I press "C-c C-m cc"
360+ Then I should see:
361+ """
362+ var a = [ 1, 2, 3 ];
363+ var b = { c:4, d:5 };
364+ function abc(x,y){ x+=z; return x+y; }
365+ func(6,7);
366+ """
367+ When I go to the front of the word "6"
368+ And I press "C-c C-m ee"
369+ Then I should see:
370+ """
371+ var a = [ 1, 2, 3 ];
372+ var b = { c:4, d:5 };
373+ function abc(x,y){ x+=z; return x+y; }
374+ func(
375+ 6,
376+ 7
377+ );
378+ """
379+ When I press "C-c C-m cc"
380+ Then I should see:
381+ """
382+ var a = [ 1, 2, 3 ];
383+ var b = { c:4, d:5 };
384+ function abc(x,y){ x+=z; return x+y; }
385+ func( 6, 7 );
386+ """
0 commit comments