This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { shallow } from 'vue-test-utils' | |
| import CreatePostLayout from './CreatePostLayout' | |
| describe('CreatePostLayout', () => { | |
| const stub = tag => `<div id=${tag} />` | |
| it('emits a submit event when submitted', () => { | |
| const wrapper = shallow(CreatePostLayout) | |
| wrapper.find('form').trigger('submit.prevent') | |
| expect(wrapper.emitted().submit).toHaveLength(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div> | |
| <CreatePostLayout @submit="handleCreatePost"> | |
| <CreateDescription | |
| slot="description" | |
| v-model="content" | |
| /> | |
| <SubmitButton | |
| slot="submit" | |
| :submitted="submitted" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { shallow } from 'vue-test-utils' | |
| import CreatePostContainer from './CreatePostContainer' | |
| describe('CreatePostContainer', () => { | |
| const stub = tag => `<div id=${tag} />` | |
| const factory = (methods = {}) => { | |
| return shallow(CreatePostContainer, { | |
| methods, | |
| stubs: { | |
| CreatePostLayout: stub('layout') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div> | |
| <CreatePostLayout @submit="handleCreatePost"> | |
| <CreateDescription | |
| slot="description" | |
| v-model="content" | |
| /> | |
| <SubmitButton | |
| slot="submit" | |
| :submitted="submitted" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Vue from 'vue' | |
| const EvtBus = new Vue() | |
| EvtBus.addEvent = (evt, fn) => { | |
| EvtBus.$on(evt, () => { | |
| fn() | |
| }) | |
| } | |
| export { EvtBus } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| initDoc = -> | |
| editor = document.getElementById('editor') | |
| defText = editor.innerHTML | |
| setDocMode() if document.compForm.switchMode.checked | |
| window.editor = editor | |
| formatDoc = (cmd, val) -> | |
| document.execCommand(cmd, false, val) | |
| editor.focus() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title></title> | |
| </head> | |
| <script src="index.js"></script> | |
| <body> | |
| <textarea id="source" name="" cols="30" rows="10"> | |
| p().then(res => console.log('res', res)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const qs = el => document.querySelector(el) | |
| const evt = (el, evtType, cb) => el.addEventListener(evtType, cb) | |
| const val = el => qs(el).value.trim() | |
| const greet = () => console.log('greet') | |
| // const p = () => new Promise(res => res('ok')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import { | |
| AppRegistry, | |
| Text, | |
| View, | |
| StyleSheet | |
| } from 'react-vr'; | |
| const styles = StyleSheet.create({ | |
| view: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ... imports and stylesheet | |
| export default class Events extends React.Component { | |
| constructor() { | |
| super() | |
| this.state = { count: 0 } | |
| } | |
| render() { |