Skip to content

Conversation

@fivetanley
Copy link
Member

@fivetanley fivetanley commented Jun 19, 2016

Before, the test rendered the following:

<div data-foo="{{if cond1 "T1" "F1"}}"></div>
<div data-foo="{{if cond2 "T2" "F2"}}"></div>

The test was only asserting against the value of the data-foo of the
first div, causing it fo fail because it was missing the value of the
data-foo in the second div.

This is because the test was using wrappedTemplateFor, which
is a convenience method which only expects one template to be
rendered at a time.

Instead, we use wrapperFor and two templateFor calls to instead
create only one div and assert against it. What's rendered in the test
now looks like:

<div data-foo="{{if cond1 "T1" "F1"}}{{if cond2 "T2" "F2"}}"></div>

refs #13644

Before, the test rendered the following:

```handlebars
<div data-foo="{{if cond1 \"T1\" \"F1\"}}"></div>
<div data-foo="{{if cond2 \"T2\" \"F2\"}}"></div>
```

The test was only asserting against the value of the `data-foo` of the
first div, causing it fo fail because it was missing the value of the
`data-foo` in the second div.

This is because the test was using `wrappedTemplateFor`, which
is a convenience method which only expects *one* template to be
rendered at a time.

Instead, we use `wrapperFor` and two `templateFor` calls to instead
create only *one* div and assert against it. What's rendered in the test
now looks like:

```handlebars
<div data-foo="{{if cond1 \"T1\" \"F1\"}}{{if cond2 \"T2\" \"F2\"}}"></div>
```

refs emberjs#13644
@rwjblue rwjblue merged commit 5b446c4 into emberjs:master Jun 19, 2016
@rwjblue rwjblue deleted the unbound-test-fix branch June 19, 2016 18:45
@rwjblue
Copy link
Member

rwjblue commented Jun 19, 2016

Thanks @fivetanley!

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

Successfully merging this pull request may close these issues.

2 participants