Merge pull request #305 from wyuenho/refresh-js-snippets
Refresh JS snippets
This commit is contained in:
commit
810d453ac8
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 289f0557-4e11-47c5-bcbf-1105bbec41ce
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: anonymousFunction
|
||||
# key: anfn
|
||||
# --
|
||||
|
||||
(${1:params}) => {
|
||||
${2}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: arrow function
|
||||
# key: af
|
||||
# group: es6
|
||||
# --
|
||||
(${1:arg}) => $0
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 6788dcb5-8d8e-4e30-a97b-83029ecaf89b
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: bindThis
|
||||
# key: bnd
|
||||
# --
|
||||
|
||||
this.${1:methodName} = this.${1:methodName}.bind(this)$0
|
|
@ -1,8 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Class
|
||||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: class
|
||||
# key: class
|
||||
# --
|
||||
var ${1:name} = new Class({
|
||||
initialize: function($2) {
|
||||
$0
|
||||
}
|
||||
});
|
||||
class ${1:Class}${2: extends ${3:ParentClass}} {
|
||||
${4:constructor(${5:arg}) {
|
||||
${6:super(arg);}
|
||||
$7
|
||||
}}
|
||||
|
||||
$0
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: class-es6
|
||||
# key: class
|
||||
# group: es6
|
||||
# --
|
||||
class ${1:Class}${2: extends ${3:ParentClass}} {
|
||||
${4:constructor(${5:arg}) {
|
||||
${6:super(arg);}
|
||||
$7
|
||||
}}
|
||||
|
||||
$0
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 983d648f-a7de-4e22-bab9-bca5cd6188a6
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: Comment Big Block
|
||||
# key: cmmb
|
||||
# --
|
||||
|
||||
/**
|
||||
|--------------------------------------------------
|
||||
| $1
|
||||
|--------------------------------------------------
|
||||
*/
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: b845ab40-1e04-4d11-bb0c-14266e733945
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.assert
|
||||
# key: cas
|
||||
# group: console
|
||||
# --
|
||||
|
||||
console.assert(${1:expression}, ${2:object})
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 9619a671-e44a-4b59-b343-b55b3b1dbbcc
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.clear
|
||||
# key: ccl
|
||||
# group: console
|
||||
# --
|
||||
|
||||
console.clear()
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: dcbcd0f7-7827-4f81-9777-809540ef5c10
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.count
|
||||
# key: cco
|
||||
# group: console
|
||||
# --
|
||||
|
||||
console.count(${1:label})
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: d2272fe8-85d4-44f5-b74c-39a88bb50487
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.dir
|
||||
# key: cdi
|
||||
# group: console
|
||||
# --
|
||||
|
||||
console.dir(${1:object})
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 54ad9659-8b18-40a0-9096-48131f9577da
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.error
|
||||
# key: cer
|
||||
# group: console
|
||||
# --
|
||||
|
||||
console.error(${1:object})
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: b3954656-b9c0-4061-b436-e7412ce008ad
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.groupEnd
|
||||
# key: cge
|
||||
# group: console
|
||||
# --
|
||||
|
||||
console.groupEnd()
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: afebe290-f0e6-403a-9c4f-da33451115cb
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.group
|
||||
# key: cgr
|
||||
# group: console
|
||||
# --
|
||||
|
||||
console.group("${1:label}")
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 006ec5e1-f229-4989-b8b2-fe1da1aab907
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.info
|
||||
# key: cin
|
||||
# group: console
|
||||
# --
|
||||
|
||||
console.info(${1:object})
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 0a1a6d75-a8e0-43fe-b049-1e96c2e04b51
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.log
|
||||
# key: clg
|
||||
# group: console
|
||||
# --
|
||||
|
||||
console.log(${1:object})
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 3d2ddcac-d8c0-4b56-81a7-523eb6621442
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.log (formatted)
|
||||
# key: clo
|
||||
# group: console
|
||||
# --
|
||||
|
||||
console.log('${1:object}', ${1:object})
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 9dd0d1c8-f4e8-4d16-8ca1-4ce72e7936cb
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.timeEnd
|
||||
# key: cte
|
||||
# group: console
|
||||
# --
|
||||
|
||||
console.timeEnd('${1:object}')
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 3d8fde97-df25-4515-a8e9-5096db21cfb7
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.warn
|
||||
# key: cwa
|
||||
# group: console
|
||||
# --
|
||||
|
||||
console.warn(${1:object})
|
|
@ -1,6 +1,5 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: const declaration
|
||||
# key: const
|
||||
# group: es6
|
||||
# --
|
||||
const ${1:name} = ${2:initial};
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 1867e4d6-1042-422e-b114-174969b9325e
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: destructingArray
|
||||
# key: dar
|
||||
# --
|
||||
|
||||
const [${1:propertyName}] = ${2:arrayToDestruct}
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 0a552742-2fa3-4d23-8fe6-fe7f211b642a
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: destructingObject
|
||||
# key: dob
|
||||
# --
|
||||
|
||||
const {${1:propertyName}} = ${2:objectToDestruct}
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 45f3a8b4-7ed0-4d80-aa77-1cf79339b6b6
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: exportDefaultFunction
|
||||
# key: edf
|
||||
# --
|
||||
|
||||
export default (${1:params}) => {
|
||||
$0
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 095f24bf-5c76-4d0b-862e-a1f0ab1e1b95
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: exportNamedFunction
|
||||
# key: enf
|
||||
# --
|
||||
|
||||
export const ${1:functionName} = (${2:params}) => {
|
||||
$0
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: addEvent
|
||||
# --
|
||||
addEvent('${1:event}', function($2) {
|
||||
$0
|
||||
});
|
|
@ -1,4 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: fireEvent
|
||||
# --
|
||||
fireEvent('$0')
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 1391f808-8044-4878-b551-9f129330507c
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: exportAs
|
||||
# key: exa
|
||||
# --
|
||||
|
||||
export { ${2:originalName} as ${3:alias} } from '${1:module}'$0
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: b9a77d53-af00-4acc-90e5-0259edef0326
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: exportDestructing
|
||||
# key: exd
|
||||
# --
|
||||
|
||||
export { $2 } from '${1:module}'$0
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 19643fe0-3063-41cd-b384-9f0a51b2f809
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: exportDefault
|
||||
# key: exp
|
||||
# --
|
||||
|
||||
export default $1$0
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: export
|
||||
# key: exp
|
||||
# group: es6
|
||||
# --
|
||||
export${1: default} $0;
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 8d343f0b-28ae-4e2c-84a4-2e557603f28b
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: forIn
|
||||
# key: fin
|
||||
# --
|
||||
|
||||
for(let ${1:item} in ${2:object}) {
|
||||
${0}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: eec73b34-fb19-4d4c-b4fd-853b2eca6f19
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: forOf
|
||||
# key: fof
|
||||
# --
|
||||
|
||||
for(let ${1:item} of ${2:object}) {
|
||||
${0}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: a59f3383-a176-4f60-a992-0d2b983eaa5c
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: forEach
|
||||
# key: fre
|
||||
# --
|
||||
|
||||
${1:array}.forEach(${2:currentItem} => {
|
||||
${0}
|
||||
})
|
|
@ -1,8 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: getter
|
||||
# key: get
|
||||
# group: es6
|
||||
# --
|
||||
get ${1:prop}() {
|
||||
return $0;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 7c3ddd59-68e7-456c-a906-4241cdaeaf9e
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: importAs
|
||||
# key: ima
|
||||
# --
|
||||
|
||||
import { ${2:originalName} as ${3:alias} } from '${1:module}'$0
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 851254b3-d70e-4024-a557-2629d3d73507
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: importDestructing
|
||||
# key: imd
|
||||
# --
|
||||
|
||||
import { $2 } from '${1:module}'$0
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 13efbfa8-12d3-4570-9602-6d64717d75e3
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: importEverything
|
||||
# key: ime
|
||||
# --
|
||||
|
||||
import * as ${2:alias} from '${1:module}'$0
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 39b0065c-1dd5-4214-a612-1fead18dd677
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: importNoModuleName
|
||||
# key: imn
|
||||
# --
|
||||
|
||||
import '${1:module}'$0
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: fb07fe1d-4cf7-47e9-bca8-51a6438c5d6f
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import
|
||||
# key: imp
|
||||
# --
|
||||
|
||||
import ${2:moduleName} from '${1:module}'$0
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: import
|
||||
# key: imp
|
||||
# group: es6
|
||||
# --
|
||||
import ${1:defaultMember}${2:, { ${3:member} }} from '${4:module}';
|
|
@ -1,6 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: import member
|
||||
# key: imm
|
||||
# group: es6
|
||||
# --
|
||||
import { ${1:member1}, ${2:member2} } from '${3:module}';
|
|
@ -1,7 +1,8 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: Constructor
|
||||
# name: constructor
|
||||
# key: init
|
||||
# --
|
||||
initialize: function($1) {
|
||||
constructor(${1:arg}) {
|
||||
${2:super(${3:arg});}
|
||||
$0
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: init-es6
|
||||
# key: init
|
||||
# group: es6
|
||||
# --
|
||||
constructor(${1:arg}) {
|
||||
${2:super(${3:arg});}
|
||||
$0
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: let declaration
|
||||
# key: let
|
||||
# group: es6
|
||||
# --
|
||||
let ${1:name} = ${2:initial};
|
|
@ -1,4 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: console.log
|
||||
# --
|
||||
console.log($0);
|
|
@ -1,7 +1,6 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: method
|
||||
# key: met
|
||||
# group: es6
|
||||
# --
|
||||
${1:name}(${2:arg}) {
|
||||
$0
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: b8f2656b-94d0-40fc-baf2-d335073ecd54
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: bound method
|
||||
# key: metb
|
||||
# --
|
||||
|
||||
${1:methodName} = (${2:params}) => {
|
||||
${0}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 4650c619-bbd9-4496-955a-1d626fdf8bcb
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: namedFunction
|
||||
# key: nfn
|
||||
# --
|
||||
|
||||
const ${1:name} = (${2:params}) => {
|
||||
${3}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 4d26710e-cad0-4584-8099-87403d4c43cb
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propertyGet
|
||||
# key: pge
|
||||
# --
|
||||
|
||||
get ${1:propertyName}() {
|
||||
return this.${0}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 1f2ca8a4-dda2-4b88-9377-23ec10760aec
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: promise
|
||||
# key: prom
|
||||
# --
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
${1}
|
||||
})
|
|
@ -1,8 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: Promise
|
||||
# key: prom
|
||||
# group: es6
|
||||
# --
|
||||
new Promise((resolve, reject) => {
|
||||
$0
|
||||
});
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: b33dbf56-f2ad-489e-bc7b-1b4c2d1657ea
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: propertyset
|
||||
# key: pse
|
||||
# --
|
||||
|
||||
set ${1:propertyName}(${2:value}) {
|
||||
${0}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: html
|
||||
# --
|
||||
new Request.HTML({
|
||||
onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) {
|
||||
$0
|
||||
}
|
||||
}).${1:get}(${2:url});
|
|
@ -1,8 +0,0 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: json
|
||||
# --
|
||||
new Request.JSON({
|
||||
onSuccess: function(responseJSON, responseText) {
|
||||
$0
|
||||
}
|
||||
}).${1:send}(${2:url});
|
|
@ -1,8 +0,0 @@
|
|||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: setter
|
||||
# key: set
|
||||
# group: es6
|
||||
# --
|
||||
set ${1:prop}(${2:value}) {
|
||||
$0
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 596c0e05-ee02-4d02-85e0-64252296629d
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: setInterval
|
||||
# key: sti
|
||||
# --
|
||||
|
||||
setInterval(() => {
|
||||
${2}
|
||||
}, ${0:intervalInms})
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 6ead1d1a-bf84-4a3d-94fb-59ad97d55414
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: setTimeOut
|
||||
# key: sto
|
||||
# --
|
||||
|
||||
setTimeout(() => {
|
||||
${2}
|
||||
}, ${1:delayInms})
|
|
@ -0,0 +1,2 @@
|
|||
js-mode
|
||||
js2-mode
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: ac6e22b0-886b-4a09-861b-c759bfb8fcbe
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: exportGraphQL
|
||||
# key: expgql
|
||||
# --
|
||||
|
||||
export default compose(
|
||||
graphql(${1:queryOrMutation}, { name: ${2:name} }),
|
||||
)(${1:${TM_FILENAME_BASE}})
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 1a3750bd-8108-40f5-92b4-f0730272815c
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: graphQLForComponent
|
||||
# key: graphql
|
||||
# --
|
||||
|
||||
import { compose, graphql } from 'react-apollo'
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: edfbca80-e069-46cd-a034-b1523e57c4a4
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: describeBlock
|
||||
# key: desc
|
||||
# --
|
||||
|
||||
describe('$1', () => {
|
||||
$0
|
||||
})
|
|
@ -0,0 +1,27 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: de59c777-b0cb-40b1-903a-a006987fef2e
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: setupReactNativeTestWithRedux
|
||||
# key: snrtest
|
||||
# --
|
||||
|
||||
import 'react-native'
|
||||
import React from 'react'
|
||||
import renderer from 'react-test-renderer'
|
||||
import { Provider } from 'react-redux'
|
||||
|
||||
import store from 'src/store'
|
||||
import ${1:${TM_FILENAME_BASE}} from '../${1:${TM_FILENAME_BASE}}'
|
||||
|
||||
describe('<${1:${TM_FILENAME_BASE}} />', () => {
|
||||
const defaultProps = {}
|
||||
const wrapper = renderer.create(
|
||||
<Provider store={store}>
|
||||
<${1:${TM_FILENAME_BASE}} {...defaultProps} />
|
||||
</Provider>,
|
||||
)
|
||||
|
||||
test('render', () => {
|
||||
expect(wrapper).toMatchSnapshot()
|
||||
})
|
||||
})
|
|
@ -0,0 +1,21 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: fae867ad-ec86-4eff-bb90-a9bb07040eb7
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: setupReactNativeTest
|
||||
# key: sntest
|
||||
# --
|
||||
|
||||
import 'react-native'
|
||||
import React from 'react'
|
||||
import renderer from 'react-test-renderer'
|
||||
|
||||
import ${1:${TM_FILENAME_BASE}} from '../${1:${TM_FILENAME_BASE}}'
|
||||
|
||||
describe('<${1:${TM_FILENAME_BASE}} />', () => {
|
||||
const defaultProps = {}
|
||||
const wrapper = renderer.create(<${1:${TM_FILENAME_BASE}} {...defaultProps} />)
|
||||
|
||||
test('render', () => {
|
||||
expect(wrapper).toMatchSnapshot()
|
||||
})
|
||||
})
|
|
@ -0,0 +1,26 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 168f89c0-3e0b-4868-b090-50f6fc79d074
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: setupReactComponentTestWithRedux
|
||||
# key: srtest
|
||||
# --
|
||||
|
||||
import React from 'react'
|
||||
import renderer from 'react-test-renderer'
|
||||
import { Provider } from 'react-redux'
|
||||
|
||||
import store from 'src/store'
|
||||
import { ${1:${TM_FILENAME_BASE}} } from '../${1:${TM_FILENAME_BASE}}'
|
||||
|
||||
describe('<${1:${TM_FILENAME_BASE}} />', () => {
|
||||
const defaultProps = {}
|
||||
const wrapper = renderer.create(
|
||||
<Provider store={store}>
|
||||
<${1:${TM_FILENAME_BASE}} {...defaultProps} />
|
||||
</Provider>,
|
||||
)
|
||||
|
||||
test('render', () => {
|
||||
expect(wrapper).toMatchSnapshot()
|
||||
})
|
||||
})
|
|
@ -0,0 +1,20 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: ddc5cfd4-640f-4fb3-9f85-667de1e4a345
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: setupTest
|
||||
# key: stest
|
||||
# --
|
||||
|
||||
import React from 'react'
|
||||
import renderer from 'react-test-renderer'
|
||||
|
||||
import { ${1:${TM_FILENAME_BASE}} } from '../${1:${TM_FILENAME_BASE}}'
|
||||
|
||||
describe('<${1:${TM_FILENAME_BASE}} />', () => {
|
||||
const defaultProps = {}
|
||||
const wrapper = renderer.create(<${1:${TM_FILENAME_BASE}} {...defaultProps} />)
|
||||
|
||||
test('render', () => {
|
||||
expect(wrapper).toMatchSnapshot()
|
||||
})
|
||||
})
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 190f78b4-17ec-429e-aaf1-3231726ca580
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: testBlock
|
||||
# key: test
|
||||
# --
|
||||
|
||||
test('should $1', () => {
|
||||
$0
|
||||
})
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 96dcd16f-ee34-4832-8637-6610819df6ba
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: itBlock
|
||||
# key: tit
|
||||
# --
|
||||
|
||||
it('should $1', () => {
|
||||
$0
|
||||
})
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 1eff0de2-eeb3-457f-b935-7a733a03d378
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactNativeImport
|
||||
# key: imrn
|
||||
# --
|
||||
|
||||
import { ${1:moduleName} } from 'react-native'
|
|
@ -0,0 +1,19 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: c4aa3b3e-82af-434b-acc5-b08bf018e0aa
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactNativeComponent
|
||||
# key: rnc
|
||||
# --
|
||||
|
||||
import React, { Component } from 'react'
|
||||
import { Text, View } from 'react-native'
|
||||
|
||||
export default class ${1:${TM_FILENAME_BASE}} extends Component {
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<Text> ${2:textInComponent} </Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 27262af6-b8a7-4165-bbfb-815f62eb3d4f
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactNativeComponentExport
|
||||
# key: rnce
|
||||
# --
|
||||
|
||||
import React, { Component } from 'react'
|
||||
import { Text, View } from 'react-native'
|
||||
|
||||
export class ${1:${TM_FILENAME_BASE}} extends Component {
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<Text> ${2:textInComponent} </Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default ${1:${TM_FILENAME_BASE}}
|
|
@ -0,0 +1,21 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 6a9c7016-01b0-4c5c-84d6-28a688d81a4b
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactNativeComponentWithStyles
|
||||
# key: rncs
|
||||
# --
|
||||
|
||||
import React, { Component } from 'react'
|
||||
import { Text, StyleSheet, View } from 'react-native'
|
||||
|
||||
export default class ${1:${TM_FILENAME_BASE}} extends Component {
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<Text> ${2:textInComponent} </Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({})
|
|
@ -0,0 +1,19 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: d30232be-9660-4736-9fdc-4e50559db3d1
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactNativePureComponent
|
||||
# key: rnpc
|
||||
# --
|
||||
|
||||
import React, { PureComponent } from 'react'
|
||||
import { Text, View } from 'react-native'
|
||||
|
||||
export default class ${1:${TM_FILENAME_BASE}} extends PureComponent {
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<Text> ${2:textInComponent} </Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: b36666f2-3ac6-4ee7-9f17-b32d82705306
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactNativePureComponentExport
|
||||
# key: rnpce
|
||||
# --
|
||||
|
||||
import React, { PureComponent } from 'react'
|
||||
import { Text, View } from 'react-native'
|
||||
|
||||
export class ${1:${TM_FILENAME_BASE}} extends PureComponent {
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<Text> ${2:textInComponent} </Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default ${1:${TM_FILENAME_BASE}}
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 0b1a0e2b-5577-4a15-bbbb-d573376c8587
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: reactNativeStyles
|
||||
# key: rnstyle
|
||||
# --
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
${1:style}
|
||||
})
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: fed15504-4984-4bd8-a6d6-b1f34bccc721
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: componentDidMount
|
||||
# key: cdm
|
||||
# --
|
||||
|
||||
componentDidMount = () => {
|
||||
$0
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: a283c221-42f9-46f9-abaf-f41ef7f5812c
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: componentDidUpdate
|
||||
# key: cdup
|
||||
# --
|
||||
|
||||
componentDidUpdate = (prevProps, prevState) => {
|
||||
$0
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: dcd12a23-82f9-4779-8847-1ff9a7fdaecc
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: destructProps
|
||||
# key: cp
|
||||
# --
|
||||
|
||||
const { $1 } = this.props
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 137d875c-953c-4180-bda6-0522b99af83a
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: createRef
|
||||
# key: cref
|
||||
# --
|
||||
|
||||
this.${1:refName}Ref = React.createRef()
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 091603e8-70cf-42fa-89c0-4fb046aea976
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: destructState
|
||||
# key: cs
|
||||
# --
|
||||
|
||||
const { $1 } = this.state
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: dba0d644-e837-40ad-8082-bbe583fa444f
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: componentWillMount
|
||||
# key: cwm
|
||||
# --
|
||||
|
||||
componentWillMount = () => {
|
||||
$0
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 59e0e0d0-6efb-475f-a482-3d76f2f561a0
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: componentWillReceiveProps
|
||||
# key: cwr
|
||||
# --
|
||||
|
||||
componentWillReceiveProps = (nextProps) => {
|
||||
$0
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: f9e81a1f-356b-482d-9795-fc58fe00432d
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: componentWillUnmount
|
||||
# key: cwun
|
||||
# --
|
||||
|
||||
componentWillUnmount = () => {
|
||||
$0
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: cd9a8917-1ad1-4de8-a382-cdf0c2e72943
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: componentWillUpdate
|
||||
# key: cwup
|
||||
# --
|
||||
|
||||
componentWillUpdate = (nextProps, nextState) => {
|
||||
$0
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: d1b4eeda-bb83-4aa0-ba21-d0d89671947f
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: emptyState
|
||||
# key: est
|
||||
# --
|
||||
|
||||
state = {
|
||||
$1
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 77cf7d01-d7db-40c5-856f-4fbd79a3f1d7
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: forwardRef
|
||||
# key: fref
|
||||
# --
|
||||
|
||||
const ref = React.createRef()
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 3eeec841-9d3b-4e5c-93af-f478ffacc3f1
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: getDerivedStateFromProps
|
||||
# key: gdsfp
|
||||
# --
|
||||
|
||||
static getDerivedStateFromProps(props, state) {
|
||||
${1}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 6a682f76-d7e3-4983-bf11-735fa7143113
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: getSnapshotBeforeUpdate
|
||||
# key: gsbu
|
||||
# --
|
||||
|
||||
getSnapshotBeforeUpdate = (prevProps, prevState) => {
|
||||
$0
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 0fccd0f9-2e0c-46e3-88e4-699b6adb680e
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: hocComponent
|
||||
# key: hoc
|
||||
# --
|
||||
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
export default (WrappedComponent) => {
|
||||
const hocComponent = ({ ...props }) => <WrappedComponent {...props} />
|
||||
|
||||
hocComponent.propTypes = {
|
||||
}
|
||||
|
||||
return hocComponent
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 33c4817a-b813-4326-8c37-383a6b731f0a
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import PropTypes
|
||||
# key: impt
|
||||
# --
|
||||
|
||||
import PropTypes from 'prop-types'
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: eab40eaf-3ddc-4994-9618-d575a82393fb
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import React
|
||||
# key: imr
|
||||
# --
|
||||
|
||||
import React from 'react'
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 2e166e7c-41e6-4fb3-a6f5-2c1d9b1dacc2
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import React, { Component }
|
||||
# key: imrc
|
||||
# --
|
||||
|
||||
import React, { Component } from 'react'
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 93c2e805-e6f9-4fc1-b664-3fd35d288574
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import React, { Component } & PropTypes
|
||||
# key: imrcp
|
||||
# --
|
||||
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 733c4c97-18be-443d-a929-5a562dacf02b
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import ReactDOM
|
||||
# key: imrd
|
||||
# --
|
||||
|
||||
import ReactDOM from 'react-dom'
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 5c0b476d-98e2-4696-abe2-fadd659dc136
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import React, { memo }
|
||||
# key: imrm
|
||||
# --
|
||||
|
||||
import React, { memo } from 'react'
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: c226a4f1-847a-4fe5-acb4-01489ff3883f
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import React, { memo } & PropTypes
|
||||
# key: imrmp
|
||||
# --
|
||||
|
||||
import React, { memo } from 'react'
|
||||
import PropTypes from 'prop-types'
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: b3a74dbd-aecf-4a5d-b2ae-5181ece57838
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import React, { PureComponent }
|
||||
# key: imrpc
|
||||
# --
|
||||
|
||||
import React, { PureComponent } from 'react'
|
|
@ -0,0 +1,9 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: b3d7bbf4-ad54-43c2-84d6-12448dc9f00b
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import React, { PureComponent } & PropTypes
|
||||
# key: imrpcp
|
||||
# --
|
||||
|
||||
import React, { PureComponent } from 'react'
|
||||
import PropTypes from 'prop-types'
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: 7dfa38c5-1e83-4c4f-b9bb-eaa17fbaba58
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: import React Router
|
||||
# key: imrr
|
||||
# --
|
||||
|
||||
import { BrowserRouter as Router, Route, Link } from 'react-router-dom'
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# uuid: ffd28ce2-1575-4e26-9e12-65c23d3f9ca2
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: componentProps
|
||||
# key: props
|
||||
# --
|
||||
|
||||
this.props.$0
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue