Advertisement
Guest User

Untitled

a guest
Jun 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Your snippets
  2. #
  3. # Atom snippets allow you to enter a simple prefix in the editor and hit tab to
  4. # expand the prefix into a larger code block with templated values.
  5. #
  6. # You can create a new snippet in this file by typing "snip" and then hitting
  7. # tab.
  8. #
  9. # An example CoffeeScript snippet to expand log to console.log:
  10. #
  11. # '.source.coffee':
  12. #   'Console log':
  13. #     'prefix': 'log'
  14. #     'body': 'console.log $1'
  15. #
  16. # Each scope (e.g. '.source.coffee' above) can only be declared once.
  17. #
  18. # This file uses CoffeeScript Object Notation (CSON).
  19. # If you are unfamiliar with CSON, you can read more about it in the
  20. # Atom Flight Manual:
  21. # http://flight-manual.atom.io/using-atom/sections/basic-customization/#_cson
  22. '.source.js':
  23.   'disable eslint':
  24.     "prefix": "esd"
  25.     "body": "/* eslint-disable */"
  26.   'enable eslint':
  27.     'prefix': 'ese'
  28.     'body': '/* eslint-enable */'
  29.   'disable one line eslint':
  30.     'prefix': 'esl'
  31.     'body': '// eslint-disable-line'
  32.   'setTimeout function':
  33.     "prefix": "timeout"
  34.     "body": """
  35.    setTimeout(() => {
  36.      ${2}
  37.    }, ${1:1000});
  38.    """
  39.   'new Promise':
  40.     "prefix": "prom"
  41.     "body": """
  42.    new Promise((resolve, reject) => ${1});
  43.    """
  44.   'React container':
  45.     'prefix': 'rco'
  46.     'body': """
  47.    import React, { Component } from 'react';
  48.    import PropTypes from 'prop-types';
  49.    import styled from 'styled-components';
  50.    import { connect } from 'react-redux';
  51.  
  52.    class ${1:MyContainer} extends Component {
  53.  
  54.      static propTypes = {}
  55.  
  56.      render() {
  57.        return (
  58.          <div>
  59.            <p>${1:MyContainer} screen</p>
  60.          </div>
  61.        );
  62.      }
  63.    }
  64.  
  65.    const mapStateToProps = (state) => {
  66.      return {
  67.  
  68.      };
  69.    };
  70.  
  71.    const mapDispatchToProps = (dispatch) => {
  72.      return {
  73.  
  74.      };
  75.    };
  76.  
  77.    export default connect(mapStateToProps, mapDispatchToProps)(${1:MyContainer});
  78.    """
  79.   'React PureComponent':
  80.     'prefix': 'rpc'
  81.     'body': """
  82.    import React, { PureComponent } from 'react';
  83.    import PropTypes from 'prop-types';
  84.    import styled from 'styled-components';
  85.  
  86.    export default class ${1:MyContainer} extends PureComponent {
  87.  
  88.      static propTypes = {}
  89.  
  90.      render() {
  91.        return (
  92.          <div>
  93.            ${1:MyContainer} component
  94.          </div>
  95.        );
  96.      }
  97.    }
  98.    """
  99.   'Jest test':
  100.     'prefix': 'jts'
  101.     'body': """
  102.    import React from 'react';
  103.    import { shallow } from 'enzyme';
  104.    import 'jest-styled-components';
  105.  
  106.    import ${1:Component} from '.';
  107.  
  108.    const defaultProps = {};
  109.  
  110.    const setup = (props = defaultProps) => {
  111.      const wrapper = shallow(<${1:Component} {...defaultProps} {...props} />);
  112.  
  113.      return {
  114.        wrapper,
  115.      };
  116.    };
  117.  
  118.    describe('${1: Component} component', () => {
  119.      it('should match snapshot', () => {
  120.        const { wrapper } = setup();
  121.        expect(wrapper).toMatchSnapshot();
  122.      });
  123.    });
  124.    """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement