Skip to content

Instantly share code, notes, and snippets.

@jpellizzari
Last active May 15, 2016 17:10
Show Gist options
  • Save jpellizzari/7e51947acd50e2d09e6b9be6b988ca60 to your computer and use it in GitHub Desktop.
Save jpellizzari/7e51947acd50e2d09e6b9be6b988ca60 to your computer and use it in GitHub Desktop.
Mocha and React shortcuts for Atom
# 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'
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it here:
# https://github.com/bevry/cson#what-is-cson
".source.js":
"describe":
prefix: "desc"
body: """
describe('${1:description}', function () {
let ${2:/* variables */}
beforeEach((done) => {
${3}
});
${4}
});
"""
"it":
prefix: "it"
body: """
it('${1:description}', (done) => {
${2}
});
"""
"sfc":
prefix: "sfc"
body: """
module.exports = function (){
const ${1:Name} = ({${2:/* props */}}) => {
return (
<div>
${3}
</div>
);
};
${1:Name}.displayName = '${1:Name}';
${1:Name}.propTypes = {
${4:/* propTypes */}
};
return ${1:Name};
};
"""
"react":
prefix: "react"
body: """
module.exports = function (){
return React.createClass({
displayName: '${1:Name}',
propTypes: {
${2:/* propTypes */}
},
render: function (){
return (
<div>
${3}
</div>
);
}
});
};
"""
"propType":
prefix: "prop"
body: "React.PropTypes.${1}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment