Skip to content

Commit

Permalink
add failing test for PortalTarget onChange on initial render
Browse files Browse the repository at this point in the history
  • Loading branch information
meirish committed Jun 24, 2022
1 parent 2f55bd9 commit 1c1b969
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/test-app/tests/integration/components/portal-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,27 @@ module('Integration | Component | portal', function (hooks) {

assert.ok(action.calledWithExactly(1));
});

test('initial rendering a portal into a target triggers onChange', async function (assert) {
const action = sinon.spy();
this.set('action', action);

await render(hbs`
<PortalTarget @name="main" @multiple={{true}} id="portal" @onChange={{this.action}} />
<Portal @target="main">
<div id="content">foo</div>
</Portal>
<Portal @target="main">
<div id="content2">bar</div>
</Portal>
`);

await settled();

assert.ok(action.calledWithExactly(1));
assert.ok(action.calledWithExactly(2));
assert.equal(action.callCount, 2);
});
});

0 comments on commit 1c1b969

Please sign in to comment.