import { expect } from 'chai' ; import Vue from 'vue' ; import { Component } from '../../../dist/index' ; describe ( 'methods' , ( ) => { it ( 'should be able to binding primitive method' , done => { @ Component ( { template : '<div><div id="text">{{text}}</div><button id="btn" v-on:click="greet">Greet</button></div>' } ) class Foo { text : string ; constructor ( ) { this . text = 'foo' ; } greet ( ) { this . text = 'hello foo!' ; } } const vm = new Foo ( ) [ '$mount' ] ( ) ; expect ( vm [ '$el' ] . querySelector ( '#text' ) . textContent ) . to . contain ( 'foo' ) ; vm [ '$el' ] . querySelector ( '#btn' ) . click ( ) ; Vue . nextTick ( ( ) => { expect ( vm [ '$el' ] . querySelector ( '#text' ) . textContent ) . to . contain ( 'hello foo!' ) ; done ( ) ; } ) ; } ) ; } ) ;