PolymerElements / iron-test-helpers

Utility classes to make testing easier
26 stars 25 forks source link

fire event should set the details of the custom event #61

Open steventill opened 8 years ago

steventill commented 8 years ago

Description

fireevent does not properly pass the details to the event handler

Expected outcome

the receiving event handler has detail set to what props are

Actual outcome

all of the props are props on the event and detail is undefined

Steps to reproduce

TestHelper.fireevent( 'item-removed', { id: '123' } );

Browsers Affected

all

Possible fix

global.fireEvent = function(type, props, node) { // detail is a readonly event on custom event if it is not set when you create it var event = new CustomEvent(type, { bubbles: true, cancelable: true, detail: props });

node.dispatchEvent(event);

};

jarrodek commented 7 years ago

I'm requesting this too. I'm not allowed to use this function and set detail object which is read only after the CustomEvent is created.