avoriaz icon indicating copy to clipboard operation
avoriaz copied to clipboard

data() returns empty object

Open hosein2398 opened this issue 6 years ago • 2 comments

Hey, I'm using Avoriaz with AVA and I've written some tests so far. In one test I'm trying to get data() of a component but it returns empty object. data of my component :

data() {
      return {
        defaultStyle: 'transition: ' + this.timer + 's;',
        currentWord: this.data[0],
        liStl: null,
        dataCounter: 0,
        displayState: "shown",
        filters: {
          'simple': ["opacity:0", "opacity:1"],
          'bottom-top': ["transform:translateY(10px);opacity:0;", "transform:translateY(0px);opacity:1;"],
          'top-bottom': ["transform:translateY(-10px);opacity:0;", "transform:translateY(0px);opacity:1;"],
          'right-left': ["transform:translateX(10px);opacity:0;", "transform:translateX(0px);opacity:1;"],
          'left-right': ["transform:translateX(-10px);opacity:0;", "transform:translateX(0px);opacity:1;"],
          'press': ["letter-spacing: 4px;opacity:0;", "opacity:1;"],
          'scale': ["transform:scaleY(1.4);opacity:0;", "opacity:1;"],
          'flash': ["transform:skewX(-70deg);opacity:0;", "transform:skewX(0deg);opacity:1;"],
          'flip': ["transform:rotateX(-180deg);opacity:0;", "transform:rotate(0deg);opacity:1;"],
        }
      }
    },

and this.data[0] is prop if you wonder. And here is test:

test('Checks existence some of data', (t) => {
  t.plan(2);
  const datas =  wrapper.data();
  t.is(datas.dataCounter , 0);
  t.is(datas.displayState , 'shown');
});

hosein2398 avatar Feb 17 '18 17:02 hosein2398

Thanks for the bug report.

What Vue version are you using?

eddyerburgh avatar Feb 18 '18 07:02 eddyerburgh

I'm using

"vue": "^2.5.11"
"ava": "^0.25.0"
"avoriaz": "^6.3.0"

hosein2398 avatar Feb 18 '18 13:02 hosein2398