Skip to content

Instantly share code, notes, and snippets.

View eddyerburgh's full-sized avatar

Edward Wardell-Yerburgh eddyerburgh

View GitHub Profile
@eddyerburgh
eddyerburgh / .eslintrc
Created September 27, 2018 18:49
Eslint prettier and standard config
{
"root": true,
"extends": [
"plugin:vue/recommended",
"standard",
"prettier",
"prettier/standard"
]
}
@eddyerburgh
eddyerburgh / eslint.js
Created September 27, 2018 18:28
inconsistent formatting with airbnb eslint
foo({
num: 3,
}, 1);
foo({ num: 3 },
1);
foo(
import { shallow } from '@vue/test-utils'
describe('', () => {
test('', () => {
})
})
// inline conditional rendering
const Page = () => (
<Modal>
{ showModalHeader && (
<ModalHeader />
)}
{ showModalMessage && (
<showModalMessage />
)}
var elements = document.querySelectorAll('link[rel=stylesheet]');
for(var i=0;i<elements.length;i++){
elements[i].parentNode.removeChild(elements[i]);
}
const link = document.createElement('link')
link.rel='stylesheet'
link.href="https://cdnjs.cloudflare.com/ajax/libs/milligram/1.3.0/milligram.css"
document.body.append(link)
document.body.style.maxWidth = '700px'
document.body.style.margin = '0 auto'
import test from 'tape'
import { shallow } from '@vue/test-utils'
import MessageToggle from '../../src/components/MessageToggle'
test('MessageToggle.vue renders default message', t => {
t.plan(1)
const wrapper = shallow(MessageToggle)
t.equal(wrapper.find('p').text(), 'default message', 'has a default message')
})
import test from 'tape'
import { shallow } from '@vue/test-utils'
import List from '../../src/components/List'
test('List.vue renders a <li> for each item in props.items', t => {
t.plan(1)
const items = ['', '']
const wrapper = shallow(List, {
propsData: { items }
})
import test from 'tape'
import { shallow } from '@vue/test-utils'
import List from '../../src/components/List.vue'
test('List.vue renders', t => {
t.plan(1)
const wrapper = shallow(List)
t.equal(typeof wrapper, 'object')
})
const hooks = require('require-extension-hooks')
// Setup browser environment
require('browser-env')()
// Setup vue files to be processed by `require-extension-hooks-vue`
hooks('vue').plugin('vue').push()
// Setup vue and js files to be processed by `require-extension-hooks-babel`
hooks(['vue', 'js']).plugin('babel').push()
import { shallow } from '@vue/test-utils'
import { createRenderer } from 'vue-server-renderer'
import List from '@/components/List.vue'
describe('List.vue', () => {
it('renders li for each item in props.items', () => {
const items = ['', '']
const wrapper = shallow(List, {
propsData: { items }
})