Fixed errors thrown in tests that were causing random failures

no issue

- dropped `id` attribute added to `<GhBenefitItem>` because it was only using the index resulting in multiple `id="1"` on the page which is invalid HTML and caused Glimmer to complain
- added a check for `portalPreviewIframe` existence when the portal message listener in the offer controller is fired because it was occurring out of sync with the tests and throwing async errors that were picked up in random later tests
This commit is contained in:
Kevin Ansfield 2022-03-14 10:28:58 +00:00
parent 0be1f206a5
commit 7374b0f8c6
2 changed files with 1 additions and 2 deletions

View File

@ -138,7 +138,6 @@
<DraggableObject @content={{benefitItem}} @dragHandle=".gh-blognav-grab" @isSortable={{true}}>
<GhBenefitItem
@benefitItem={{benefitItem}}
@id={{index}}
@addItem={{action "addBenefit"}}
@focusItem={{action "focusItem"}}
@deleteItem={{action "deleteBenefit"}}

View File

@ -203,7 +203,7 @@ export default class OffersController extends Controller {
if (!this.portalMessageListener) {
this.portalMessageListener = (event) => {
const resizeEvents = ['portal-ready', 'portal-preview-updated'];
if (resizeEvents.includes(event.data.type) && event.data.payload?.height && this.portalPreviewIframe.parentNode) {
if (resizeEvents.includes(event.data.type) && event.data.payload?.height && this.portalPreviewIframe?.parentNode) {
this.portalPreviewIframe.parentNode.style.height = `${event.data.payload.height}px`;
}
};