Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data() returns empty object #175

Open
hosein2398 opened this issue Feb 17, 2018 · 2 comments
Open

data() returns empty object #175

hosein2398 opened this issue Feb 17, 2018 · 2 comments

Comments

@hosein2398
Copy link

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 hosein2398 changed the title data() return empty object data() returns empty object Feb 17, 2018
@eddyerburgh
Copy link
Owner

eddyerburgh commented Feb 18, 2018

Thanks for the bug report.

What Vue version are you using?

@hosein2398
Copy link
Author

I'm using

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants