All Projects → codebryo → revue

codebryo / revue

Licence: other
Revue provides a helpful interface for testing Vue components

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to revue

Heyui
🎉UI Toolkit for Web, Vue2.0 http://www.heyui.top
Stars: ✭ 2,373 (+14731.25%)
Mutual labels:  vue-components
Web designer
网页设计器图形化工具,通过拖拽组件进行页面排版和生成页面代码
Stars: ✭ 219 (+1268.75%)
Mutual labels:  vue-components
Wdui
Mobile UI Components Library based on Vue 2.0 at Weidian
Stars: ✭ 244 (+1425%)
Mutual labels:  vue-components
Vue Json Edit
Visual JSON editor built as an vue component. Provides a basic GUI
Stars: ✭ 207 (+1193.75%)
Mutual labels:  vue-components
Vue Diagrams
Diagram component for vue.js, inspired by react-diagrams
Stars: ✭ 218 (+1262.5%)
Mutual labels:  vue-components
Vue Glide
A slider and carousel as vue component on top of the Glide.js
Stars: ✭ 225 (+1306.25%)
Mutual labels:  vue-components
Vue Rate
Rate component for Vue
Stars: ✭ 199 (+1143.75%)
Mutual labels:  vue-components
Vue Form Json Schema
Create forms using JSON schema. Bring your components!
Stars: ✭ 253 (+1481.25%)
Mutual labels:  vue-components
Vue Lazy Render
A vue component for lazy rending vue component
Stars: ✭ 219 (+1268.75%)
Mutual labels:  vue-components
Vue Tabs
Simplified bootstrap tabs
Stars: ✭ 241 (+1406.25%)
Mutual labels:  vue-components
Vue Nestable
A simple drag & drop hierarchical list made as a vue component.
Stars: ✭ 209 (+1206.25%)
Mutual labels:  vue-components
V Bar
The virtual responsive crossbrowser scrollbar component for VueJS 2x
Stars: ✭ 216 (+1250%)
Mutual labels:  vue-components
Vue Material Kit
Vue Material Kit - Open Source Material Design UI Kit
Stars: ✭ 231 (+1343.75%)
Mutual labels:  vue-components
Vuent
🎨 Vue.js components implementing Microsoft Fluent Design
Stars: ✭ 207 (+1193.75%)
Mutual labels:  vue-components
Vue Ui Framework
My personal collection of Vue UI framework
Stars: ✭ 245 (+1431.25%)
Mutual labels:  vue-components
Todo Vue
Code for YouTube series on building a Todo App in Vue.js
Stars: ✭ 199 (+1143.75%)
Mutual labels:  vue-components
Vuemmerce
👉 Responsive ecommerce template 🛒 built with Vue.js and Nuxt.js
Stars: ✭ 223 (+1293.75%)
Mutual labels:  vue-components
Element
A Vue.js 2.0 UI Toolkit for Web
Stars: ✭ 51,416 (+321250%)
Mutual labels:  vue-components
Vueonrails
💎 Rails gem with the power of Vue.js components
Stars: ✭ 250 (+1462.5%)
Mutual labels:  vue-components
Vue Signature Pad
🖋 Vue Signature Pad Component
Stars: ✭ 237 (+1381.25%)
Mutual labels:  vue-components

Revue

This Project is deprecated in favor of the official vue-test-utils

Approachable testing for Vue Components.

What's this?

Revue is a helper class that let's you access a Vue Component and provides a small API to interact with the reactive instance. Use it with the test system you like best.

Installation

Install through npm or yarn:

# with npm
$ npm install revue-testing

# with yarn
$ yarn add revue-testing

then you can require it in your file:

const Revue = require('revue-testing')

and up we go...

Getting Started

To get running with Revue you first need to instantiate it accordingly.

const Component = {

  props: ['secret'],

  data() {
    return {
      msg: 'Hello Revue!'
    }
  }
  ... // your Vue component
}

let rv = new Revue(Component)

You can also pass various things into the Vue instance. Let's start by passing in custom information leveraging Vue's propsData option. Assuming the component uses props it's easy as this:

let rv = new Revue(Component, { props: { secret: 'Revue is awesome' }})

That's pretty convenient right? Well how about aiming high already and leverage a store? (Currently only Vuex is supported)

const store = {
  state: {
    love: 1
  },

  mutations: {
    increment(state) {
      state.love++
    }
  }
}

let rv = new Revue(Component, { store })

Now your component can work with the store as expected. For convenience a $store accessor is provided for you.

The API

The $ instance

$ let's you interact with the instance itself and get or set data as known.

console.log(rv.$.msg) // 'Hello Revue!'
console.log(rv.$.secret) // 'Revue is awesome'

rv.$.msg = 'Interaction happening'

console.log(rv.$.msg) // 'Interaction happening!'

$html

This let's you get the current rendered markup of the instance as formatted HTML string. (Great for Snapshot testing)

Caveats: To stay pragmatic this is not solving the fact that Vue uses nextTick to reflect data changes on the markup.

rv.$html // Returns formatted HTML String

$tick If you need access to the HTML markup after some changes where applied the $tick function will be your friend. The passed callback function will allow to execute code after Vue's nextTick has been called.

rv.$.msg = 'New content'
console.log(rv.$html) // Not updated

rv.$tick(() => {
    console.log(rv.$html) // Now updated content
})

$store In case a store was injected into the component it can access through the $tick getter.

rv.$store.state.love // 1

// The same as

rv.$.$store.state.love // 1

WIP

  • Extend API to allow interactions (click buttons, etc.)
  • Allow injection of components
  • Extend Documentation
  • Example guide how to use with Jest
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].