comment on tests
This commit is contained in:
@@ -423,20 +423,30 @@ describe('react2angular', () => {
|
|||||||
onRender: renderSpy,
|
onRender: renderSpy,
|
||||||
values: ['val1']
|
values: ['val1']
|
||||||
})
|
})
|
||||||
const element = $(`<test-angular-eight-wrapper
|
const element = $(`
|
||||||
on-render="onRender"
|
<test-angular-eight-wrapper
|
||||||
on-component-will-unmount="onComponentWillUnmount"
|
on-render="onRender"
|
||||||
values="values">
|
on-component-will-unmount="onComponentWillUnmount"
|
||||||
</test-angular-eight-wrapper>`)
|
values="values">
|
||||||
|
</test-angular-eight-wrapper>
|
||||||
|
`)
|
||||||
|
|
||||||
$compile(element)(scope)
|
$compile(element)(scope)
|
||||||
const innerScope = angular
|
|
||||||
|
const childScope = angular
|
||||||
.element(element.find('test-angular-eight'))
|
.element(element.find('test-angular-eight'))
|
||||||
.scope()
|
.scope()
|
||||||
$rootScope.$apply()
|
$rootScope.$apply()
|
||||||
renderSpy.calls.reset()
|
|
||||||
innerScope.$destroy()
|
|
||||||
|
|
||||||
|
// Erase first render caused on apply
|
||||||
|
renderSpy.calls.reset()
|
||||||
|
|
||||||
|
// Destroy child component to cause unmount
|
||||||
|
childScope.$destroy()
|
||||||
|
|
||||||
|
// Make sure render on child was not called after unmount
|
||||||
|
expect(componentWillUnmountSpy.calls.count()).toEqual(1)
|
||||||
|
expect(renderSpy.calls.count()).toEqual(0)
|
||||||
expect(componentWillUnmountSpy).not.toHaveBeenCalledBefore(renderSpy)
|
expect(componentWillUnmountSpy).not.toHaveBeenCalledBefore(renderSpy)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user