import Vue from 'vue'
import VueRouter from 'vue-router'
import grid from 'src/components/grid'

describe('grid.vue', () => {
  it('should render contractor details', () => {
    Vue.use(VueRouter)
    const router = new VueRouter({routes: [
        {path: '/:slug', name: 'modal', component: {template: '<div>modal</div>'}},
    ]})
    const vm = new Vue({
      el: document.createElement('div'),
      router: router,
      render: (h) => h(grid),
      data: {
        contractors: [
          {
            name: 'Fred Bloggs',
            slug: 'fred-bloggs',
            img: 'http://path.com/to/img.jpg',
          }
        ]
      }
    })
    expect(vm.$el.querySelector('h3').textContent).to.equal('Fred Bloggs')
    expect(vm.$el.querySelector('a').attributes['href'].value).to.equal('#/fred-bloggs')
    expect(vm.$el.querySelector('img').attributes['src'].value).to.equal('http://path.com/to/img.jpg')
  })
})

@@ -485,33 +485,101 @@
 s: %5B
+%5D
 %0A      
+%7D,%0A
     
-%7B%0A            
+  methods: %7B%0A        get_data: function () %7B%0A          this.contractors.push(%7B
 name
@@ -594,28 +594,16 @@
 Bloggs',
-%0A           
  slug: '
@@ -619,20 +619,8 @@
 gs',
-%0A           
  img
@@ -653,21 +653,10 @@
 jpg'
-,%0A          
 %7D
+)
 %0A   
@@ -660,17 +660,17 @@
         
-%5D
+%7D
 %0A      %7D

correct test to work with get_data