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

test-support styles causes component tests to fail #521

Open
nightire opened this issue Jul 16, 2019 · 1 comment
Open

test-support styles causes component tests to fail #521

nightire opened this issue Jul 16, 2019 · 1 comment

Comments

@nightire
Copy link

nightire commented Jul 16, 2019

I have a component needs to get the parent element's height and width during its didInsertElement phase, so I set up a test case renders a template snippet:

await render(hbs`
  <div {{style width="400px" height="300px"}}>
    <MyComponent />
  </div>
`);

then I got a weird result like below:

image

As we saw in this screenshot, the wrapper element renders only half of width and height compares to its styles, it causes the test to fail even its implementation is actually correct.

I found the root cause is the default styles in:

width: 200%;
height: 200%;
transform: scale(0.5);

but I'm not confident to remove it at all. I use this temporary solution currently:

await render(hbs`
  // reset styles only for this test case:
  <style>
    #ember-testing { width: initial; height: initial; transform: initial; }
  </style>

  <div {{style width="400px" height="300px"}}>
    <MyComponent />
  </div>
`);
@rohitpaulk
Copy link
Contributor

Related to #595 (comment).

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