| 
									
										
										
										
											2020-07-03 14:39:25 -07:00
										 |  |  | test("basic method shorthand", () => { | 
					
						
							| 
									
										
										
										
											2020-07-06 07:37:45 -07:00
										 |  |  |     const o = { | 
					
						
							|  |  |  |         foo: "bar", | 
					
						
							|  |  |  |         getFoo() { | 
					
						
							|  |  |  |             return this.foo; | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     expect(o.getFoo()).toBe("bar"); | 
					
						
							| 
									
										
										
										
											2020-07-03 14:39:25 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | test("numeric literal method shorthand", () => { | 
					
						
							| 
									
										
										
										
											2020-07-06 07:37:45 -07:00
										 |  |  |     const o = { | 
					
						
							|  |  |  |         foo: "bar", | 
					
						
							|  |  |  |         12() { | 
					
						
							|  |  |  |             return this.foo; | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     expect(o[12]()).toBe("bar"); | 
					
						
							| 
									
										
										
										
											2020-07-03 14:39:25 -07:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2020-04-30 23:40:45 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-03 14:39:25 -07:00
										 |  |  | test("string literal method shorthand", () => { | 
					
						
							| 
									
										
										
										
											2020-07-06 07:37:45 -07:00
										 |  |  |     const o = { | 
					
						
							|  |  |  |         foo: "bar", | 
					
						
							|  |  |  |         "hello friends"() { | 
					
						
							|  |  |  |             return this.foo; | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     expect(o["hello friends"]()).toBe("bar"); | 
					
						
							| 
									
										
										
										
											2020-07-03 14:39:25 -07:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2020-04-30 23:40:45 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-03 14:39:25 -07:00
										 |  |  | test("computed property method shorthand", () => { | 
					
						
							| 
									
										
										
										
											2020-07-06 07:37:45 -07:00
										 |  |  |     const o = { | 
					
						
							|  |  |  |         foo: "bar", | 
					
						
							|  |  |  |         [4 + 10]() { | 
					
						
							|  |  |  |             return this.foo; | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     expect(o[14]()).toBe("bar"); | 
					
						
							| 
									
										
										
										
											2020-07-03 14:39:25 -07:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2020-07-07 21:39:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | test("symbol computed property shorthand", () => { | 
					
						
							|  |  |  |     const s = Symbol("foo"); | 
					
						
							|  |  |  |     const o = { | 
					
						
							|  |  |  |         foo: "bar", | 
					
						
							|  |  |  |         [s]() { | 
					
						
							|  |  |  |             return this.foo; | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     expect(o[s]()).toBe("bar"); | 
					
						
							|  |  |  | }); |